diff --git a/bits.go b/bits.go index 49cadc193..8fd67a68a 100644 --- a/bits.go +++ b/bits.go @@ -104,7 +104,7 @@ func (b *Bits) Update(i uint64) bool { } // Allow for the 0 packet to come in within the first window - if i == 0 && b.firstSeen == false && b.current < b.length { + if i == 0 && !b.firstSeen && b.current < b.length { b.firstSeen = true b.bits[i%b.length] = true return true @@ -122,7 +122,7 @@ func (b *Bits) Update(i uint64) bool { return false } - if b.bits[i%b.length] == true { + if b.bits[i%b.length] { if l.Level >= logrus.DebugLevel { l.WithField("receiveWindow", m{"accepted": false, "currentCounter": b.current, "incomingCounter": i, "reason": "old duplicate"}). Debug("Receive window") diff --git a/hostmap.go b/hostmap.go index 0069319c6..890b899dc 100644 --- a/hostmap.go +++ b/hostmap.go @@ -782,7 +782,7 @@ func localIps(allowList *AllowList) *[]net.IP { case *net.IPAddr: ip = v.IP } - if ip.To4() != nil && ip.IsLoopback() == false { + if ip.To4() != nil && !ip.IsLoopback() { allow := allowList.Allow(ip2int(ip)) l.WithField("localIp", ip).WithField("allow", allow).Debug("localAllowList.Allow") if !allow { diff --git a/inside.go b/inside.go index 3e36b49d8..b0b4987e2 100644 --- a/inside.go +++ b/inside.go @@ -40,7 +40,7 @@ func (f *Interface) consumeInsidePacket(packet []byte, fwPacket *FirewallPacket, } ci := hostinfo.ConnectionState - if ci.ready == false { + if !ci.ready { // Because we might be sending stored packets, lock here to stop new things going to // the packet queue. ci.queueLock.Lock() @@ -69,7 +69,7 @@ func (f *Interface) consumeInsidePacket(packet []byte, fwPacket *FirewallPacket, // getOrHandshake returns nil if the vpnIp is not routable func (f *Interface) getOrHandshake(vpnIp uint32) *HostInfo { - if f.hostMap.vpnCIDR.Contains(int2ip(vpnIp)) == false { + if !f.hostMap.vpnCIDR.Contains(int2ip(vpnIp)) { vpnIp = f.hostMap.queryUnsafeRoute(vpnIp) if vpnIp == 0 { return nil @@ -187,7 +187,7 @@ func (f *Interface) SendMessageToAll(t NebulaMessageType, st NebulaMessageSubTyp return } - if hostInfo.ConnectionState.ready == false { + if !hostInfo.ConnectionState.ready { // Because we might be sending stored packets, lock here to stop new things going to // the packet queue. hostInfo.ConnectionState.queueLock.Lock() diff --git a/interface.go b/interface.go index ee9065779..b839a8a03 100644 --- a/interface.go +++ b/interface.go @@ -214,7 +214,7 @@ func (f *Interface) reloadCertKey(c *Config) { func (f *Interface) reloadFirewall(c *Config) { //TODO: need to trigger/detect if the certificate changed too - if c.HasChanged("firewall") == false { + if !c.HasChanged("firewall") { l.Debug("No firewall config change detected") return } diff --git a/lighthouse.go b/lighthouse.go index 3251ef154..1f1731c4d 100644 --- a/lighthouse.go +++ b/lighthouse.go @@ -162,7 +162,7 @@ func (lh *LightHouse) DeleteVpnIP(vpnIP uint32) { func (lh *LightHouse) AddRemote(vpnIP uint32, toIp *udpAddr, static bool) { // First we check if the sender thinks this is a static entry // and do nothing if it is not, but should be considered static - if static == false { + if !static { if _, ok := lh.staticList[vpnIP]; ok { return }