diff --git a/net/resolve.go b/net/resolve.go index 5a3fb2b..c3decd8 100644 --- a/net/resolve.go +++ b/net/resolve.go @@ -41,7 +41,7 @@ func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.M // todo optimize: only fetch these if we have a "any" addr. if len(ifaceAddrs) < 1 { var err error - ifaceAddrs, err = InterfaceAddresses() + ifaceAddrs, err = interfaceAddresses() if err != nil { return nil, err } @@ -63,10 +63,10 @@ func ResolveUnspecifiedAddresses(unspecAddrs, ifaceAddrs []ma.Multiaddr) ([]ma.M return outputAddrs, nil } -// InterfaceAddresses returns a list of addresses associated with local machine +// interfaceAddresses returns a list of addresses associated with local machine // Note: we do not return link local addresses. IP loopback is ok, because we // may be connecting to other nodes in the same machine. -func InterfaceAddresses() ([]ma.Multiaddr, error) { +func interfaceAddresses() ([]ma.Multiaddr, error) { maddrs, err := InterfaceMultiaddrs() if err != nil { return nil, err @@ -74,7 +74,7 @@ func InterfaceAddresses() ([]ma.Multiaddr, error) { var out []ma.Multiaddr for _, a := range maddrs { - if !AddrOverNonLocalIP(a) { + if !addrOverNonLocalIP(a) { continue } out = append(out, a) @@ -82,8 +82,8 @@ func InterfaceAddresses() ([]ma.Multiaddr, error) { return out, nil } -// AddrOverNonLocalIP returns whether the addr uses a non-local ip link -func AddrOverNonLocalIP(a ma.Multiaddr) bool { +// addrOverNonLocalIP returns whether the addr uses a non-local ip link +func addrOverNonLocalIP(a ma.Multiaddr) bool { split := ma.Split(a) if len(split) < 1 { return false