Skip to content

Commit

Permalink
Merge pull request #585 from libp2p/fix/optimize-is-relay
Browse files Browse the repository at this point in the history
fix: optimize isRelay
  • Loading branch information
Stebalien authored Apr 14, 2020
2 parents 6b94711 + e774f01 commit 6edcea2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dht_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 6edcea2

Please sign in to comment.