diff --git a/score.go b/score.go index d2e54528..048cba20 100644 --- a/score.go +++ b/score.go @@ -976,12 +976,14 @@ func (ps *peerScore) getIPs(p peer.ID) []string { ip4 := ip.String() res = append(res, ip4) } else { - // IPv6 address -- we add both the actual address and the /64 subnet + // IPv6 address -- we add both the actual address and (optionally) the /64 subnet ip6 := ip.String() res = append(res, ip6) - ip6mask := ip.Mask(net.CIDRMask(64, 128)).String() - res = append(res, ip6mask) + if ps.params.IPv6SubnetColocation { + ip6mask := ip.Mask(net.CIDRMask(64, 128)).String() + res = append(res, ip6mask) + } } } diff --git a/score_params.go b/score_params.go index 3a205840..099165d6 100644 --- a/score_params.go +++ b/score_params.go @@ -73,6 +73,9 @@ type PeerScoreParams struct { IPColocationFactorThreshold int IPColocationFactorWhitelist map[string]struct{} + // IPv6SubnetColocation controls whether /64 IPv6 subnets should be considered colocated. + IPv6SubnetColocation bool + // P7: behavioural pattern penalties. // This parameter has an associated counter which tracks misbehaviour as detected by the // router. The router currently applies penalties for the following behaviors: