Skip to main content

Module routing_table

Module routing_table 

Source

Re-exportsยง

pub use bucket::Bucket;
pub use bucket::BucketEntry;
pub use bucket::EntryStatusFlag;
pub use bucket::CONNECTED_ENTRY;
pub use bucket::DISCONNECTED_ENTRY;
pub use bucket::PENDING_ENTRY;
pub use bucket::UNREACHABLE_ENTRY;
pub use bucket::UNSTABLE_ENTRY;
pub use entry::xor_distance;
pub use entry::Entry;
pub use entry::Key;

Modulesยง

bucket ๐Ÿ”’
entry ๐Ÿ”’

Structsยง

RoutingTable
This is a modified version of the Kademlia Distributed Hash Table (DHT). https://en.wikipedia.org/wiki/Kademlia

Enumsยง

AddEntryResult
Represents the possible result when adding a new entry.

Constantsยง

DISTANCE_LIMIT ๐Ÿ”’
The distance limit for the closest buckets.
MAX_MATCHED_SUBNET_IN_BUCKET ๐Ÿ”’
The maximum number of matched subnets allowed within a single bucket.
MAX_MATCHED_SUBNET_IN_TABLE ๐Ÿ”’
The maximum number of matched subnets across the entire routing table.
TABLE_SIZE ๐Ÿ”’
The total number of buckets in the routing table.

Functionsยง

is_loopback_pair ๐Ÿ”’
True if both addresses are IPv4 or IPv6 loopback.
matches_local ๐Ÿ”’
True if peerโ€™s advertised bloom is acceptable to a local node whose bloom is mine. Peer must cover every mandatory bit and, when optional is non-empty, share at least one optional bit. An empty mine matches everything.
subnet_match ๐Ÿ”’
Check if two addresses belong to the same subnet.
subnet_restricted ๐Ÿ”’
Iterate the buckets and count entries in the same subnet as entry. Restricted if same-bucket matches >= MAX_MATCHED_SUBNET_IN_BUCKET or table-wide matches >= MAX_MATCHED_SUBNET_IN_TABLE.