twisted.protocols.haproxy._v2parser.V2Parser(object)
class documentationtwisted.protocols.haproxy._v2parser
View Source
(View In Hierarchy)
Implements interfaces: ._interfaces.IProxyParser
PROXY protocol version two header parser.
Version two of the PROXY protocol is a binary format.
Method | __init__ | 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. |
Static Method | _bytesToIPv4 | Convert packed 32-bit IPv4 address bytes into a dotted-quad ASCII bytes representation of that address. |
Static Method | _bytesToIPv6 | Convert packed 128-bit IPv6 address bytes into a colon-separated ASCII bytes representation of that address. |
Consume a chunk of data and attempt to parse it.
Parameters | data | A bytestring. (type: bytes) |
Returns | 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 | InvalidProxyHeader | If the bytes fed to the parser create an invalid PROXY header. |
Parse a bytestring as a full PROXY protocol header.
Parameters | line | A bytestring that represents a valid HAProxy PROXY protocol version 2 header. (type: bytes) |
Returns | A _interfaces.IProxyInfo
containing the parsed data. | |
Raises | InvalidProxyHeader | If the bytestring does not represent a valid PROXY header. |