diff --git a/conn/controlfns_linux.go b/conn/controlfns_linux.go index f0deefaaf..27b925a39 100644 --- a/conn/controlfns_linux.go +++ b/conn/controlfns_linux.go @@ -29,7 +29,7 @@ func kernelVersion() (major, minor int) { value = (value * 10) + int(c-'0') } else { // Note that we're assuming N.N.N here. - // If we see anything else, we are likely to mis-parse it. + // If we see anything else, we are likely to miss-parse it. values[vi] = value vi++ if vi >= len(values) { diff --git a/device/allowedips_rand_test.go b/device/allowedips_rand_test.go index b863696fb..607b557c4 100644 --- a/device/allowedips_rand_test.go +++ b/device/allowedips_rand_test.go @@ -92,15 +92,15 @@ func TestTrieRandom(t *testing.T) { for n := 0; n < NumberOfAddresses; n++ { var addr4 [4]byte rng.Read(addr4[:]) - cidr := uint8(rand.Intn(32) + 1) - index := rand.Intn(NumberOfPeers) + cidr := uint8(rng.Intn(32) + 1) + index := rng.Intn(NumberOfPeers) allowedIPs.Insert(netip.PrefixFrom(netip.AddrFrom4(addr4), int(cidr)), peers[index]) slow4 = slow4.Insert(addr4[:], cidr, peers[index]) var addr6 [16]byte rng.Read(addr6[:]) - cidr = uint8(rand.Intn(128) + 1) - index = rand.Intn(NumberOfPeers) + cidr = uint8(rng.Intn(128) + 1) + index = rng.Intn(NumberOfPeers) allowedIPs.Insert(netip.PrefixFrom(netip.AddrFrom16(addr6), int(cidr)), peers[index]) slow6 = slow6.Insert(addr6[:], cidr, peers[index]) } diff --git a/device/constants.go b/device/constants.go index 41da61806..0601b41e5 100644 --- a/device/constants.go +++ b/device/constants.go @@ -22,7 +22,7 @@ const ( RejectAfterTime = time.Second * 180 KeepaliveTimeout = time.Second * 10 CookieRefreshTime = time.Second * 120 - HandshakeInitationRate = time.Second / 50 + HandshakeInitiationRate = time.Second / 50 PaddingMultiple = 16 ) diff --git a/device/noise-protocol.go b/device/noise-protocol.go index 5cf1702b6..ae56eff85 100644 --- a/device/noise-protocol.go +++ b/device/noise-protocol.go @@ -405,7 +405,7 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer { // protect against replay & flood replay := !timestamp.After(handshake.lastTimestamp) - flood := time.Since(handshake.lastInitiationConsumption) <= HandshakeInitationRate + flood := time.Since(handshake.lastInitiationConsumption) <= HandshakeInitiationRate handshake.mutex.RUnlock() if replay { device.log.Verbosef("%v - ConsumeMessageInitiation: handshake replay @ %v", peer, timestamp)