Commit 6a0950fe authored by Marten Seemann's avatar Marten Seemann

rename AddrOverNonLocalIP to IsIpv6LinkLocal

parent 67926707
......@@ -95,8 +95,8 @@ func IsIPUnspecified(m ma.Multiaddr) bool {
return net.IP(c.RawValue()).IsUnspecified()
}
// AddrOverNonLocalIP returns whether the addr uses a non-local ip link
func AddrOverNonLocalIP(a ma.Multiaddr) bool {
// IsIpv6LinkLocal returns whether the addr uses a non-local ip link
func IsIpv6LinkLocal(a ma.Multiaddr) bool {
split := ma.Split(a)
if len(split) < 1 {
return false
......
......@@ -74,7 +74,7 @@ func interfaceAddresses() ([]ma.Multiaddr, error) {
var out []ma.Multiaddr
for _, a := range maddrs {
if !AddrOverNonLocalIP(a) {
if !IsIpv6LinkLocal(a) {
continue
}
out = append(out, a)
......
......@@ -67,9 +67,9 @@ func TestAddrOverNonLocalIP(t *testing.T) {
newMultiaddr(t, "/ip4/1.2.3.4/udp/1234/utp"),
}
for _, addr := range bad {
require.Falsef(t, AddrOverNonLocalIP(addr), "%s is a link local addr", addr)
require.Falsef(t, IsIpv6LinkLocal(addr), "%s is a link local addr", addr)
}
for _, addr := range good {
require.Truef(t, AddrOverNonLocalIP(addr), "%s is not a link local addr", addr)
require.Truef(t, IsIpv6LinkLocal(addr), "%s is not a link local addr", addr)
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment