Object.P2PBootstrap (object v0.1.2)
P2P bootstrap and discovery service for the Object network.
Provides multiple discovery mechanisms to find and join the P2P network including hardcoded bootstrap nodes, DNS seeds, mDNS/Bonjour local discovery, BitTorrent DHT integration, and gossip-based peer exchange.
Features
- Multiple bootstrap strategies
- DNS seed resolution
- mDNS/Bonjour local network discovery
- BitTorrent mainline DHT integration
- Gossip-based peer exchange protocol
- Bootstrap node reputation tracking
- Network partition detection and healing
Summary
Functions
Adds a known peer to the peer list.
Announces this node to the network.
Returns a specification to start this module under a supervisor.
Initiates network discovery using all available methods.
Gets the current list of known peers.
Gets bootstrap statistics.
Starts the P2P bootstrap service.
Types
@type bootstrap_method() :: :hardcoded | :dns | :mdns | :dht | :peer_exchange
@type bootstrap_stats() :: %{ total_peers_discovered: non_neg_integer(), successful_connections: non_neg_integer(), failed_connections: non_neg_integer(), discovery_methods_used: %{required(bootstrap_method()) => non_neg_integer()} }
@type peer_info() :: %{ node_id: binary(), address: String.t(), port: non_neg_integer(), last_seen: DateTime.t(), reputation: float(), capabilities: MapSet.t(), latency_ms: non_neg_integer() | nil }
@type state() :: %{ node_id: binary(), peers: %{required(binary()) => peer_info()}, bootstrap_nodes: [peer_info()], dns_seeds: [String.t()], active_discoveries: MapSet.t(), peer_exchange_enabled: boolean(), mdns_ref: reference() | nil, dht_port: non_neg_integer() | nil, stats: bootstrap_stats() }
Functions
@spec add_peer(binary(), String.t(), non_neg_integer()) :: :ok
Adds a known peer to the peer list.
@spec announce(non_neg_integer()) :: :ok
Announces this node to the network.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Initiates network discovery using all available methods.
@spec get_peers() :: [peer_info()]
Gets the current list of known peers.
@spec get_stats() :: bootstrap_stats()
Gets bootstrap statistics.
Starts the P2P bootstrap service.