Versions in this module Expand all Collapse all v1 v1.0.0 Jul 21, 2023 Changes in this version + func CompareAddrPorts(a, b netip.AddrPort) bool + func GenerateId() ([]byte, error) + func GenerateRandomBytes(n int) ([]byte, error) + type Contact struct + AddrPort netip.AddrPort + Id []byte + Metadata map[string]any + SeenAt time.Time + VectorClock int + type Contacts []Contact + type KBucket struct + Metadata map[string]any + func NewKBucket(options KBucketOptions, emitter *eventemitter.Emitter) (*KBucket, error) + func (b *KBucket) Add(contact Contact) *KBucket + func (b *KBucket) Clear() + func (b *KBucket) Closest(id []byte, n uint) Contacts + func (b *KBucket) Count() int + func (b *KBucket) Distance(fid, sid []byte) int + func (b *KBucket) Get(id []byte) Contact + func (b *KBucket) GetId() []byte + func (b *KBucket) Has(id []byte) bool + func (b *KBucket) Remove(id []byte) + func (b *KBucket) Seen(id []byte) bool + func (b *KBucket) SetArbiterFn(arbiterFn func(Contact, Contact) Contact) + func (b *KBucket) SetDistanceFn(distanceFn func([]byte, []byte) int) + func (b *KBucket) ToSlice() Contacts + type KBucketOptions struct + LocalNodeId []byte + NodesPerKBucket int + NodesToPing int