Skip to main content

Module peer_discovery_protocol

Module peer_discovery_protocol 

Source
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_us deadline; PeerDiscoveryProtocol::expire_peers removes stale entries.
  • Event sourcing – every state transition emits a PdpDiscoveryEvent that callers drain with PeerDiscoveryProtocol::drain_events.
  • PRNG – random peer selection uses a lock-free xorshift64 PRNG; no rand crate dependency.
  • Capability filtering – peers are annotated with free-form capability strings so callers can select specialized subsets.

Structs§

PdpDiscoveredPeer
A peer that has been discovered through one of the supported discovery strategies and is being tracked by PeerDiscoveryProtocol.
PdpDiscoveryConfig
Configuration for PeerDiscoveryProtocol.
PdpDiscoveryStats
Aggregate statistics emitted by PeerDiscoveryProtocol::stats.
PeerDiscoveryProtocol
Multi-strategy peer discovery protocol.

Enums§

PdpDiscoveryError
Errors returned by PeerDiscoveryProtocol operations.
PdpDiscoveryEvent
Events emitted by PeerDiscoveryProtocol as state transitions occur.
PdpDiscoveryMethod
The mechanism that surfaced a particular PdpDiscoveredPeer.

Functions§

xorshift64
xorshift64 PRNG — fast, non-cryptographic, no external dependencies.

Type Aliases§

DiscoveredPeer
Type alias: DiscoveredPeer in the peer_discovery_protocol namespace.
DiscoveryConfig
Type alias: DiscoveryConfig in the peer_discovery_protocol namespace.
DiscoveryError
Type alias: DiscoveryError in the peer_discovery_protocol namespace.
DiscoveryEvent
Type alias: DiscoveryEvent in the peer_discovery_protocol namespace.
DiscoveryStats
Type alias: DiscoveryStats in the peer_discovery_protocol namespace.