latest.ipv8.messaging.interfaces.udp.endpoint

Module Contents

Classes

UDPv4Address

An IPv4 address intended for UDP communication.

UDPv4LANAddress

An IPv4 address intended for UDP communication over lan networks.

UDPv6Address

An IPv6 address intended for UDP communication.

DomainAddress

A host-port combination for DNS servers.

UDPEndpoint

Endpoint that binds UDP (over IPv4 by default).

UDPv6Endpoint

UDPEndpoint subclass that binds to IPv6 instead of IPv4.

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

Bases: NamedTuple

An IPv4 address intended for UDP communication.

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

Bases: NamedTuple

An IPv4 address intended for UDP communication over lan networks.

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

Bases: NamedTuple

An IPv6 address intended for UDP communication.

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

Bases: NamedTuple

A host-port combination for DNS servers.

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

Bases: latest.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 latest.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.