aboutsummaryrefslogtreecommitdiffstats
path: root/src/uapi.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-09-26 14:26:12 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-09-26 14:26:50 +0200
commit012e7b9d3316023e6ea891f9fe72f15d1db6668a (patch)
treec1f084300b3aa6a984e2e2038a812ec86c54e77f /src/uapi.go
parentBegin work on source address caching (linux) (diff)
downloadwireguard-go-012e7b9d3316023e6ea891f9fe72f15d1db6668a.tar.xz
wireguard-go-012e7b9d3316023e6ea891f9fe72f15d1db6668a.zip
Simplified xplatform spec
Diffstat (limited to '')
-rw-r--r--src/uapi.go26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/uapi.go b/src/uapi.go
index 3a2f3f9..034033a 100644
--- a/src/uapi.go
+++ b/src/uapi.go
@@ -124,16 +124,12 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
switch key {
case "private_key":
var sk NoisePrivateKey
- if value == "" {
- device.SetPrivateKey(sk)
- } else {
- err := sk.FromHex(value)
- if err != nil {
- logError.Println("Failed to set private_key:", err)
- return &IPCError{Code: ipcErrorInvalid}
- }
- device.SetPrivateKey(sk)
+ err := sk.FromHex(value)
+ if err != nil {
+ logError.Println("Failed to set private_key:", err)
+ return &IPCError{Code: ipcErrorInvalid}
}
+ device.SetPrivateKey(sk)
case "listen_port":
port, err := strconv.ParseUint(value, 10, 16)
@@ -161,14 +157,10 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
// TODO: Clear source address of all peers
case "fwmark":
- var fwmark uint64 = 0
- if value != "" {
- var err error
- fwmark, err = strconv.ParseUint(value, 10, 32)
- if err != nil {
- logError.Println("Invalid fwmark", err)
- return &IPCError{Code: ipcErrorInvalid}
- }
+ fwmark, err := strconv.ParseUint(value, 10, 32)
+ if err != nil {
+ logError.Println("Invalid fwmark", err)
+ return &IPCError{Code: ipcErrorInvalid}
}
device.net.mutex.Lock()