Crate reth_discv4
source ·Expand description
Discovery v4 implementation: https://github.com/ethereum/devp2p/blob/master/discv4.md
Discv4 employs a kademlia-like routing table to store and manage discovered peers and topics. The protocol allows for external IP discovery in NAT environments through regular PING/PONG’s with discovered nodes. Nodes return the external IP address that they have received and a simple majority is chosen as our external IP address. If an external IP address is updated, this is produced as an event to notify the swarm (if one is used for this behaviour).
This implementation consists of a Discv4
and Discv4Service
pair. The service manages the
state and drives the UDP socket. The (optional) Discv4
serves as the frontend to interact
with the service via a channel. Whenever the underlying table changes service produces a
DiscoveryUpdate
that listeners will receive.
§Feature Flags
serde
(default): Enable serde supporttest-utils
: Export utilities for testing
Modules§
- Error types that can occur in this crate.
- Discovery v4 protocol implementation.
- test_
utils test-utils
Mock discovery support
Structs§
- The Discv4 frontend
- Configuration parameters that define the performance of the discovery network.
- Builder type for
Discv4Config
- Manages discv4 peer discovery over UDP.
- Represents a ENR in discovery.
Enums§
- Represents node related updates state changes in the underlying node table
- The Event type the Service stream produces.
- reexport to get public ip. All builtin resolvers.
Constants§
- The default address for discv4 via UDP
- The default address for discv4 via UDP: “0.0.0.0:30303”
- The default port for discv4 via UDP
Functions§
- reexport to get public ip. Attempts to produce an IP address with all builtin resolvers (best effort).