module documentation
Test cases for twisted.protocols.haproxy.V2Parser
.
Class |
|
Test twisted.protocols.haproxy.V2Parser behaviour. |
Constant | V2 |
Undocumented |
Function | _make |
Construct a version 2 IPv4 header with custom bytes. |
Function | _make |
Construct a version 2 IPv6 header with custom bytes. |
Function | _make |
Construct a version 2 IPv4 header with custom bytes. |
def _makeHeaderIPv4(sig:
bytes
= V2_SIGNATURE, verCom: bytes
= b'!', famProto: bytes
= b'\x11', addrLength: bytes
= b'\x00\x0c', addrs: bytes
= b'\x7f\x00\x00\x01\x7f\x00\x00\x01', ports: bytes
= b'\x1f\x90"\xb8') -> bytes
:
¶
Construct a version 2 IPv4 header with custom bytes.
Parameters | |
sig:bytes | The protocol signature; defaults to valid V2_SIGNATURE . |
verbytes | Protocol version and command. Defaults to V2 PROXY. |
fambytes | Address family and protocol. Defaults to AF_INET/STREAM. |
addrbytes | Network-endian byte length of payload. Defaults to description of default addrs/ports. |
addrs:bytes | Address payload. Defaults to 127.0.0.1 for source and destination. |
ports:bytes | Source and destination ports. Defaults to 8080 for source 8888 for destination. |
Returns | |
bytes | A packet with header, addresses, and ports. |
def _makeHeaderIPv6(sig:
bytes
= V2_SIGNATURE, verCom: bytes
= b'!', famProto: bytes
= b'!', addrLength: bytes
= b'\x00$', addrs: bytes
= (b'\x00' * 15 + b'\x01') * 2, ports: bytes
= b'\x1f\x90"\xb8') -> bytes
:
¶
Construct a version 2 IPv6 header with custom bytes.
Parameters | |
sig:bytes | The protocol signature; defaults to valid V2_SIGNATURE . |
verbytes | Protocol version and command. Defaults to V2 PROXY. |
fambytes | Address family and protocol. Defaults to AF_INET6/STREAM. |
addrbytes | Network-endian byte length of payload. Defaults to description of default addrs/ports. |
addrs:bytes | Address payload. Defaults to ::1 for source and destination. |
ports:bytes | Source and destination ports. Defaults to 8080 for source 8888 for destination. |
Returns | |
bytes | A packet with header, addresses, and ports. |
def _makeHeaderUnix(sig:
bytes
= V2_SIGNATURE, verCom: bytes
= b'!', famProto: bytes
= b'1', addrLength: bytes
= b'\x00\xd8', addrs: bytes
= (b'/home/tests/mysockets/sock' + b'\x00' * 82) * 2) -> bytes
:
¶
Construct a version 2 IPv4 header with custom bytes.
Parameters | |
sig:bytes | The protocol signature; defaults to valid V2_SIGNATURE . |
verbytes | Protocol version and command. Defaults to V2 PROXY. |
fambytes | Address family and protocol. Defaults to AF_UNIX/STREAM. |
addrbytes | Network-endian byte length of payload. Defaults to 108 bytes for 2 null terminated paths. |
addrs:bytes | Address payload. Defaults to /home/tests/mysockets/sock for source and destination paths. |
Returns | |
bytes | A packet with header, addresses, and8 ports. |