Documentation ¶
Overview ¶
Package discover implements the Node Discovery Protocol.
The Node Discovery protocol provides a way to find RLPx nodes that can be connected to. It uses a Kademlia-like protocol to maintain a distributed database of the IDs and endpoints of all listening nodes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.8.0
type Config struct { // These settings are required and configure the UDP listener: PrivateKey *ecdsa.PrivateKey // These settings are optional: AnnounceAddr *net.UDPAddr // local address announced in the DHT NodeDBPath string // if set, the node database is stored at this filesystem location NetRestrict *netutil.Netlist // network whitelist Bootnodes []*enode.Node // list of bootstrap nodes Unhandled chan<- ReadPacket // unhandled packets are sent on this channel }
Config holds Table-related settings.
type ReadPacket ¶ added in v1.8.0
ReadPacket is sent to the unhandled channel when it could not be processed
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) Close ¶
func (tab *Table) Close()
Close terminates the network listener and flushes the node database.
func (*Table) LookupRandom ¶ added in v1.8.17
LookupRandom finds random nodes in the network.
func (*Table) ReadRandomNodes ¶ added in v0.9.24
ReadRandomNodes fills the given slice with random nodes from the table. The results are guaranteed to be unique for a single invocation, no node will appear twice.