Versions in this module Expand all Collapse all v1 v1.1.0 Aug 14, 2019 v1.0.0 Jun 25, 2019 Changes in this version + const NodeIDBits + const NodeTypeBN + const NodeTypeCN + const NodeTypeEN + const NodeTypePN + const NodeTypeUnknown + const Version + func NewSimpleStorage(nodeType NodeType, noDiscover bool, max int, authorizedNodes []*Node) *simpleStorage + func StringNodeType(nType NodeType) string + type Config struct + Addr *net.UDPAddr + AnnounceAddr *net.UDPAddr + AuthorizedNodes []*Node + Bootnodes []*Node + Conn conn + Id NodeID + MaxNeighborsNode uint + NetRestrict *netutil.Netlist + NetworkID uint64 + NodeDBPath string + NodeType NodeType + PrivateKey *ecdsa.PrivateKey + Unhandled chan<- ReadPacket + type Discovery interface + Bond func(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16, nType NodeType) (*Node, error) + Close func() + CreateUpdateNodeOnDB func(n *Node) error + CreateUpdateNodeOnTable func(n *Node) error + DeleteAuthorizedNodes func(nodes []*Node) + DeleteNodeFromDB func(n *Node) error + DeleteNodeFromTable func(n *Node) error + GetAuthorizedNodes func() []*Node + GetBucketEntries func() []*Node + GetNodeFromDB func(id NodeID) (*Node, error) + GetNodes func(targetType NodeType, max int) []*Node + GetReplacements func() []*Node + HasBond func(id NodeID) bool + IsAuthorized func(fromID NodeID, nType NodeType) bool + Lookup func(target NodeID, targetType NodeType) []*Node + Name func() string + PutAuthorizedNodes func(nodes []*Node) + ReadRandomNodes func([]*Node, NodeType) int + Resolve func(target NodeID, targetType NodeType) *Node + RetrieveNodes func(target common.Hash, nType NodeType, nresults int) []*Node + Self func() *Node + func ListenUDP(cfg *Config) (Discovery, error) + func NewDiscovery(cfg *Config) (Discovery, error) + type DiscoveryType uint8 + type KademliaStorage struct + type Node struct + ID NodeID + IP net.IP + NType NodeType + PortOrder uint16 + TCP uint16 + TCPs []uint16 + UDP uint16 + func MustParseNode(rawurl string) *Node + func NewNode(id NodeID, ip net.IP, udpPort, tcpPort uint16, nType NodeType) *Node + func ParseNode(rawurl string) (*Node, error) + func (n *Node) CompareNode(tn *Node) bool + func (n *Node) Incomplete() bool + func (n *Node) MarshalText() ([]byte, error) + func (n *Node) String() string + func (n *Node) UnmarshalText(text []byte) error + type NodeID [NodeIDBits / 8]byte + func BytesID(b []byte) (NodeID, error) + func HexID(in string) (NodeID, error) + func MustBytesID(b []byte) NodeID + func MustHexID(in string) NodeID + func PubkeyID(pub *ecdsa.PublicKey) NodeID + func (id NodeID) Pubkey() (*ecdsa.PublicKey, error) + func (n *NodeID) UnmarshalText(text []byte) error + func (n NodeID) Bytes() []byte + func (n NodeID) GoString() string + func (n NodeID) MarshalText() ([]byte, error) + func (n NodeID) ShortString() string + func (n NodeID) String() string + func (n NodeID) TerminalString() string + type NodeType uint8 + func ParseNodeType(nt string) NodeType + type ReadPacket struct + Addr *net.UDPAddr + Data []byte + type Table struct + func (tab *Table) Bond(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16, nType NodeType) (*Node, error) + func (tab *Table) Close() + func (tab *Table) CreateUpdateNodeOnDB(n *Node) error + func (tab *Table) CreateUpdateNodeOnTable(n *Node) error + func (tab *Table) DeleteAuthorizedNodes(nodes []*Node) + func (tab *Table) DeleteNodeFromDB(n *Node) error + func (tab *Table) DeleteNodeFromTable(n *Node) error + func (tab *Table) GetAuthorizedNodes() []*Node + func (tab *Table) GetBucketEntries() []*Node + func (tab *Table) GetNodeFromDB(id NodeID) (*Node, error) + func (tab *Table) GetNodes(targetNT NodeType, max int) []*Node + func (tab *Table) GetReplacements() []*Node + func (tab *Table) HasBond(id NodeID) bool + func (tab *Table) IsAuthorized(fromID NodeID, nType NodeType) bool + func (tab *Table) Lookup(targetID NodeID, targetType NodeType) []*Node + func (tab *Table) Name() string + func (tab *Table) PutAuthorizedNodes(nodes []*Node) + func (tab *Table) ReadRandomNodes(buf []*Node, nType NodeType) (n int) + func (tab *Table) Resolve(targetID NodeID, targetType NodeType) *Node + func (tab *Table) RetrieveNodes(target common.Hash, nType NodeType, nresults int) []*Node + func (tab *Table) Self() *Node