| Server IP : 138.197.162.186 / Your IP : 216.73.216.184 Web Server : nginx/1.24.0 System : Linux ubuntu-s-1vcpu-512mb-10gb-tor1 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/twisted/protocols/haproxy/test/__pycache__/ |
Upload File : |
�
Ϫ�f�. � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ e ddd d
dfde
d
e
de
de
de
de
de
fd�Ze dddddfde
d
e
de
de
de
de
de
fd�Ze ddddfde
d
e
de
de
de
de
fd�Z
G d� dej � Zy)z7
Test cases for L{twisted.protocols.haproxy.V2Parser}.
� )�address)�unittest� )� _v2parser)�InvalidProxyHeaders
QUIT
� !s $s s �"��sig�verCom�famProto�
addrLength�addrs�ports�returnc �$ � | |z |z |z |z |z 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 s �N/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_v2parser.py�_makeHeaderIPv6r �# � �F ��<�(�"�Z�/�%�7�%�?�?� � s s c �$ � | |z |z |z |z |z S )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 s r �_makeHeaderIPv4r 6 r r � 1s �s� /home/tests/mysockets/sock /home/tests/mysockets/sock c � � | |z |z |z |z 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
s r �_makeHeaderUnixr \ s � �F ��<�(�"�Z�/�%�7�7r c �� � e Zd ZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd �Z
dd
�Zdd�Zdd�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�
V2ParserTestsz?
Test L{twisted.protocols.haproxy.V2Parser} behaviour.
Nc �t � t � }| j t j j |� � y)zL
Test if a well formed IPv4 header is parsed without error.
N)r �
assertTruer �V2Parser�parse��self�headers r �test_happyPathIPv4z V2ParserTests.test_happyPathIPv4� �) � � !�"����� �*�*�0�0��8�9r c �t � t � }| j t j j |� � y)zL
Test if a well formed IPv6 header is parsed without error.
N)r r r r! r"