Documentation ¶
Index ¶
- func DistCmp(target, a, b ID) int
- func LogDist(a, b ID) int
- func NewUDP(node INode, metricCollector IMetricCollector) (*Table, *UDP)
- type DB
- func (db *DB) FindFails(n INode) int
- func (db *DB) LastPingReceived(n INode) float64
- func (db *DB) LastPongReceived(n INode) float64
- func (db *DB) QuerySeeds(n int) []INode
- func (db *DB) UpdateFindFails(n INode, fails int)
- func (db *DB) UpdateLastPingReceived(n INode, time float64)
- func (db *DB) UpdateLastPongReceived(n INode, time float64)
- type Table
- type UDP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DistCmp ¶
func DistCmp(target, a, b ID) int
DistCmp compares the distances a->target and b->target. Returns -1 if a is closer to target, 1 if b is closer to target and 0 if they are equal.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) LastPingReceived ¶
func (*DB) LastPongReceived ¶
func (*DB) QuerySeeds ¶
QuerySeeds retrieves random nodes to be used as potential seed nodes for bootstrapping.
func (*DB) UpdateFindFails ¶
func (*DB) UpdateLastPingReceived ¶
func (*DB) UpdateLastPongReceived ¶
type Table ¶
type Table struct { IMetricCollector // contains filtered or unexported fields }
func (*Table) LookupRandom ¶
func (tab *Table) LookupRandom() []INode
LookupRandom finds random nodes in the network.
func (*Table) ReadRandomNodes ¶
ReadRandomNodes fills the given slice with random nodes from the table. The results are guaranteed to be unique for a single invocation, no node will appear twice.
Click to show internal directories.
Click to hide internal directories.