add node hasip

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2024-11-25 10:03:47 +01:00
parent 6422cdf576
commit af969f602c
No known key found for this signature in database

View file

@ -135,6 +135,16 @@ func (node *Node) IPs() []netip.Addr {
return ret return ret
} }
// HasIP reports if a node has a given IP address.
func (node *Node) HasIP(i netip.Addr) bool {
for _, ip := range node.IPs() {
if ip.Compare(i) == 0 {
return true
}
}
return false
}
// IsTagged reports if a device is tagged // IsTagged reports if a device is tagged
// and therefore should not be treated as a // and therefore should not be treated as a
// user owned device. // user owned device.