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 support
  • test-utils: Export utilities for testing

Modules§

  • Error types that can occur in this crate.
  • Discovery v4 protocol implementation.
  • test_utilstest-utils
    Mock discovery support

Structs§

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§

Functions§

  • reexport to get public ip. Attempts to produce an IP address with all builtin resolvers (best effort).