ipn/ipnlocal: add MagicDNS records for IPv6-only nodes

Updates #2268

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-09-07 15:45:28 -07:00
committed by Brad Fitzpatrick
parent 90b0cd0c51
commit 7fe6ecf165
3 changed files with 31 additions and 4 deletions

View File

@@ -164,3 +164,24 @@ func NewContainsIPFunc(addrs []netaddr.IPPrefix) func(ip netaddr.IP) bool {
}
return func(ip netaddr.IP) bool { return m[ip] }
}
// PrefixesContainsFunc reports whether f is true for any IPPrefix in
// ipp.
func PrefixesContainsFunc(ipp []netaddr.IPPrefix, f func(netaddr.IPPrefix) bool) bool {
for _, v := range ipp {
if f(v) {
return true
}
}
return false
}
// IPsContainsFunc reports whether f is true for any IP in ips.
func IPsContainsFunc(ips []netaddr.IP, f func(netaddr.IP) bool) bool {
for _, v := range ips {
if f(v) {
return true
}
}
return false
}