Documentation
¶
Index ¶
- func XOR(a, b []byte) []byte
- type ID
- func (id ID) Closer(id1 ID, id2 ID) bool
- func (id ID) CommonPrefixLen(o ID) int
- func (id ID) Distance(id1 ID) *big.Int
- func (id ID) Equals(other ID) bool
- func (id ID) Less(o ID) bool
- func (id ID) Pretty() string
- func (id ID) SortByDistance(ids []ID) []ID
- func (id ID) Xor(o ID) ID
- func (id ID) ZeroPrefixLen() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ID ¶
type ID []byte
ID is a dht-compatible ID using the XOR keyspace.
func NewIDFromBase58String ¶
NewIDFromBase58String creates a new dht ID from provided base58 encoded binary data.
func NewIDFromHexString ¶
NewIDFromHexString creates a new dht ID from provided hex-encoded string.
func NewIDFromNodeKey ¶
NewIDFromNodeKey creates a new dht id from provided binary data.
func (ID) CommonPrefixLen ¶
CommonPrefixLen returns the common shared prefix length in BITS of the binary numbers represented by the ids.
func (ID) Less ¶
Less returns true iff the binary number represented by ID is less than the number represented by o.
func (ID) SortByDistance ¶
SortByDistance ids based on xor-distance from ID.
func (ID) ZeroPrefixLen ¶
ZeroPrefixLen returns the zero prefix length of the binary number represnted by ID in bits.
Click to show internal directories.
Click to hide internal directories.