Documentation ¶
Index ¶
Constants ¶
View Source
const ( // a small number representing the degree of parallelism in network calls Alpha = 3 // the size in bits of the keys used to identify nodes and store and // retrieve data; in basic Kademlia this is 160, the length of a SHA1 B = 160 // the maximum number of contacts stored in a bucket K = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type RoutingTable ¶
type RoutingTable struct { NodeInfo Node KBuckets [B][]Node // contains filtered or unexported fields }
func NewRoutingTable ¶
func NewRoutingTable(b Node) *RoutingTable
func (*RoutingTable) AddNode ¶
func (rt *RoutingTable) AddNode(b Node) error
Función que se encarga de añadir un nodo a la tabla de rutas con las restricciones pertinentes del protocolo
func (*RoutingTable) GetClosestContacts ¶
func (rt *RoutingTable) GetClosestContacts(num int, target []byte, ignoredNodes []*Node) *ShortList
type ShortList ¶
type ShortList struct { // Nodes are a list of nodes to be compared Nodes *[]Node // Comparator is the ID to compare to Comparator []byte }
nodeList is used in order to sort a list of arbitrary nodes against a comparator. These nodes are sorted by xor distance
func (*ShortList) RemoveNode ¶
type Storage ¶
func NewStorage ¶
func NewStorage() *Storage
Click to show internal directories.
Click to hide internal directories.