mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-07 07:13:13 +00:00
more rigorously defeat unspecified address gremlins
This commit is contained in:
parent
0a9a87cf04
commit
432caf4fdf
12
score.go
12
score.go
@ -769,8 +769,8 @@ func (ps *peerScore) getIPs(p peer.ID) []string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore those; loopback for unit testing and unspecific because gremlins in testground
|
// ignore those; loopback for unit testing and unspecified because gremlins
|
||||||
// give us an unspecific IP6 conns everywhere!
|
// seem give us an unspecified IPv6 conn everywhere in testground testing!
|
||||||
if ip.IsUnspecified() || ip.IsLoopback() {
|
if ip.IsUnspecified() || ip.IsLoopback() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -787,8 +787,12 @@ func (ps *peerScore) getIPs(p peer.ID) []string {
|
|||||||
ip6 := ip.String()
|
ip6 := ip.String()
|
||||||
res = append(res, ip6)
|
res = append(res, ip6)
|
||||||
|
|
||||||
ip6mask := ip.Mask(net.CIDRMask(64, 128)).String()
|
ip6mask := ip.Mask(net.CIDRMask(64, 128))
|
||||||
res = append(res, ip6mask)
|
// this seems necessary to defeat the unspecfied address gremlins -- plus it is in the
|
||||||
|
// IANA reserved address space anyway, so it doesn't hurt.
|
||||||
|
if !ip6mask.IsUnspecified() {
|
||||||
|
res = append(res, ip6mask.String())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user