A helper for tests of tun-related functionality (ip-level tunnels).

Method TUNNEL_TYPE Undocumented
Method __init__
Method encapsulate Construct an ip datagram containing a udp datagram containing the given application-level payload.
Method parser Get a function for parsing a datagram read from a tun device.
@property
def TUNNEL_TYPE(self):
Undocumented
def __init__(self, tunnelRemote, tunnelLocal):
ParameterstunnelRemoteThe source address for UDP datagrams originated from this helper. This is an IPv4 dotted-quad string. (type: bytes)
tunnelLocalThe destination address for UDP datagrams originated from this helper. This is an IPv4 dotted-quad string. (type: bytes)
def encapsulate(self, source, destination, payload):

Construct an ip datagram containing a udp datagram containing the given application-level payload.

ParameterssourceThe source port for the UDP datagram being encapsulated. (type: int)
destinationThe destination port for the UDP datagram being encapsulated. (type: int)
payloadThe application data to include in the udp datagram. (type: bytes)
ReturnsAn ethernet frame. (type: bytes)
def parser(self):

Get a function for parsing a datagram read from a tun device.

ReturnsA function which accepts a datagram exactly as might be read from a tun device. The datagram is expected to ultimately carry a UDP datagram. When called, it returns a list of tuples. Each tuple has the UDP application data as the first element and the sender address as the second element.
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.