Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions score.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions score_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down