2.12.ipv8.peerdiscovery.discovery

Module Contents

Classes

Attributes

2.12.ipv8.peerdiscovery.discovery._OT
class 2.12.ipv8.peerdiscovery.discovery.DiscoveryStrategy(overlay: _OT)

Bases: Generic[_OT]

Strategy for discovering peers in a network.

abstract take_step() None

Callback for when an IPv8 tick occurs (defaults to roughly every 0.5 seconds).

get_peer_count() int

Determine the current number of peers. This is used by IPv8 to determine whether to call this strategy.

If self.overlay is not None, we expect it to have a get_peers() -> list[Peer] method.

class 2.12.ipv8.peerdiscovery.discovery.RandomWalk(overlay: 2.12.ipv8.types.Overlay, timeout: float = 3.0, window_size: int = 5, reset_chance: int = 50, target_interval: int = 0)

Bases: DiscoveryStrategy[2.12.ipv8.types.Overlay]

Walk randomly through the network.

take_step() None

Walk to random walkable peer.

class 2.12.ipv8.peerdiscovery.discovery.EdgeWalk(overlay: 2.12.ipv8.types.Overlay, edge_length: int = 4, neighborhood_size: int = 6, edge_timeout: float = 3.0)

Bases: DiscoveryStrategy[2.12.ipv8.types.Overlay]

Walk through the network by using edges.

This will perform a depth-first search in the network starting from your direct neighborhood. When a certain depth is reached, we teleport home and start again from our neighborhood.

get_available_root() 2.12.ipv8.types.Peer | None

Get a root, if it exists, which is not busy constructing an edge for us.

take_step() None

Attempt to grow an edge.