Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ctx ¶
Ctx returns a Context and a CancelFunc. The context will be cancelled just before the test binary deadline (as specified by the -timeout flag when running the test). The CancelFunc may be called to cancel the context earlier than the deadline.
func Key256WithLeadingBytes ¶
Key256WithLeadingBytes returns a 256-bit Kademlia key consisting of the given leading bytes padded by zero bytes to the end of the key.
Types ¶
type ID ¶
ID is a concrete implementation of the NodeID interface.
func NewID ¶
NewID returns a new Kademlia identifier that implements the NodeID interface. Instead of deriving the Kademlia key from a NodeID, this method directly takes the Kademlia key.
type Key8 ¶
type Key8 uint8
Key8 is an 8-bit Kademlia key, suitable for testing and simulation of very small networks.
func (Key8) CommonPrefixLength ¶
CommonPrefixLength returns the number of leading bits the key shares with another key of the same type.
func (Key8) Compare ¶
Compare compares the numeric value of the key with another key of the same type.
type Key32 ¶
type Key32 uint32
Key32 is a 32-bit Kademlia key, suitable for testing and simulation of small networks.
func RandomKeyWithPrefix ¶
RandomKeyWithPrefix returns a 32-bit Kademlia key having a prefix equal to the bit pattern held in s and random following bits. A prefix of up to 32 bits is supported.
func (Key32) BitString ¶
BitString returns a string containing the binary representation of the key.
func (Key32) CommonPrefixLength ¶
CommonPrefixLength returns the number of leading bits the key shares with another key of the same type.
func (Key32) Compare ¶
Compare compares the numeric value of the key with another key of the same type.