Skip to content

Commit

Permalink
unexport AddrOverNonLocalIP and InterfaceAddresses
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 14, 2021
1 parent 458c2bc commit cb0380f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions net/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -63,27 +63,27 @@ 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
}

var out []ma.Multiaddr
for _, a := range maddrs {
if !AddrOverNonLocalIP(a) {
if !addrOverNonLocalIP(a) {
continue
}
out = append(out, a)
}
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
Expand Down

0 comments on commit cb0380f

Please sign in to comment.