class documentation

A Port that reads and writes packets from/to a TUN/TAP-device.

Method __init__ No summary
Method __repr__ Undocumented
Method connectionLost Cleans up my socket.
Method doRead Called when my socket is ready for reading.
Method fileno File Descriptor number for select().
Method getHost Get the local address of this TuntapPort.
Method logPrefix Returns the name of my class, to prefix log entries with.
Method loseConnection Close this tunnel. Use TuntapPort.stopListening instead.
Method startListening Create and bind my socket, and begin listening on it.
Method stopListening Stop accepting connections on this port.
Method write Write the given data as a single datagram.
Method writeSequence Write a datagram constructed from a list of bytes.
Class Variable maxThroughput Undocumented
Instance Variable connected Undocumented
Instance Variable ethernet Undocumented
Instance Variable interface Undocumented
Instance Variable logstr Undocumented
Instance Variable maxPacketSize Undocumented
Instance Variable protocol Undocumented
Method _bindSocket Open the tunnel.
Method _openTunnel Open the named tunnel using the given mode.
Instance Variable _fileno Undocumented
Instance Variable _mode Undocumented
Instance Variable _system Undocumented

Inherited from FileDescriptor:

Method doWrite Called when data can be written.
Method getPeer Get the remote address of this connection.
Method loseWriteConnection Undocumented
Method pauseProducing Pause producing data.
Method readConnectionLost Indicates read connection was lost.
Method resumeProducing Resume producing data.
Method startReading Start waiting for read availability.
Method startWriting Start waiting for write availability.
Method stopConsuming Stop consuming data.
Method stopProducing Stop producing data.
Method stopReading Stop waiting for read availability.
Method stopWriting Stop waiting for write availability.
Method writeConnectionLost Indicates write connection was lost.
Method writeSomeData Write as much as possible of the given data, immediately.
Constant SEND_LIMIT Undocumented
Class Variable bufferSize Undocumented
Class Variable disconnecting Undocumented
Instance Variable dataBuffer Undocumented
Instance Variable disconnected Undocumented
Instance Variable offset Undocumented
Instance Variable producer Undocumented
Instance Variable producerPaused Undocumented
Instance Variable reactor Undocumented
Method _closeWriteConnection Undocumented
Method _isSendBufferFull Determine whether the user-space send buffer for this transport is full or not.
Method _maybePauseProducer Possibly pause a producer, if there is one and the send buffer is full.
Method _postLoseConnection Called after a loseConnection(), when all data has been written.
Class Variable _writeDisconnected Undocumented
Instance Variable _tempDataBuffer Undocumented
Instance Variable _tempDataLen Undocumented
Instance Variable _writeDisconnecting Undocumented

Inherited from _ConsumerMixin (via FileDescriptor):

Method registerProducer Register to receive data from a producer.
Method unregisterProducer Stop consuming data from a producer, without disconnecting.
Instance Variable streamingProducer bool or int

Inherited from _LogOwner (via FileDescriptor, _ConsumerMixin):

Method _getLogPrefix Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider.
def __init__(self, interface, proto, maxPacketSize=8192, reactor=None, system=None): (source)
Parameters
interfaceUndocumented
protoUndocumented
maxPacketSizeUndocumented
reactorAn IReactorFDSet provider which this descriptor will use to get readable and writeable event notifications. If no value is given, the global reactor will be used.
systemUndocumented
def __repr__(self) -> str: (source)

Undocumented

def connectionLost(self, reason=None): (source)

Cleans up my socket.

Parameters
reasonIgnored. Do not use this.
def doRead(self): (source)

Called when my socket is ready for reading.

def fileno(self): (source)

File Descriptor number for select().

This method must be overridden or assigned in subclasses to indicate a valid file descriptor for the operating system.

def getHost(self): (source)

Get the local address of this TuntapPort.

Returns
TunnelAddressA TunnelAddress which describes the tunnel device to which this object is bound.
def logPrefix(self): (source)

Returns the name of my class, to prefix log entries with.

def loseConnection(self): (source)

Deprecated since version 14.0.0: loseConnection was deprecated in Twisted 14.0.0; please use twisted.pair.tuntap.TuntapPort.stopListening instead.

Close this tunnel. Use TuntapPort.stopListening instead.

def startListening(self): (source)

Create and bind my socket, and begin listening on it.

This must be called after creating a server to begin listening on the specified tunnel.

def stopListening(self): (source)

Stop accepting connections on this port.

This will shut down my socket and call self.connectionLost().

Returns
A Deferred that fires when this port has stopped.
def write(self, datagram): (source)

Write the given data as a single datagram.

Parameters
datagram:bytesThe data that will make up the complete datagram to be written.
def writeSequence(self, seq): (source)

Write a datagram constructed from a list of bytes.

Parameters
seq:list of bytesThe data that will make up the complete datagram to be written.
maxThroughput = (source)

Undocumented

ethernet: int = (source)

Undocumented

interface = (source)

Undocumented

Undocumented

maxPacketSize = (source)

Undocumented

protocol = (source)

Undocumented

def _bindSocket(self): (source)

Open the tunnel.

def _openTunnel(self, name, mode): (source)

Open the named tunnel using the given mode.

Parameters
name:bytesThe name of the tunnel to open.
modeFlags from TunnelFlags with exactly one of TunnelFlags.IFF_TUN or TunnelFlags.IFF_TAP set.
Returns
A _TunnelDescription representing the newly opened tunnel.

Undocumented

Undocumented

Undocumented