Skip to main content

Module peer_table

Module peer_table 

Source
Expand description

Unified peer table for both discv4 and discv5 discovery protocols.

This module provides a protocol-agnostic peer table that stores contact information discovered through either discv4 or discv5. The key abstraction is using Bytes for ping identifiers:

  • discv4: converts H256 ping hash to Bytes
  • discv5: already uses Bytes for req_id

Each contact is tagged with the protocol that discovered it, allowing protocol-specific lookups to only query compatible contacts.

Re-exports§

pub use crate::discv5::session::Session;

Modules§

peer_table_server_protocol

Structs§

Contact
KBucket
A single k-bucket in the Kademlia routing table. Each bucket stores contacts at a specific XOR distance range from the local node.
PeerData
PeerDiagnostics
Diagnostic snapshot of a peer’s state, used by admin RPC endpoints.
PeerTableServer
RequestPermit
Reservation handle for a peer request slot.

Enums§

ContactValidation
Result of contact validation.
DiscoveryProtocol
Identifies which discovery protocol was used to find a contact. This allows protocol-specific lookups to only query compatible contacts.

Constants§

MAX_NODES_PER_BUCKET
Maximum number of contacts per k-bucket (Kademlia k parameter).
TARGET_PEERS
The target number of RLPx connections to reach.

Traits§

PeerTableServerProtocol
ToPeerTableServerRef

Type Aliases§

PeerTable
PeerTableServerRef
Type-erased reference to any actor implementing PeerTableServerProtocol.