PHP WebShell
Текущая директория: /usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/__pycache__
Просмотр файла: test_v2parser.cpython-310.pyc
o
�b�. � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ e ddd d
dfde
d
e
de
de
de
de
de
fdd�Ze dddddfde
d
e
de
de
de
de
de
fdd�Ze ddddfde
d
e
de
de
de
de
fdd�Z
G dd � d ej�Zd!S )"z7
Test cases for L{twisted.protocols.haproxy.V2Parser}.
� )�address)�unittest� )� _v2parser)�InvalidProxyHeaders
QUIT
� !s $s s �"��sig�verCom�famProto�
addrLength�addrs�ports�returnc C � | | | | | | S )aV
Construct a version 2 IPv6 header with custom bytes.
@param sig: The protocol signature; defaults to valid L{V2_SIGNATURE}.
@type sig: L{bytes}
@param verCom: Protocol version and command. Defaults to V2 PROXY.
@type verCom: L{bytes}
@param famProto: Address family and protocol. Defaults to AF_INET6/STREAM.
@type famProto: L{bytes}
@param addrLength: Network-endian byte length of payload. Defaults to
description of default addrs/ports.
@type addrLength: L{bytes}
@param addrs: Address payload. Defaults to C{::1} for source and
destination.
@type addrs: L{bytes}
@param ports: Source and destination ports. Defaults to 8080 for source
8888 for destination.
@type ports: L{bytes}
@return: A packet with header, addresses, and ports.
@rtype: L{bytes}
� �r r r
r r r
r r �N/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_v2parser.py�_makeHeaderIPv6 � #r � s s c C r )aX
Construct a version 2 IPv4 header with custom bytes.
@param sig: The protocol signature; defaults to valid L{V2_SIGNATURE}.
@type sig: L{bytes}
@param verCom: Protocol version and command. Defaults to V2 PROXY.
@type verCom: L{bytes}
@param famProto: Address family and protocol. Defaults to AF_INET/STREAM.
@type famProto: L{bytes}
@param addrLength: Network-endian byte length of payload. Defaults to
description of default addrs/ports.
@type addrLength: L{bytes}
@param addrs: Address payload. Defaults to 127.0.0.1 for source and
destination.
@type addrs: L{bytes}
@param ports: Source and destination ports. Defaults to 8080 for source
8888 for destination.
@type ports: L{bytes}
@return: A packet with header, addresses, and ports.
@rtype: L{bytes}
r r r r r �_makeHeaderIPv46 r r � 1s �s� /home/tests/mysockets/sock /home/tests/mysockets/sock c C s | | | | | S )a�
Construct a version 2 IPv4 header with custom bytes.
@param sig: The protocol signature; defaults to valid L{V2_SIGNATURE}.
@type sig: L{bytes}
@param verCom: Protocol version and command. Defaults to V2 PROXY.
@type verCom: L{bytes}
@param famProto: Address family and protocol. Defaults to AF_UNIX/STREAM.
@type famProto: L{bytes}
@param addrLength: Network-endian byte length of payload. Defaults to 108
bytes for 2 null terminated paths.
@type addrLength: L{bytes}
@param addrs: Address payload. Defaults to C{/home/tests/mysockets/sock}
for source and destination paths.
@type addrs: L{bytes}
@return: A packet with header, addresses, and8 ports.
@rtype: L{bytes}
r )r r r
r r r r r �_makeHeaderUnix\ s #r c @ s e Zd ZdZd4dd�Zd4dd�Zd4dd �Zd4d
d�Zd4dd
�Zd4dd�Z d4dd�Z
d4dd�Zd4dd�Zd4dd�Z
d4dd�Zd4dd�Zd4dd�Zd4dd�Zd4d d!�Zd4d"d#�Zd4d$d%�Zd4d&d'�Zd4d(d)�Zd4d*d+�Zd4d,d-�Zd4d.d/�Zd4d0d1�Zd4d2d3�ZdS )5�
V2ParserTestsz?
Test L{twisted.protocols.haproxy.V2Parser} behaviour.
r Nc C � t � }| �tj�|�� dS )zL
Test if a well formed IPv4 header is parsed without error.
N)r �
assertTruer �V2Parser�parse��self�headerr r r �test_happyPathIPv4� � z V2ParserTests.test_happyPathIPv4c C r )zL
Test if a well formed IPv6 header is parsed without error.
N)r r r r r r r r r �test_happyPathIPv6� r"