Unverified Commit 6edcea2f authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #585 from libp2p/fix/optimize-is-relay

fix: optimize isRelay
parents 6b94711f e774f016
......@@ -166,10 +166,10 @@ func sameV6Net(a, b net.IP) bool {
}
func isRelayAddr(a ma.Multiaddr) bool {
for _, p := range a.Protocols() {
if p.Code == ma.P_CIRCUIT {
return true
}
}
return false
found := false
ma.ForEach(a, func(c ma.Component) bool {
found = c.Protocol().Code == ma.P_CIRCUIT
return !found
})
return found
}
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