class documentation

class V1Parser: (source)

Implements interfaces: twisted.protocols.haproxy._interfaces.IProxyParser

View In Hierarchy

PROXY protocol version one header parser.

Version one of the PROXY protocol is a human readable format represented by a single, newline delimited binary string that contains all of the relevant source and destination data.

Class Variable PROXYSTR Undocumented
Class Variable UNKNOWN_PROTO Undocumented
Class Variable TCP4_PROTO Undocumented
Class Variable TCP6_PROTO Undocumented
Class Variable ALLOWED_NET_PROTOS Undocumented
Class Variable NEWLINE Undocumented
Method __init__ Undocumented
Instance Variable buffer Undocumented
Method feed Consume a chunk of data and attempt to parse it.
Class Method parse Parse a bytestring as a full PROXY protocol header line.
PROXYSTR = (source)

Undocumented

(type: bytes)
UNKNOWN_PROTO = (source)

Undocumented

(type: bytes)
TCP4_PROTO = (source)

Undocumented

(type: bytes)
TCP6_PROTO = (source)

Undocumented

(type: bytes)
ALLOWED_NET_PROTOS = (source)

Undocumented

NEWLINE = (source)

Undocumented

(type: bytes)
def __init__(self): (source)

Undocumented

buffer = (source)

Undocumented

(type: bytes)
def feed(self, data): (source)

Consume a chunk of data and attempt to parse it.

ParametersdataA bytestring. (type: bytes)
ReturnsA two-tuple containing, in order, a _interfaces.IProxyInfo and any bytes fed to the parser that followed the end of the header. Both of these values are None until a complete header is parsed.
RaisesInvalidProxyHeaderIf the bytes fed to the parser create an invalid PROXY header.
@classmethod
def parse(cls, line): (source)

Parse a bytestring as a full PROXY protocol header line.

ParameterslineA bytestring that represents a valid HAProxy PROXY protocol header line. (type: bytes)
ReturnsA _interfaces.IProxyInfo containing the parsed data.
RaisesInvalidProxyHeaderIf the bytestring does not represent a valid PROXY header.
InvalidNetworkProtocolWhen no protocol can be parsed or is not one of the allowed values.
MissingAddressDataWhen the protocol is TCP* but the header does not contain a complete set of addresses and ports.
API Documentation for Twisted, generated by pydoctor 21.2.0 at 2021-02-28 21:00:42.