Versions in this module Expand all Collapse all v0 v0.0.1 Nov 2, 2025 Changes in this version + const DefaultMaxActiveNodes + const DefaultMaxFailures + const DefaultMaxNodeAge + const DefaultMaxNodesPerIP + const DefaultPingInterval + const DefaultPingRate + const DefaultSweepPercent + const RejectionAdmission + const RejectionIPLimit + const RejectionLogTTL + type DB interface + ExpireRejections func(ttl time.Duration) (int, error) + LoadRejection func(id node.ID) (flags uint8, timestamp time.Time, found bool, err error) + StoreRejection func(id node.ID, reason uint8, timestamp time.Time) error + type FlatTable struct + func NewFlatTable(cfg FlatTableConfig) (*FlatTable, error) + func (t *FlatTable) ActiveSize() int + func (t *FlatTable) Add(n *node.Node) bool + func (t *FlatTable) CanAddNodeByIP(n *node.Node) bool + func (t *FlatTable) FindClosestNodes(target node.ID, k int) []*node.Node + func (t *FlatTable) Get(nodeID node.ID) *node.Node + func (t *FlatTable) GetActiveNodes() []*node.Node + func (t *FlatTable) GetBucketNodes(bucketIndex int) []*node.Node + func (t *FlatTable) GetNodesByDistance(targetID node.ID, distances []uint, k int) []*node.Node + func (t *FlatTable) GetNodesNeedingPing() []*node.Node + func (t *FlatTable) GetRandomActiveNodes(k int) []*node.Node + func (t *FlatTable) GetStats() TableStats + func (t *FlatTable) LoadInitialNodesFromDB() error + func (t *FlatTable) NumBucketsFilled() int + func (t *FlatTable) PerformSweep() + func (t *FlatTable) SetForkScoringInfo(info *node.ForkScoringInfo) + func (t *FlatTable) Size() int + type FlatTableConfig struct + DB *nodedb.NodeDB + LocalID node.ID + Logger logrus.FieldLogger + MaxActiveNodes int + MaxFailures int + MaxNodeAge time.Duration + MaxNodesPerIP int + NodeChangedCallback NodeChangedCallback + PingInterval time.Duration + PingRate int + SweepPercent int + type IPLimiter struct + func NewIPLimiter(maxNodesPerIP int) *IPLimiter + func (l *IPLimiter) Add(n *node.Node) bool + func (l *IPLimiter) CanAdd(n *node.Node) bool + func (l *IPLimiter) GetNodeCountForIP(ip net.IP) int + func (l *IPLimiter) GetStats() IPStats + func (l *IPLimiter) GetTotalRejections() int + func (l *IPLimiter) Remove(nodeID node.ID) + type IPStats struct + IPDistribution map[string]int + MaxNodesPerIP int + Rejections int + TotalNodes int + UniqueIPs int + type NodeChangedCallback func(*node.Node) + type TableStats struct + ActiveNodes int + AdmissionRejections int + BucketsFilled int + DeadNodesRemoved int + IPLimitRejections int + IPStats IPStats + TotalNodes int