diff options
Diffstat (limited to 'device/peer.go')
-rw-r--r-- | device/peer.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/device/peer.go b/device/peer.go index a96f261..3ec625f 100644 --- a/device/peer.go +++ b/device/peer.go @@ -14,6 +14,7 @@ import ( "time" "golang.zx2c4.com/wireguard/conn" + "golang.zx2c4.com/wireguard/wgcfg" ) const ( @@ -76,7 +77,8 @@ type Peer struct { cookieGenerator CookieGenerator } -func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) { +func (device *Device) NewPeer(pk wgcfg.Key) (*Peer, error) { + if device.isClosed.Get() { return nil, errors.New("device closed") } @@ -116,7 +118,7 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) { handshake := &peer.handshake handshake.mutex.Lock() - handshake.precomputedStaticStatic = device.staticIdentity.privateKey.sharedSecret(pk) + handshake.precomputedStaticStatic = device.staticIdentity.privateKey.SharedSecret(pk) handshake.remoteStatic = pk handshake.mutex.Unlock() |