aboutsummaryrefslogtreecommitdiffstats
path: root/device/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'device/peer.go')
-rw-r--r--device/peer.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/device/peer.go b/device/peer.go
index 4e7f2da..256e4f5 100644
--- a/device/peer.go
+++ b/device/peer.go
@@ -232,6 +232,25 @@ func (peer *Peer) ZeroAndFlushAll() {
peer.FlushNonceQueue()
}
+func (peer *Peer) ExpireCurrentKeypairs() {
+ handshake := &peer.handshake
+ handshake.mutex.Lock()
+ peer.device.indexTable.Delete(handshake.localIndex)
+ handshake.Clear()
+ handshake.mutex.Unlock()
+ peer.handshake.lastSentHandshake = time.Now().Add(-(RekeyTimeout + time.Second))
+
+ keypairs := &peer.keypairs
+ keypairs.Lock()
+ if keypairs.current != nil {
+ keypairs.current.sendNonce = RejectAfterMessages
+ }
+ if keypairs.next != nil {
+ keypairs.next.sendNonce = RejectAfterMessages
+ }
+ keypairs.Unlock()
+}
+
func (peer *Peer) Stop() {
// prevent simultaneous start/stop operations