diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-23 15:48:23 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-23 15:48:23 +0200 |
commit | 2ed9dac3a51b296819380758f4390b0032243c61 (patch) | |
tree | 07e354051922a04e9037cb3c714af6fe3138130e /src/config.go | |
parent | 47f8a3d89ad0d1478246bf62140eb4fbfe83ac72 (diff) | |
parent | 2a6dd2ed926ddc44cd98d8c940aa01f830213ea0 (diff) |
Merge branch 'darwin'
Diffstat (limited to 'src/config.go')
-rw-r--r-- | src/config.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/config.go b/src/config.go index 509da58..c889de0 100644 --- a/src/config.go +++ b/src/config.go @@ -105,17 +105,17 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError { key := parts[0] value := parts[1] + fmt.Println(key, value) + switch key { /* interface configuration */ case "private_key": + var sk NoisePrivateKey if value == "" { - device.mutex.Lock() - device.privateKey = NoisePrivateKey{} - device.mutex.Unlock() + device.SetPrivateKey(sk) } else { - var sk NoisePrivateKey err := sk.FromHex(value) if err != nil { logError.Println("Failed to set private_key:", err) @@ -182,9 +182,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError { switch key { case "remove": - peer.mutex.Lock() device.RemovePeer(peer.handshake.remoteStatic) - peer.mutex.Unlock() logDebug.Println("Removing", peer.String()) peer = nil @@ -235,7 +233,6 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError { return &IPCError{Code: ipcErrorInvalidValue} } ones, _ := network.Mask.Size() - logError.Println(network, ones, network.IP) device.routingTable.Insert(network.IP, uint(ones), peer) default: |