2.13.ipv8.messaging.interfaces.udp.endpoint

Module Contents

Classes

class 2.13.ipv8.messaging.interfaces.udp.endpoint.UDPv4Address

Bases: NamedTuple

An IPv4 address intended for UDP communication.

ip: str
port: int
class 2.13.ipv8.messaging.interfaces.udp.endpoint.UDPv4LANAddress

Bases: NamedTuple

An IPv4 address intended for UDP communication over lan networks.

ip: str
port: int
class 2.13.ipv8.messaging.interfaces.udp.endpoint.UDPv6Address

Bases: NamedTuple

An IPv6 address intended for UDP communication.

ip: str
port: int
class 2.13.ipv8.messaging.interfaces.udp.endpoint.DomainAddress

Bases: NamedTuple

A host-port combination for DNS servers.

host: str
port: int
class 2.13.ipv8.messaging.interfaces.udp.endpoint.UDPEndpoint(port: int = 0, ip: str = '0.0.0.0')

Bases: 2.13.ipv8.messaging.interfaces.endpoint.Endpoint, asyncio.DatagramProtocol

Endpoint that binds UDP (over IPv4 by default).

SOCKET_FAMILY
datagram_received(datagram: bytes, addr: tuple[str, int]) None

Process incoming data.

send(socket_address: ipv8.types.Address, packet: bytes) None

Send a packet to a given address.

Parameters:

socket_address – Tuple of (IP, port) which indicates the destination of the packet.

log_error(message: str, level: int = logging.WARNING) None

Log a message using our own logger instance.

async open() bool

Open the Endpoint.

Returns:

True is the Endpoint was successfully opened, False otherwise.

assert_open() None

Check if we are opened by the programmer and if the underlying transport is fully open.

close() None

Closes the Endpoint.

get_address() ipv8.types.Address

Get the address for this Endpoint.

is_open() bool

Check if the underlying socket is open.

reset_byte_counters() None

Set bytes_up and bytes_down to 0.

class 2.13.ipv8.messaging.interfaces.udp.endpoint.UDPv6Endpoint(port: int = 0, ip: str = '::')

Bases: UDPEndpoint

UDPEndpoint subclass that binds to IPv6 instead of IPv4.

SOCKET_FAMILY
datagram_received(datagram: bytes, addr: tuple[str, int]) None

Process incoming data.