latest.ipv8.overlay
Module Contents
Classes
Overlay settings, extensible for Overlay subclasses. |
|
Interface for an Internet overlay. |
Attributes
- class latest.ipv8.overlay.Settings
Bases:
types.SimpleNamespace
Overlay settings, extensible for Overlay subclasses.
- my_peer: latest.ipv8.types.Peer
The (private key) peer of this peer.
- endpoint: latest.ipv8.types.Endpoint
The endpoint to use for messaging.
- network: latest.ipv8.peerdiscovery.network.Network
The network graph backend.
- latest.ipv8.overlay.SettingsClass
- class latest.ipv8.overlay.Overlay(settings: SettingsClass)
Bases:
latest.ipv8.messaging.interfaces.endpoint.EndpointListener
,latest.ipv8.taskmanager.TaskManager
,Generic
[SettingsClass
]Interface for an Internet overlay.
- get_serializer() latest.ipv8.messaging.serialization.Serializer
Get a Serializer for this Overlay.
- abstract on_packet(packet: tuple[latest.ipv8.types.Address, bytes]) None
Callback for when data is received on this endpoint.
- Parameters:
packet – the received packet, in (source, binary string) format.
- update_global_time(global_time: int) None
Increase the local global time if the given GLOBAL_TIME is larger.
- get_available_strategies() dict[str, type[latest.ipv8.peerdiscovery.discovery.DiscoveryStrategy]]
Supply custom DiscoveryStrategies for use with this Overlay. This is used by the configuration system to allow for non-globally defined strategies.
- Returns:
a dictionary of names and DiscoveryStrategy subclass classes
- Return type:
{str: class<DiscoveryStrategy>}
- abstract walk_to(address: latest.ipv8.types.Address) None
Puncture the NAT of an address.
- Parameters:
address – the address to walk to (ip, port)
- abstract get_new_introduction(from_peer: latest.ipv8.types.Peer | None = None) None
Get a new IP address to walk to from a random, or selected peer.
- Parameters:
from_peer – the peer to ask for an introduction
- abstract get_peers() list[latest.ipv8.types.Peer]
Get the peers for this specific overlay.
- Returns:
the peers in the Network that use this overlay
- abstract get_walkable_addresses() list[latest.ipv8.types.Address]
Get the list of IPv4 addresses we can walk to on this overlay.
- get_peer_for_introduction(exclude: latest.ipv8.types.Peer | None = None) latest.ipv8.types.Peer | None
Get a peer for introduction.
- Param:
exclude: optionally specify a peer that is not considered eligible for introduction
- Returns:
a Peer to send an introduction request to, or None if there are no available