diff --git a/pkg/node/peer.go b/pkg/node/peer.go index 12049d4..85335aa 100644 --- a/pkg/node/peer.go +++ b/pkg/node/peer.go @@ -107,12 +107,12 @@ type PeerRegistry struct { } // Dimension weights for peer selection -// Lower ping, hops, geo are better; higher score is better +// Lower ping, hops, geographic distance are better; higher score is better var ( - pingWeight = 1.0 - hopsWeight = 0.7 - geoWeight = 0.2 - scoreWeight = 1.2 + pingWeight = 1.0 + hopsWeight = 0.7 + geographicWeight = 0.2 + scoreWeight = 1.2 ) // NewPeerRegistry creates a new PeerRegistry, loading existing peers if available. @@ -565,7 +565,7 @@ func (r *PeerRegistry) rebuildKDTree() { Coords: []float64{ peer.PingMS * pingWeight, float64(peer.Hops) * hopsWeight, - peer.GeoKM * geoWeight, + peer.GeoKM * geographicWeight, (100 - peer.Score) * scoreWeight, // Invert score }, Value: peer.ID,