Skip to main content

Module mesh_kad

Module mesh_kad 

Source
Expand description

Kademlia DHT for WeftOS mesh peer discovery (K6.2).

Implements a simplified Kademlia Distributed Hash Table for wide-area peer discovery. Uses XOR distance metric on 256-bit node keys and k-bucket routing tables.

DHT keys are namespaced with the governance genesis hash prefix so that nodes from different governance clusters occupy disjoint key-spaces.

Structs§

DhtEntry
A record stored in the DHT.
KademliaDiscovery
Kademlia DHT discovery backend.
KademliaTable
Simplified Kademlia routing table with k-buckets.
NamespacedDhtKey
A governance-namespaced DHT key.

Constants§

ALPHA
Parallel lookup factor.
KEY_BITS
Key-space size in bits (SHA-256).
K_BUCKET_SIZE
Maximum peers per k-bucket.

Functions§

bucket_index
Bucket index for a given XOR distance.
leading_zeros
Count leading zero bits in a DHT key (0..=256).
xor_distance
XOR distance between two DHT keys.

Type Aliases§

DhtKey
A 256-bit DHT key.