mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-27 16:07:42 +08:00
Clear up naming around zero address
This commit is contained in:
@ -128,7 +128,7 @@ func (s *Swarm) Dial(peer peer.Peer) (conn.Conn, error) {
|
|||||||
Peerstore: s.peers,
|
Peerstore: s.peers,
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are attempting to connect to a loopback addr, fail out early
|
// If we are attempting to connect to the zero addr, fail out early
|
||||||
raddr := peer.NetAddress("tcp")
|
raddr := peer.NetAddress("tcp")
|
||||||
if raddr == nil {
|
if raddr == nil {
|
||||||
return nil, fmt.Errorf("No remote address for network tcp")
|
return nil, fmt.Errorf("No remote address for network tcp")
|
||||||
|
@ -115,7 +115,7 @@ func GetenvBool(name string) bool {
|
|||||||
// IsLoopbackAddr returns whether or not the ip portion of the passed in multiaddr
|
// IsLoopbackAddr returns whether or not the ip portion of the passed in multiaddr
|
||||||
// string is a loopback address
|
// string is a loopback address
|
||||||
func IsLoopbackAddr(addr string) bool {
|
func IsLoopbackAddr(addr string) bool {
|
||||||
loops := []string{"/ip4/127.0.0.1", "/ip6/::1", "/ip4/0.0.0.0"}
|
loops := []string{"/ip4/127.0.0.1", "/ip6/::1"}
|
||||||
for _, loop := range loops {
|
for _, loop := range loops {
|
||||||
if strings.HasPrefix(addr, loop) {
|
if strings.HasPrefix(addr, loop) {
|
||||||
return true
|
return true
|
||||||
|
Reference in New Issue
Block a user