3.0.ipv8.messaging.interfaces.udp.endpoint ========================================== .. py:module:: 3.0.ipv8.messaging.interfaces.udp.endpoint Classes ------- .. autoapisummary:: 3.0.ipv8.messaging.interfaces.udp.endpoint.UDPv4Address 3.0.ipv8.messaging.interfaces.udp.endpoint.UDPv4LANAddress 3.0.ipv8.messaging.interfaces.udp.endpoint.UDPv6Address 3.0.ipv8.messaging.interfaces.udp.endpoint.DomainAddress 3.0.ipv8.messaging.interfaces.udp.endpoint.UDPEndpoint 3.0.ipv8.messaging.interfaces.udp.endpoint.UDPv6Endpoint Module Contents --------------- .. py:class:: UDPv4Address Bases: :py:obj:`NamedTuple` An IPv4 address intended for UDP communication. .. py:attribute:: ip :type: str .. py:attribute:: port :type: int .. py:class:: UDPv4LANAddress Bases: :py:obj:`NamedTuple` An IPv4 address intended for UDP communication over lan networks. .. py:attribute:: ip :type: str .. py:attribute:: port :type: int .. py:class:: UDPv6Address Bases: :py:obj:`NamedTuple` An IPv6 address intended for UDP communication. .. py:attribute:: ip :type: str .. py:attribute:: port :type: int .. py:class:: DomainAddress Bases: :py:obj:`NamedTuple` A host-port combination for DNS servers. .. py:attribute:: host :type: str .. py:attribute:: port :type: int .. py:class:: UDPEndpoint(port: int = 0, ip: str = '0.0.0.0') Bases: :py:obj:`3.0.ipv8.messaging.interfaces.endpoint.Endpoint`, :py:obj:`asyncio.DatagramProtocol` Endpoint that binds UDP (over IPv4 by default). .. py:attribute:: SOCKET_FAMILY .. py:attribute:: _port .. py:attribute:: _ip .. py:attribute:: _running :value: False .. py:attribute:: _transport :type: asyncio.DatagramTransport | None :value: None .. py:attribute:: bytes_up :value: 0 .. py:attribute:: bytes_down :value: 0 .. py:method:: datagram_received(datagram: bytes, addr: tuple[str, int]) -> None Process incoming data. .. py:method:: send(socket_address: ipv8.types.Address, packet: bytes) -> None Send a packet to a given address. :param socket_address: Tuple of (IP, port) which indicates the destination of the packet. .. py:method:: log_error(message: str, level: int = logging.WARNING) -> None Log a message using our own logger instance. .. py:method:: open() -> bool :async: Open the Endpoint. :return: True is the Endpoint was successfully opened, False otherwise. .. py:method:: assert_open() -> None Check if we are opened by the programmer and if the underlying transport is fully open. .. py:method:: close() -> None Closes the Endpoint. .. py:method:: get_address() -> ipv8.types.Address Get the address for this Endpoint. .. py:method:: is_open() -> bool Check if the underlying socket is open. .. py:method:: reset_byte_counters() -> None Set bytes_up and bytes_down to 0. .. py:class:: UDPv6Endpoint(port: int = 0, ip: str = '::') Bases: :py:obj:`UDPEndpoint` UDPEndpoint subclass that binds to IPv6 instead of IPv4. .. py:attribute:: SOCKET_FAMILY .. py:method:: datagram_received(datagram: bytes, addr: tuple[str, int]) -> None Process incoming data.