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 ¶
- type Config
- type ReadPacket
- type Table
- type UDPConn
- type UDPv4
- func (t *UDPv4) Close()
- func (t *UDPv4) LookupPubkey(key *ecdsa.PublicKey) []*enode.Node
- func (t *UDPv4) LookupRandom() []*enode.Node
- func (t *UDPv4) Ping(n *enode.Node) error
- func (t *UDPv4) ReadRandomNodes(buf []*enode.Node) int
- func (t *UDPv4) RequestENR(n *enode.Node) (*enode.Node, error)
- func (t *UDPv4) Resolve(n *enode.Node) *enode.Node
- func (t *UDPv4) Self() *enode.Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // These settings are required and configure the UDP listener: PrivateKey *ecdsa.PrivateKey // These settings are optional: NetRestrict *netutil.Netlist // network whitelist Bootnodes []*enode.Node // list of bootstrap nodes Unhandled chan<- ReadPacket // unhandled packets are sent on this channel Log log.Logger // if set, log messages go here }
Config holds Table-related settings.
type ReadPacket ¶
ReadPacket is a packet that couldn't be handled. Those packets are sent to the unhandled channel if configured.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is the 'node table', a Kademlia-like index of neighbor nodes. The table keeps itself up-to-date by verifying the liveness of neighbors and requesting their node records when announcements of a new record version are received.
type UDPv4 ¶ added in v0.1.6
type UDPv4 struct {
// contains filtered or unexported fields
}
UDPv4 implements the v4 wire protocol.
func (*UDPv4) Close ¶ added in v0.1.6
func (t *UDPv4) Close()
Close shuts down the socket and aborts any running queries.
func (*UDPv4) LookupPubkey ¶ added in v0.1.6
func (*UDPv4) LookupRandom ¶ added in v0.1.6
LookupRandom finds random nodes in the network.
func (*UDPv4) ReadRandomNodes ¶ added in v0.1.6
ReadRandomNodes reads random nodes from the local table.
func (*UDPv4) RequestENR ¶ added in v0.1.6
RequestENR sends enrRequest to the given node and waits for a response.