Merge pull request #583 from libp2p/fix/faster-observer

identify: avoid parsing/printing multiaddrs
This commit is contained in:
vyzo 2019-04-09 10:47:24 +03:00 committed by GitHub
commit 9051b3c26e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -167,7 +167,8 @@ func (oas *ObservedAddrSet) Add(observed, local, observer ma.Multiaddr,
// IP addresses. In practice, this is what we want.
func observerGroup(m ma.Multiaddr) string {
//TODO: If IPv6 rolls out we should mark /64 routing zones as one group
return ma.Split(m)[0].String()
first, _ := ma.SplitFirst(m)
return string(first.Bytes())
}
func (oas *ObservedAddrSet) SetTTL(ttl time.Duration) {