diff --git a/score.go b/score.go index 413336f..e567cf9 100644 --- a/score.go +++ b/score.go @@ -228,6 +228,11 @@ func (ps *peerScore) score(p peer.ID) float64 { // P6: IP collocation factor for _, ip := range pstats.ips { + _, whitelisted := ps.params.IPColocationFactorWhitelist[ip] + if whitelisted { + continue + } + peersInIP := len(ps.peerIPs[ip]) if peersInIP > ps.params.IPColocationFactorThreshold { surpluss := float64(peersInIP - ps.params.IPColocationFactorThreshold) diff --git a/score_params.go b/score_params.go index 98d312b..5bbb344 100644 --- a/score_params.go +++ b/score_params.go @@ -63,6 +63,7 @@ type PeerScoreParams struct { // thus disabling the IP colocation penalty. IPColocationFactorWeight float64 IPColocationFactorThreshold int + IPColocationFactorWhitelist map[string]struct{} // the decay interval for parameter counters. DecayInterval time.Duration