latest.ipv8.dht.routing
Module Contents
Classes
The Node class represents a peer within the DHT community. |
|
The Bucket class stores nodes that share common prefix ID. |
|
The RoutingTable is a binary tree that keeps track of Nodes that we have a connection to. |
Functions
|
Convert a node id to a string. |
|
Get the XOR between two bytes strings, encoded as in int. |
|
Loosely based on the Bittorrent DHT (https://libtorrent.org/dht_sec.html), the node id is calculated as |
Attributes
- latest.ipv8.dht.routing.NODE_LIMIT_INTERVAL = 5
- latest.ipv8.dht.routing.NODE_LIMIT_QUERIES = 10
- latest.ipv8.dht.routing.NODE_STATUS_GOOD = 2
- latest.ipv8.dht.routing.NODE_STATUS_UNKNOWN = 1
- latest.ipv8.dht.routing.NODE_STATUS_BAD = 0
- latest.ipv8.dht.routing.MAX_BUCKET_SIZE = 8
- latest.ipv8.dht.routing.distance(a: bytes, b: bytes) int
Get the XOR between two bytes strings, encoded as in int.
- latest.ipv8.dht.routing.calc_node_id(address: latest.ipv8.types.Address | latest.ipv8.messaging.interfaces.udp.endpoint.UDPv4Address | latest.ipv8.messaging.interfaces.udp.endpoint.UDPv6Address, mid: bytes) bytes
Loosely based on the Bittorrent DHT (https://libtorrent.org/dht_sec.html), the node id is calculated as follows for IPv4: first 3 bytes of crc32c(ip & 0x030f3fff) + first 17 bytes of sha1(public_key).
- class latest.ipv8.dht.routing.Node(key: latest.ipv8.types.Key | bytes, address: latest.ipv8.types.Address | None = None, intro: bool = True)
Bases:
latest.ipv8.peer.Peer
The Node class represents a peer within the DHT community.
- class latest.ipv8.dht.routing.Bucket(prefix_id: str, max_size: int = MAX_BUCKET_SIZE)
The Bucket class stores nodes that share common prefix ID.