Expand description
Multi-Strategy Peer Discovery Protocol
PeerDiscoveryProtocol implements a production-grade, multi-strategy peer
discovery engine that tracks peers discovered via Bootstrap, mDNS, DHT,
PeerExchange, Static configuration, and Rendezvous namespaces.
§Design overview
- Deduplication – peers are keyed by
id; adding an already-known peer merges its new addresses and refreshes TTL. - TTL-based expiry – every peer carries a
discovered_at + ttl_usdeadline;PeerDiscoveryProtocol::expire_peersremoves stale entries. - Event sourcing – every state transition emits a
PdpDiscoveryEventthat callers drain withPeerDiscoveryProtocol::drain_events. - PRNG – random peer selection uses a lock-free xorshift64 PRNG; no
randcrate dependency. - Capability filtering – peers are annotated with free-form capability strings so callers can select specialized subsets.
Structs§
- PdpDiscovered
Peer - A peer that has been discovered through one of the supported discovery
strategies and is being tracked by
PeerDiscoveryProtocol. - PdpDiscovery
Config - Configuration for
PeerDiscoveryProtocol. - PdpDiscovery
Stats - Aggregate statistics emitted by
PeerDiscoveryProtocol::stats. - Peer
Discovery Protocol - Multi-strategy peer discovery protocol.
Enums§
- PdpDiscovery
Error - Errors returned by
PeerDiscoveryProtocoloperations. - PdpDiscovery
Event - Events emitted by
PeerDiscoveryProtocolas state transitions occur. - PdpDiscovery
Method - The mechanism that surfaced a particular
PdpDiscoveredPeer.
Functions§
- xorshift64
- xorshift64 PRNG — fast, non-cryptographic, no external dependencies.
Type Aliases§
- Discovered
Peer - Type alias:
DiscoveredPeerin the peer_discovery_protocol namespace. - Discovery
Config - Type alias:
DiscoveryConfigin the peer_discovery_protocol namespace. - Discovery
Error - Type alias:
DiscoveryErrorin the peer_discovery_protocol namespace. - Discovery
Event - Type alias:
DiscoveryEventin the peer_discovery_protocol namespace. - Discovery
Stats - Type alias:
DiscoveryStatsin the peer_discovery_protocol namespace.