summaryrefslogtreecommitdiffhomepage
path: root/device.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-14 12:27:29 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-14 12:27:29 +0200
commit355e9bd619c8ec8bdd0f2934739a87a15ceb6920 (patch)
tree36dfb2a5d34e63873281f1d6ed23ca6eaf34a425 /device.go
parent8b30278ce666a74b46f607b47bf3fbe87744c016 (diff)
Clean more
Diffstat (limited to 'device.go')
-rw-r--r--device.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/device.go b/device.go
index 835a755..e91ca72 100644
--- a/device.go
+++ b/device.go
@@ -225,15 +225,15 @@ func (device *Device) SetPrivateKey(sk NoisePrivateKey) error {
for key, peer := range device.peers.keyMap {
- hs := &peer.handshake
+ handshake := &peer.handshake
if rmKey {
- hs.precomputedStaticStatic = [NoisePublicKeySize]byte{}
+ handshake.precomputedStaticStatic = [NoisePublicKeySize]byte{}
} else {
- hs.precomputedStaticStatic = device.staticIdentity.privateKey.sharedSecret(hs.remoteStatic)
+ handshake.precomputedStaticStatic = device.staticIdentity.privateKey.sharedSecret(handshake.remoteStatic)
}
- if isZero(hs.precomputedStaticStatic[:]) {
+ if isZero(handshake.precomputedStaticStatic[:]) {
unsafeRemovePeer(device, peer, key)
}
}
@@ -267,18 +267,12 @@ func NewDevice(tun TUNDevice, logger *Logger) *Device {
device.peers.keyMap = make(map[NoisePublicKey]*Peer)
- // initialize rate limiter
-
device.rate.limiter.Init()
device.rate.underLoadUntil.Store(time.Time{})
- // initialize staticIdentity & crypt-key routine
-
device.indexTable.Init()
device.allowedips.Reset()
- // setup buffer pool
-
device.pool.messageBuffers = sync.Pool{
New: func() interface{} {
return new([MaxMessageSize]byte)