diff options
-rw-r--r-- | device/allowedips_rand_test.go | 12 | ||||
-rw-r--r-- | device/allowedips_test.go | 6 | ||||
-rw-r--r-- | device/device.go | 2 | ||||
-rw-r--r-- | device/pools.go | 6 | ||||
-rw-r--r-- | tun/tun_openbsd.go | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/device/allowedips_rand_test.go b/device/allowedips_rand_test.go index 3947830..17e25b8 100644 --- a/device/allowedips_rand_test.go +++ b/device/allowedips_rand_test.go @@ -73,11 +73,11 @@ func TestTrieRandomIPv4(t *testing.T) { const AddressLength = 4 - for n := 0; n < NumberOfPeers; n += 1 { + for n := 0; n < NumberOfPeers; n++ { peers = append(peers, &Peer{}) } - for n := 0; n < NumberOfAddresses; n += 1 { + for n := 0; n < NumberOfAddresses; n++ { var addr [AddressLength]byte rand.Read(addr[:]) cidr := uint(rand.Uint32() % (AddressLength * 8)) @@ -86,7 +86,7 @@ func TestTrieRandomIPv4(t *testing.T) { slow = slow.Insert(addr[:], cidr, peers[index]) } - for n := 0; n < NumberOfTests; n += 1 { + for n := 0; n < NumberOfTests; n++ { var addr [AddressLength]byte rand.Read(addr[:]) peer1 := slow.Lookup(addr[:]) @@ -106,11 +106,11 @@ func TestTrieRandomIPv6(t *testing.T) { const AddressLength = 16 - for n := 0; n < NumberOfPeers; n += 1 { + for n := 0; n < NumberOfPeers; n++ { peers = append(peers, &Peer{}) } - for n := 0; n < NumberOfAddresses; n += 1 { + for n := 0; n < NumberOfAddresses; n++ { var addr [AddressLength]byte rand.Read(addr[:]) cidr := uint(rand.Uint32() % (AddressLength * 8)) @@ -119,7 +119,7 @@ func TestTrieRandomIPv6(t *testing.T) { slow = slow.Insert(addr[:], cidr, peers[index]) } - for n := 0; n < NumberOfTests; n += 1 { + for n := 0; n < NumberOfTests; n++ { var addr [AddressLength]byte rand.Read(addr[:]) peer1 := slow.Lookup(addr[:]) diff --git a/device/allowedips_test.go b/device/allowedips_test.go index 005df48..27028a6 100644 --- a/device/allowedips_test.go +++ b/device/allowedips_test.go @@ -70,11 +70,11 @@ func benchmarkTrie(peerNumber int, addressNumber int, addressLength int, b *test const AddressLength = 4 - for n := 0; n < peerNumber; n += 1 { + for n := 0; n < peerNumber; n++ { peers = append(peers, &Peer{}) } - for n := 0; n < addressNumber; n += 1 { + for n := 0; n < addressNumber; n++ { var addr [AddressLength]byte rand.Read(addr[:]) cidr := uint(rand.Uint32() % (AddressLength * 8)) @@ -82,7 +82,7 @@ func benchmarkTrie(peerNumber int, addressNumber int, addressLength int, b *test trie = trie.insert(addr[:], cidr, peers[index]) } - for n := 0; n < b.N; n += 1 { + for n := 0; n < b.N; n++ { var addr [AddressLength]byte rand.Read(addr[:]) trie.lookup(addr[:]) diff --git a/device/device.go b/device/device.go index 5f128fc..3172224 100644 --- a/device/device.go +++ b/device/device.go @@ -323,7 +323,7 @@ func NewDevice(tunDevice tun.Device, logger *Logger) *Device { cpus := runtime.NumCPU() device.state.stopping.Wait() - for i := 0; i < cpus; i += 1 { + for i := 0; i < cpus; i++ { device.state.stopping.Add(2) // decryption and handshake go device.RoutineEncryption() go device.RoutineDecryption() diff --git a/device/pools.go b/device/pools.go index 55eb6ab..12da65b 100644 --- a/device/pools.go +++ b/device/pools.go @@ -26,15 +26,15 @@ func (device *Device) PopulatePools() { } } else { device.pool.messageBufferReuseChan = make(chan *[MaxMessageSize]byte, PreallocatedBuffersPerPool) - for i := 0; i < PreallocatedBuffersPerPool; i += 1 { + for i := 0; i < PreallocatedBuffersPerPool; i++ { device.pool.messageBufferReuseChan <- new([MaxMessageSize]byte) } device.pool.inboundElementReuseChan = make(chan *QueueInboundElement, PreallocatedBuffersPerPool) - for i := 0; i < PreallocatedBuffersPerPool; i += 1 { + for i := 0; i < PreallocatedBuffersPerPool; i++ { device.pool.inboundElementReuseChan <- new(QueueInboundElement) } device.pool.outboundElementReuseChan = make(chan *QueueOutboundElement, PreallocatedBuffersPerPool) - for i := 0; i < PreallocatedBuffersPerPool; i += 1 { + for i := 0; i < PreallocatedBuffersPerPool; i++ { device.pool.outboundElementReuseChan <- new(QueueOutboundElement) } } diff --git a/tun/tun_openbsd.go b/tun/tun_openbsd.go index 2003420..460daff 100644 --- a/tun/tun_openbsd.go +++ b/tun/tun_openbsd.go @@ -124,7 +124,7 @@ func CreateTUN(name string, mtu int) (Device, error) { if ifIndex != -1 { tunfile, err = os.OpenFile(fmt.Sprintf("/dev/tun%d", ifIndex), unix.O_RDWR, 0) } else { - for ifIndex = 0; ifIndex < 256; ifIndex += 1 { + for ifIndex = 0; ifIndex < 256; ifIndex++ { tunfile, err = os.OpenFile(fmt.Sprintf("/dev/tun%d", ifIndex), unix.O_RDWR, 0) if err == nil || !errorIsEBUSY(err) { break |