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 Method parse Parse a bytestring as a full PROXY protocol header line.
Method __init__ Undocumented
Method feed Consume a chunk of data and attempt to parse it.
Class Variable ALLOWED_NET_PROTOS Undocumented
Class Variable NEWLINE Undocumented
Class Variable PROXYSTR Undocumented
Class Variable TCP4_PROTO Undocumented
Class Variable TCP6_PROTO Undocumented
Class Variable UNKNOWN_PROTO Undocumented
Instance Variable buffer Undocumented
@classmethod
def parse(cls, line): (source)
Parse a bytestring as a full PROXY protocol header line.
Parameters
line:bytesA bytestring that represents a valid HAProxy PROXY protocol header line.
Returns
_info.ProxyInfoA _interfaces.IProxyInfo containing the parsed data.
Raises
InvalidProxyHeaderIf 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.
def __init__(self): (source)

Undocumented

def feed(self, data): (source)
Consume a chunk of data and attempt to parse it.
Parameters
data:bytesA bytestring.
Returns
Union[Tuple[_info.ProxyInfo, bytes], Tuple[None, None]]A 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.
Raises
InvalidProxyHeaderIf the bytes fed to the parser create an invalid PROXY header.
ALLOWED_NET_PROTOS = (source)

Undocumented

NEWLINE: bytes = (source)

Undocumented

PROXYSTR: bytes = (source)

Undocumented

TCP4_PROTO: bytes = (source)

Undocumented

TCP6_PROTO: bytes = (source)

Undocumented

UNKNOWN_PROTO: bytes = (source)

Undocumented

buffer: bytes = (source)

Undocumented