This commit is contained in:
jdl
2025-09-03 20:41:35 +02:00
parent 0a7328ed5f
commit c61319ed16
3 changed files with 6 additions and 31 deletions

View File

@@ -1,7 +1,6 @@
package peer
import (
"bytes"
"net/netip"
"time"
"vppn/m"
@@ -21,7 +20,6 @@ type remoteFSM struct {
lastSeen time.Time
traceID uint64
probes map[uint64]sentProbe
sharedKey [32]byte
buf []byte
}
@@ -117,7 +115,6 @@ func (r *remoteFSM) enterServer() stateFunc {
r.pingTimer.Reset(pingInterval)
r.lastSeen = time.Now()
clear(r.sharedKey[:])
return r.stateServer
}
@@ -174,9 +171,8 @@ func (r *remoteFSM) stateServer_onSyn(msg controlMsg[packetSyn]) {
conf.DirectAddr = msg.SrcAddr
// Update data cipher if the key has changed.
if !bytes.Equal(r.sharedKey[:], p.SharedKey[:]) {
if !conf.DataCipher.HasKey(p.SharedKey) {
conf.DataCipher = newDataCipherFromKey(p.SharedKey)
copy(r.sharedKey[:], p.SharedKey[:])
}
r.updateConf(conf)