+
    Dfj‹  ã                   ó˜   € R t ^ RIHtHt ^ RIHt ^ RIHt ^RIH	t	H
t
 ^RIHtHtHtHt ]! ]
P                   4       ! R R4      4       tR# )	zD
IProxyParser implementation for version one of the PROXY protocol.
)ÚTupleÚUnion)Úimplementer)Úaddress)Ú_infoÚ_interfaces)ÚInvalidNetworkProtocolÚInvalidProxyHeaderÚMissingAddressDataÚconvertErrorc                   ó‚   a € ] tR t^t o RtRtRtRtRt]]]3t	Rt
V 3R lR ltV 3R	 lR
 lt]V 3R lR l4       tRtV tR# )ÚV1Parserzá
PROXY protocol version one header parser.

Version one of the PROXY protocol is a human readable format represented
by a single, newline delimited binary string that contains all of the
relevant source and destination data.
s   PROXYs   UNKNOWNs   TCP4s   TCP6s   
c                ó   <€ V ^8„  d   QhRR/# )é   ÚreturnN© )ÚformatÚ__classdict__s   "€ÚE/usr/lib/python3/dist-packages/twisted/protocols/haproxy/_v1parser.pyÚ__annotate__ÚV1Parser.__annotate__,   s   ø€ ÷ ñ ˜$ñ ó    c                ó   € R V n         R# )r   N©Úbuffer)Úselfs   &r   Ú__init__ÚV1Parser.__init__,   s	   € ØˆŽr   c                ót   <€ V ^8„  d   QhRS[ RS[S[S[P                  S[ 3,          S[R,          3,          /# )r   Údatar   ©NN)Úbytesr   r   r   Ú	ProxyInfo)r   r   s   "€r   r   r   /   s:   ø€ ÷ !ñ !Ùð!á	‰u‘U—_‘_¡eÐ+Õ,©e°JÕ.?Ð?Õ	@ñ!r   c                ó˜  € V ;P                   V,          un         \        V P                   4      ^k8”  d&   V P                  V P                   9  d   \        4       hV P                   P	                  V P                  ^4      p\        V4      ^8”  g   R# RV n         VP                  4       pVP                  4       pV P                  V4      pWS3# )až  
Consume a chunk of data and attempt to parse it.

@param data: A bytestring.
@type data: L{bytes}

@return: A two-tuple containing, in order, a
    L{_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.
r   r    )r   ÚlenÚNEWLINEr	   ÚsplitÚpopÚparse)r   r   ÚlinesÚ	remainingÚheaderÚinfos   &&    r   ÚfeedÚV1Parser.feed/   sš   € ð" 	ŠtÕÜˆt{‰{Ó˜cÔ! d§l¡l¸$¿+¹+Ô&EÜ$Ó&Ð&Ø—‘×#Ñ# D§L¡L°!Ó4ˆÜ5‹z˜AŒ~ØÐØˆŒØ—I‘I“Kˆ	Ø—‘“ˆØz‰z˜&Ó!ˆØÐ Ð r   c                ó:   <€ V ^8„  d   QhRS[ RS[P                  /# )r   Úliner   )r!   r   r"   )r   r   s   "€r   r   r   M   s#   ø€ ÷ A
ñ A
™ð A
¡5§?¡?ñ A
r   c                ób  € TpRpRpRpRpRpRp\        \        \        4      ;_uu_ 4        VP                  R^4      w  r1RRR4       W0P                  8w  d   \        4       h\        \        \
        4      ;_uu_ 4        VP                  R^4      w  rARRR4       W@P                  9  d   \        4       hW@P                  8X  d   \        P                  ! VRR4      # \        \        \        4      ;_uu_ 4        VP                  R^4      w  rQRRR4       \        \        \        4      ;_uu_ 4        VP                  R^4      w  rqRRR4       \        \        \        4      ;_uu_ 4        VP                  R^4      w  raRRR4       \        \        \        4      ;_uu_ 4        VP                  R4      ^ ,          pRRR4       W@P                  8X  ds   \        P                  ! V\        P                  ! RVP                  4       \        V4      4      \        P                  ! RVP                  4       \        V4      4      4      # \        P                  ! V\        P                   ! RVP                  4       \        V4      4      \        P                   ! RVP                  4       \        V4      4      4      #   + '       g   i     EL‚; i  + '       g   i     ELC; i  + '       g   i     ELÜ; i  + '       g   i     EL·; i  + '       g   i     EL’; i  + '       g   i     ELi; i)a0  
Parse a bytestring as a full PROXY protocol header line.

@param line: A bytestring that represents a valid HAProxy PROXY
    protocol header line.
@type line: bytes

@return: A L{_interfaces.IProxyInfo} containing the parsed data.

@raises InvalidProxyHeader: If the bytestring does not represent a
    valid PROXY header.

@raises InvalidNetworkProtocol: When no protocol can be parsed or is
    not one of the allowed values.

@raises MissingAddressData: When the protocol is TCP* but the header
    does not contain a complete set of addresses and ports.
Nó    ÚTCP)r   Ú
ValueErrorr	   r&   ÚPROXYSTRr   ÚALLOWED_NET_PROTOSÚUNKNOWN_PROTOr   r"   r
   Ú
TCP4_PROTOr   ÚIPv4AddressÚdecodeÚintÚIPv6Address)	Úclsr0   ÚoriginalLineÚproxyStrÚnetworkProtocolÚ
sourceAddrÚ
sourcePortÚdestAddrÚdestPorts	   &&       r   r(   ÚV1Parser.parseL   sQ  € ð( ˆØˆØˆØˆ
Øˆ
ØˆØˆäœ*Ô&8×9Õ9Ø!ŸZ™Z¨¨aÓ0‰NˆH÷ :ð —|‘|Ô#Ü$Ó&Ð&äœ*Ô&<×=Õ=Ø$(§J¡J¨t°QÓ$7Ñ!ˆO÷ >ð ×"8Ñ"8Ô8Ü(Ó*Ð*à×/Ñ/Ô/Ü—?’? <°°tÓ<Ð<äœ*Ô&8×9Õ9Ø#Ÿz™z¨$°Ó2ÑˆJ÷ :ô œ*Ô&8×9Õ9Ø!ŸZ™Z¨¨aÓ0‰NˆH÷ :ô œ*Ô&8×9Õ9Ø#Ÿz™z¨$°Ó2ÑˆJ÷ :ô œ*Ô&8×9Õ9Ø—z‘z $Ó'¨Õ*ˆH÷ :ð Ÿn™nÔ,Ü—?’?ØÜ×#Ò# E¨:×+<Ñ+<Ó+>ÄÀJÃÓPÜ×#Ò# E¨8¯?©?Ó+<¼cÀ(»mÓLóð ô ŠØÜ×Ò  z×'8Ñ'8Ó':¼CÀ
»OÓLÜ×Ò  x§¡Ó'8¼#¸h»-ÓHó
ð 	
÷E :×9Ð9ú÷ >×=Ð=ú÷ :×9Ð9ú÷ :×9Ð9ú÷ :×9Ð9ú÷ :×9Ð9úsG   «J9Á>KÃ9K!Ä2K5Å+L	Æ$LÊ9K
	ËK	Ë!K2	Ë5L	Ì	L	ÌL.	r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r5   r7   r8   Ú
TCP6_PROTOr6   r%   r   r-   Úclassmethodr(   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sb   ø‡ € ñð €HØ€MØ€JØ€JàØØðÐð
 €G÷ð ÷!ð !ð: ÷A
ó öA
r   r   N)rJ   Útypingr   r   Úzope.interfacer   Útwisted.internetr   Ú r   r   Ú_exceptionsr   r	   r
   r   ÚIProxyParserr   r   r   r   Ú<module>rU      sI   ðñ÷  å &å $ß  ÷ó ñ ˆ[×%Ñ%Ó&÷v
ð v
ó 'òv
r   