Package-level declarations
Types
A live Kademlia DHT node (BEP-5). This is the networked half of the DHT. It wires the pure RoutingTable, DhtMessage, DhtStorage and DhtItem types to a UDP socket via DhtRpc and TraversalState. Port of dht::node, dht_tracker and the find_data and get_peers traversal algorithms.
The live KRPC request and response manager. This is the coroutine port of libtorrent's rpc_manager (src/kademlia/rpc_manager.cpp) reduced to the one job that a commonMain engine can carry: match an outgoing query to its reply.
The pure candidate bookkeeping of an iterative Kademlia lookup. This is the network-free core of libtorrent's traversal_algorithm (src/kademlia/traversal_algorithm.cpp). DhtNode.getPeers drives one of these: it seeds the state with the routing table's closest nodes, then repeatedly asks the state for the next batch to query (next), fires the actual get_peers/find_node RPCs, and feeds the returned closer nodes back in (add).
Functions
Order nodes nearest-first by XOR distance to target. This is the standalone form of the comparator TraversalState inserts under, exposed for callers (and tests) that just want a sorted snapshot of compact nodes. Stable on ties by id.