latest.ipv8.bootstrapping.bootstrapper_interface

Module Contents

Classes

Bootstrapper

A script to connect to external bootstrapping resources, using external hardware.

class latest.ipv8.bootstrapping.bootstrapper_interface.Bootstrapper

Bases: abc.ABC

A script to connect to external bootstrapping resources, using external hardware.

When not to crash:
  • Loading this module file when missing dependencies.

  • Initializing a subclass when the service is unavailable (return False).

  • Failing to retrieve peers for a service (return an empty iterable, e.g. []).

When to crash:
  • Initializing this module subclass when missing dependencies.

abstract initialize(overlay: latest.ipv8.types.Community) asyncio.Future | Coroutine

Start connecting to this bootstrapping service. Don’t perform any network traffic in __init__!

You are encourages to implement this method as non-async to have faster bootstrapper inclusion.

Parameters:

overlay – the network overlay to initialize for.

Returns:

whether the initialization was successful.

abstract async get_addresses(overlay: latest.ipv8.types.Community, timeout: float) Iterable[latest.ipv8.types.Address]

Return some IPv8 addresses (if available) from this bootstrapping service. These addresses should be walkable (not blocked by a NAT or firewall).

Parameters:
  • overlay – the network overlay to get peers for.

  • timeout – the maximum time we wish to wait until we get any result (i.e. an empty list).

Returns:

the addresses for the given service_id.

abstract keep_alive(overlay: latest.ipv8.types.Community) None

Periodically called to keep this bootstrap connection alive.

Parameters:

overlay – the network overlay to keep alive.

abstract blacklist() Iterable[latest.ipv8.types.Address]

Returns the blacklisted addresses for this Bootstrapper.

abstract unload() None

Stop and unload all the resources used by this Bootstrapper.