Versions in this module Expand all Collapse all v0 v0.1.0 Dec 19, 2023 Changes in this version + var ErrLookupFailure = errors.New("failed to find any peer in table") + var ErrPeerRejectedHighLatency = errors.New("peer rejected; latency too high") + var ErrPeerRejectedNoCapacity = errors.New("peer rejected; insufficient capacity") + func Closer(a, b peer.ID, key string) bool + func CommonPrefixLen(a, b ID) int + func SortClosestPeers(peers []peer.ID, target ID) []peer.ID + func XOR(a, b []byte) []byte + type ID []byte + func ConvertKey(id string) ID + func ConvertPeerID(id peer.ID) ID + type PeerInfo struct + AddedAt time.Time + Id peer.ID + LastSuccessfulOutboundQueryAt time.Time + LastUsefulAt time.Time + type RoutingTable struct + PeerAdded func(peer.ID) + PeerRemoved func(peer.ID) + func NewRoutingTable(bucketsize int, localID ID, latency time.Duration, m peerstore.Metrics, ...) (*RoutingTable, error) + func (rt *RoutingTable) Close() error + func (rt *RoutingTable) Find(id peer.ID) peer.ID + func (rt *RoutingTable) GenRandPeerID(targetCpl uint) (peer.ID, error) + func (rt *RoutingTable) GenRandomKey(targetCpl uint) (ID, error) + func (rt *RoutingTable) GetDiversityStats() []peerdiversity.CplDiversityStats + func (rt *RoutingTable) GetPeerInfos() []PeerInfo + func (rt *RoutingTable) GetTrackedCplsForRefresh() []time.Time + func (rt *RoutingTable) ListPeers() []peer.ID + func (rt *RoutingTable) MarkAllPeersIrreplaceable() + func (rt *RoutingTable) NPeersForCpl(cpl uint) int + func (rt *RoutingTable) NearestPeer(id ID) peer.ID + func (rt *RoutingTable) NearestPeers(id ID, count int) []peer.ID + func (rt *RoutingTable) Print() + func (rt *RoutingTable) RemovePeer(p peer.ID) + func (rt *RoutingTable) ResetCplRefreshedAtForID(id ID, newTime time.Time) + func (rt *RoutingTable) Size() int + func (rt *RoutingTable) TryAddPeer(p peer.ID, queryPeer bool, isReplaceable bool) (bool, error) + func (rt *RoutingTable) UpdateLastSuccessfulOutboundQueryAt(p peer.ID, t time.Time) bool + func (rt *RoutingTable) UpdateLastUsefulAt(p peer.ID, t time.Time) bool + func (rt *RoutingTable) UsefulNewPeer(p peer.ID) bool