aboutsummaryrefslogtreecommitdiffstats
path: root/uapi.go
diff options
context:
space:
mode:
Diffstat (limited to 'uapi.go')
-rw-r--r--uapi.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/uapi.go b/uapi.go
index c795b73..732bf82 100644
--- a/uapi.go
+++ b/uapi.go
@@ -248,12 +248,10 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
logError.Println("Failed to create new peer:", err)
return &IPCError{Code: ipcErrorInvalid}
}
- logDebug.Println("UAPI: Created new peer:", peer.String())
+ logDebug.Println("UAPI: Created new peer:", peer)
}
- peer.mutex.Lock()
- peer.timer.handshakeDeadline.Reset(RekeyAttemptTime)
- peer.mutex.Unlock()
+ peer.event.handshakePushDeadline.Fire()
case "remove":
@@ -264,7 +262,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
return &IPCError{Code: ipcErrorInvalid}
}
if !dummy {
- logDebug.Println("UAPI: Removing peer:", peer.String())
+ logDebug.Println("UAPI: Removing peer:", peer)
device.RemovePeer(peer.handshake.remoteStatic)
}
peer = &Peer{}
@@ -274,7 +272,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
// update PSK
- logDebug.Println("UAPI: Updating pre-shared key for peer:", peer.String())
+ logDebug.Println("UAPI: Updating pre-shared key for peer:", peer)
peer.handshake.mutex.Lock()
err := peer.handshake.presharedKey.FromHex(value)
@@ -289,7 +287,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
// set endpoint destination
- logDebug.Println("UAPI: Updating endpoint for peer:", peer.String())
+ logDebug.Println("UAPI: Updating endpoint for peer:", peer)
err := func() error {
peer.mutex.Lock()
@@ -299,7 +297,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
return err
}
peer.endpoint = endpoint
- peer.timer.handshakeDeadline.Reset(RekeyAttemptTime)
+ peer.event.handshakePushDeadline.Fire()
return nil
}()
@@ -312,7 +310,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
// update keep-alive interval
- logDebug.Println("UAPI: Updating persistent_keepalive_interval for peer:", peer.String())
+ logDebug.Println("UAPI: Updating persistent_keepalive_interval for peer:", peer)
secs, err := strconv.ParseUint(value, 10, 16)
if err != nil {
@@ -337,7 +335,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
case "replace_allowed_ips":
- logDebug.Println("UAPI: Removing all allowed IPs for peer:", peer.String())
+ logDebug.Println("UAPI: Removing all allowed IPs for peer:", peer)
if value != "true" {
logError.Println("Failed to set replace_allowed_ips, invalid value:", value)
@@ -354,7 +352,7 @@ func ipcSetOperation(device *Device, socket *bufio.ReadWriter) *IPCError {
case "allowed_ip":
- logDebug.Println("UAPI: Adding allowed_ip to peer:", peer.String())
+ logDebug.Println("UAPI: Adding allowed_ip to peer:", peer)
_, network, err := net.ParseCIDR(value)
if err != nil {