Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`protocols`.`haproxy`.`_v2parser`.`V2Parser``

class documentation

`class V2Parser: (source)`

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

View In Hierarchy

PROXY protocol version two header parser.

Version two of the PROXY protocol is a binary format.

Class Method | `parse` | Parse a bytestring as a full PROXY protocol header.
Method | `__init__` | Undocumented
Method | `feed` | Consume a chunk of data and attempt to parse it.
Constant | `ADDRESSFORMATS` | Undocumented
Constant | `COMMANDS` | Undocumented
Constant | `PREFIX` | Undocumented
Constant | `VERSIONS` | Undocumented
Instance Variable | `buffer` | Undocumented
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.

@classmethod
def parse(cls, line: `bytes`) -> `_info.ProxyInfo`: (source)
from `twisted.protocols.haproxy._interfaces.IProxyParser`

Parse a bytestring as a full PROXY protocol header.

Parameters
line:bytes | A bytestring that represents a valid HAProxy PROXY protocol version 2 header.
Returns
`_info.ProxyInfo` | A `_interfaces.IProxyInfo` containing the parsed data.
Raises
`InvalidProxyHeader` | If the bytestring does not represent a valid PROXY header.

def __init__(self): (source)

Undocumented

def feed(self, data: `bytes`) -> `Union[Tuple[_info.ProxyInfo, bytes], Tuple[None, None]]`: (source)
from `twisted.protocols.haproxy._interfaces.IProxyParser`

Consume a chunk of data and attempt to parse it.

Parameters
data:bytes | A 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
`InvalidProxyHeader` | If the bytes fed to the parser create an invalid PROXY header.

ADDRESSFORMATS: `dict[int, str]` = (source)

Undocumented

Value

    {17: '!4s4s2H',
     18: '!4s4s2H',
     33: '!16s16s2H',
     34: '!16s16s2H',
     49: '!108s108s',
     50: '!108s108s'}

COMMANDS = (source)

Undocumented

Value

    {0: _LOCALCOMMAND, 1: _PROXYCOMMAND}

PREFIX: `bytes` = (source)

Undocumented

Value

    b'''\r
    \r
    \x00\r
    QUIT
    '''

VERSIONS: `list[int]` = (source)

Undocumented

Value

    [32]

buffer: `bytes` = (source)

Undocumented

@staticmethod
def _bytesToIPv4(bytestring: `bytes`) -> `bytes`: (source)

Convert packed 32-bit IPv4 address bytes into a dotted-quad ASCII bytes representation of that address.

Parameters
bytestring:`bytes` | 4 octets representing an IPv4 address.
Returns
`bytes` | a dotted-quad notation IPv4 address.

@staticmethod
def _bytesToIPv6(bytestring: `bytes`) -> `bytes`: (source)

Convert packed 128-bit IPv6 address bytes into a colon-separated ASCII bytes representation of that address.

Parameters
bytestring:`bytes` | 16 octets representing an IPv6 address.
Returns
`bytes` | a dotted-quad notation IPv6 address.