module documentation

Test cases for twisted.protocols.haproxy.V2Parser.

Class V2ParserTests Test twisted.protocols.haproxy.V2Parser behaviour.
Constant V2_SIGNATURE Undocumented
Function _makeHeaderIPv4 Construct a version 2 IPv4 header with custom bytes.
Function _makeHeaderIPv6 Construct a version 2 IPv6 header with custom bytes.
Function _makeHeaderUnix Construct a version 2 IPv4 header with custom bytes.
V2_SIGNATURE: bytes = (source)

Undocumented

Value
b'''\r
\r
\x00\r
QUIT
'''
def _makeHeaderIPv4(sig=V2_SIGNATURE, verCom=b'!', famProto=b'\x11', addrLength=b'\x00\x0c', addrs=b'\x7f\x00\x00\x01\x7f\x00\x00\x01', ports=b'\x1f\x90"\xb8'): (source)

Construct a version 2 IPv4 header with custom bytes.

Parameters
sig:bytesThe protocol signature; defaults to valid V2_SIGNATURE.
verCom:bytesProtocol version and command. Defaults to V2 PROXY.
famProto:bytesAddress family and protocol. Defaults to AF_INET/STREAM.
addrLength:bytesNetwork-endian byte length of payload. Defaults to description of default addrs/ports.
addrs:bytesAddress payload. Defaults to 127.0.0.1 for source and destination.
ports:bytesSource and destination ports. Defaults to 8080 for source 8888 for destination.
Returns
bytesA packet with header, addresses, and ports.
def _makeHeaderIPv6(sig=V2_SIGNATURE, verCom=b'!', famProto=b'!', addrLength=b'\x00$', addrs=(b'\x00'*15+b'\x01')*2, ports=b'\x1f\x90"\xb8'): (source)

Construct a version 2 IPv6 header with custom bytes.

Parameters
sig:bytesThe protocol signature; defaults to valid V2_SIGNATURE.
verCom:bytesProtocol version and command. Defaults to V2 PROXY.
famProto:bytesAddress family and protocol. Defaults to AF_INET6/STREAM.
addrLength:bytesNetwork-endian byte length of payload. Defaults to description of default addrs/ports.
addrs:bytesAddress payload. Defaults to ::1 for source and destination.
ports:bytesSource and destination ports. Defaults to 8080 for source 8888 for destination.
Returns
bytesA packet with header, addresses, and ports.
def _makeHeaderUnix(sig=V2_SIGNATURE, verCom=b'!', famProto=b'1', addrLength=b'\x00\xd8', addrs=(b'/home/tests/mysockets/sock'+b'\x00'*82)*2): (source)

Construct a version 2 IPv4 header with custom bytes.

Parameters
sig:bytesThe protocol signature; defaults to valid V2_SIGNATURE.
verCom:bytesProtocol version and command. Defaults to V2 PROXY.
famProto:bytesAddress family and protocol. Defaults to AF_UNIX/STREAM.
addrLength:bytesNetwork-endian byte length of payload. Defaults to 108 bytes for 2 null terminated paths.
addrs:bytesAddress payload. Defaults to /home/tests/mysockets/sock for source and destination paths.
Returns
bytesA packet with header, addresses, and8 ports.