Expand description
Kademlia DHT implementation: BEP 5 routing, BEP 42 security, BEP 44 storage, BEP 51 indexing.
Implements the Mainline DHT protocol: KRPC message encoding, Kademlia routing table, peer discovery, and announce operations.
§Architecture
The DHT runs as an actor: DhtHandle::start() spawns a background task
that owns all state (routing table, UDP socket, pending queries). The
returned DhtHandle is a cheap, cloneable sender for submitting commands.
Re-exports§
pub use bep44::ImmutableItem;pub use bep44::MAX_SALT_SIZE;pub use bep44::MAX_VALUE_SIZE;pub use bep44::MutableItem;pub use bep44::build_signing_buffer;pub use bep44::compute_mutable_target;pub use compact::COMPACT_NODE_SIZE;pub use compact::COMPACT_NODE6_SIZE;pub use compact::CompactNodeInfo;pub use compact::CompactNodeInfo6;pub use compact::encode_compact_nodes;pub use compact::encode_compact_nodes6;pub use compact::parse_compact_nodes;pub use compact::parse_compact_nodes6;pub use error::Error;pub use error::Result;pub use handle::DhtBroadcast;pub use handle::DhtReceiver;pub use krpc::GetPeersResponse;pub use krpc::KrpcBody;pub use krpc::KrpcMessage;pub use krpc::KrpcQuery;pub use krpc::KrpcResponse;pub use krpc::SampleInfohashesResponse;pub use krpc::TransactionId;pub use node_id::ExternalIpVoter;pub use node_id::IpVoteSource;pub use node_id::generate_node_id;pub use node_id::is_bep42_exempt;pub use node_id::is_valid_node_id;pub use routing_table::NodeStatus;pub use routing_table::RoutingTable;pub use storage::DhtStorage;pub use storage::InMemoryDhtStorage;
Modules§
- bep44
- BEP 44 immutable and mutable item storage. BEP 44: DHT arbitrary data storage types and validation.
- bloom
- BEP 33 bloom filters for DHT scrape swarm estimation. BEP 33: 256-byte bloom filter for DHT scrape swarm estimation.
- compact
- Compact node encoding (26-byte IPv4, 38-byte IPv6).
- error
- DHT error types.
- handle
- Broadcast surface for runtime DhtHandle replacement (M173 Lane B B5). Broadcast surface for runtime DHT handle replacement (M173 Lane B B5).
- krpc
- KRPC message encoding and decoding (BEP 5). KRPC message encoding and decoding (BEP 5).
- node_id
- BEP 42 node ID generation and validation. BEP 42: DHT Security Extension — Node ID generation and verification.
- peer_
store - Per-info_hash peer storage and announce token management. Per-info_hash peer storage and token generation/validation.
- routing_
table - Kademlia routing table with k-buckets. Kademlia routing table with k-buckets (BEP 5).
- storage
- DHT item storage backend. Pluggable DHT item storage (BEP 44).
Structs§
- DhtConfig
- Configuration for the DHT.
- DhtHandle
- A cloneable handle to the DHT actor.
- DhtStats
- Runtime statistics for the DHT.
- Sample
Infohashes Result - Result of a
sample_infohashesquery (BEP 51).