+
    0j+/                        ^ RI t ^ RIt^RIHt ^RIHt ^RIHt ^RIH	t	H
t
HtHt  ! R R]] P                  4      t ! R R	]] P                  4      t ! R
 R]] P                  4      t ! R R]] P                  4      t ! R R]P&                  4      t ! R R]P&                  4      t ! R R]P&                  4      t ! R R]P&                  4      t ! R R]P&                  4      t ! R R]P&                  4      t ! R R]P&                  4      t ! R R] P6                  4      t]P:                  ]]3,          t ! R R4      tR# )     N)
StrOrBytes)singledispatchmethod)ProtocolError)AddressTypedecode_addressencode_address#get_address_port_tuple_from_addressc                   *    ] tR t^tRtRtRtRtRtRt	R# )SOCKS5AuthMethodz-Enumeration of SOCKS5 authentication methods.              N)
__name__
__module____qualname____firstlineno____doc__NO_AUTH_REQUIREDGSSAPIUSERNAME_PASSWORDNO_ACCEPTABLE_METHODS__static_attributes__r       c/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/socksio/socks5.pyr   r      s    7F#r   r   c                   &    ] tR t^tRtRtRtRtRtR# )SOCKS5CommandzEnumeration of SOCKS5 commands.r   r      r   N)	r   r   r   r   r   CONNECTBINDUDP_ASSOCIATEr   r   r   r   r   r      s    )GDMr   r   c                   L   a  ] tR t^ t o RtRtRtRt]V 3R lR l4       t	Rt
V tR# )	SOCKS5ATypez$Enumeration of SOCKS5 address types.r   r      c                $   < V ^8  d   QhRS[ RR/# )   atypereturnr$   )r   )format__classdict__s   "r   __annotate__SOCKS5AType.__annotate__(   s        {  }  r   c                    V\         P                  8X  d   \        P                  # V\         P                  8X  d   \        P
                  # V\         P                  8X  d   \        P                  # \        V4      hN)	r   IPV4r$   IPV4_ADDRESSDNDOMAIN_NAMEIPV6IPV6_ADDRESS
ValueError)clsr(   s   &&r   
from_atypeSOCKS5AType.from_atype'   sY    K$$$+++knn$***k&&&+++r   r   N)r   r   r   r   r   r1   r3   r5   classmethodr8   r   __classdictcell__r+   s   @r   r$   r$       s)     .LKL   r   r$   c                   >    ] tR t^2tRtRtRtRtRtRt	Rt
RtR	tR
tRtR# )SOCKS5ReplyCodez"Enumeration of SOCKS5 reply codes.r   r   r   r   r%               r   N)r   r   r   r   r   	SUCCEEDEDGENERAL_SERVER_FAILURE!CONNECTION_NOT_ALLOWED_BY_RULESETNETWORK_UNREACHABLEHOST_UNREACHABLECONNECTION_REFUSEDTTL_EXPIREDCOMMAND_NOT_SUPPORTEDADDRESS_TYPE_NOT_SUPPORTEDr   r   r   r   r>   r>   2   s9    ,I$(/%! K#!(r   r>   c                   B   a  ] tR t^@t o RtV 3R lR ltV 3R ltRtV tR# )SOCKS5AuthMethodsRequestzEncapsulates a request to the proxy for available authentication methods.

Args:
    methods: A list of acceptable authentication methods.
c                    < V ^8  d   QhRS[ /# r'   r)   bytes)r*   r+   s   "r   r,   %SOCKS5AuthMethodsRequest.__annotate__I   s     	
 	
u 	
r   c                    RP                  R\        V P                  4      P                  ^RR7      RP                  V P                  4      .4      # )z=Packs the instance into a raw binary in the appropriate form.r   r?   big	byteorder)joinlenmethodsto_bytesselfs   &r   dumpsSOCKS5AuthMethodsRequest.dumpsI   sI     xxDLL!**1*>&
 	
r   c                J   < V ^8  d   Qh/ S[ P                  S[,          ;R&   # )r'   rY   )typingListr   )r*   r+   s   "r   r,   rR   @   s      [[)** r   r   N	r   r   r   r   r   r]   __annotate_func__r   r;   r<   s   @r   rM   rM   @   s     	
 	
  r   rM   c                   L   a  ] tR t^Ut o Rt]V 3R lR l4       tV 3R ltRtV t	R# )SOCKS5AuthReplyzEncapsulates a reply from the proxy with the authentication method to be used.

Args:
    method: The authentication method to be used.

Raises:
    ProtocolError: If the data does not conform with the expected structure.
c                $   < V ^8  d   QhRS[ RR/# )r'   datar)   re   rP   )r*   r+   s   "r   r,   SOCKS5AuthReply.__annotate__b   s     < < <#4 <r   c                    \        V4      ^8w  d   \        R4      h V ! \        VR,          4      R7      #   \         d   p\        R4      ThRp?ii ; i)zUnpacks the authentication reply data into an instance.

Returns:
    The unpacked authentication reply instance.

Raises:
    ProtocolError: If the data does not match the spec.
Malformed reply   r'   N)methodN)rX   r   r   r6   )r7   rg   excs   && r   loadsSOCKS5AuthReply.loadsa   sS     t9> 122	<.tCy9:: 	< 12;	<s   6 AAAc                &   < V ^8  d   Qh/ S[ ;R&   # )r'   rm   )r   )r*   r+   s   "r   r,   rh   U   s       r   r   N
r   r   r   r   r   r:   ro   rc   r   r;   r<   s   @r   re   re   U   s%      < <  r   re   c                   B   a  ] tR t^tt o RtV 3R lR ltV 3R ltRtV tR# )SOCKS5UsernamePasswordRequestzLEncapsulates a username/password authentication request to the proxy server.c                    < V ^8  d   QhRS[ /# rO   rP   )r*   r+   s   "r   r,   *SOCKS5UsernamePasswordRequest.__annotate__z   s     
 
u 
r   c           
         RP                  R\        V P                  4      P                  ^RR7      V P                  \        V P                  4      P                  ^RR7      V P                  .4      # )`Packs the instance into a raw binary in the appropriate form.

Returns:
    The packed request.
r   r   rT   rU   )rW   rX   usernamerZ   passwordr[   s   &r   r]   #SOCKS5UsernamePasswordRequest.dumpsz   sc     xxDMM"++A+?DMM"++A+?
 	
r   c                2   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   # )r'   ry   rz   rP   )r*   r+   s   "r   r,   rv   t   s      O  O	 r   r   Nrb   r<   s   @r   rt   rt   t   s     V

 
  r   rt   c                   L   a  ] tR t^t o Rt]V 3R lR l4       tV 3R ltRtV t	R# )SOCKS5UsernamePasswordReplyzLEncapsulates a username/password authentication reply from the proxy server.c                $   < V ^8  d   QhRS[ RR/# )r'   rg   r)   r~   rP   )r*   r+   s   "r   r,   (SOCKS5UsernamePasswordReply.__annotate__   s     0 0 0#@ 0r   c                    V ! VR8H  R7      # )zrUnpacks the reply authentication data into an instance.

Returns:
    The unpacked authentication reply instance.
s    )successr   r7   rg   s   &&r   ro   !SOCKS5UsernamePasswordReply.loads   s     4;.//r   c                &   < V ^8  d   Qh/ S[ ;R&   # )r'   r   )bool)r*   r+   s   "r   r,   r      s      M r   r   Nrr   r<   s   @r   r~   r~      s#     V 0 0  r   r~   c                   z   a  ] tR t^t o Rt]V 3R lR l4       tV 3R lR lt]V 3R lR l4       t	V 3R lt
R	tV tR
# )SOCKS5CommandRequestzEncapsulates a command request to the proxy server.

Args:
    command: The command to request.
    atype: The address type of the addr field.
    addr: Address of the target host.
    port: The port number to connect to on the target host.
c                ~   < V ^8  d   QhRS[ RS[P                  S[S[P                  S[S[3,          3,          RR/# )r'   commandaddressr)   r   )r   r`   Unionr   Tupleint)r*   r+   s   "r   r,   !SOCKS5CommandRequest.__annotate__   sD     
 

 j&,,z3*GGH
 
 	
r   c                t    \        V4      w  r#\        V4      w  rEV ! V\        P                  V4      VVR7      # )au  Convenience class method to build an instance from command and address.

Args:
    command: The command to request.
    address: A string in the form 'HOST:PORT' or a tuple of ip address string
        and port number. The address type will be inferred.

Returns:
    A SOCKS5CommandRequest instance.

Raises:
    SOCKSError: If a domain name or IPv6 address was supplied.
)r   r(   addrport)r	   r   r$   r8   )r7   r   r   r   r(   encoded_addrs   &&&   r   from_address!SOCKS5CommandRequest.from_address   sA    & <GD,W5((/	
 	
r   c                    < V ^8  d   QhRS[ /# rO   rP   )r*   r+   s   "r   r,   r      s     
 
u 
r   c                    RP                  RV P                  RV P                  V P                  V P                  P                  ^RR7      .4      # )rx   r   r?   r   rT   rU   )rW   r   r(   packed_addrr   rZ   r[   s   &r   r]   SOCKS5CommandRequest.dumps   sN     xx

  $$Q%$8	
 		
r   c                    < V ^8  d   QhRS[ /# rO   rP   )r*   r+   s   "r   r,   r      s     
C 
CU 
Cr   c                   V P                   \        P                  8X  d)   \        V P                  4      ^8X  g   Q hV P                  # V P                   \        P
                  8X  d)   \        V P                  4      ^8X  g   Q hV P                  # \        V P                  4      pVP                  ^RR7      V P                  ,           # )zGProperty returning the packed address in the correct form for its type.rT   rU   )r(   r$   r1   rX   r   r5   rZ   )r\   lengths   & r   r    SOCKS5CommandRequest.packed_addr   s     ::111tyy>Q&&&99ZZ;333tyy>R'''99^F??1?6BBr   c                J   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   # )r'   r   r(   r   r   )r   r$   rQ   r   )r*   r+   s   "r   r,   r      s7          K  I r   r   N)r   r   r   r   r   r:   r   r]   propertyr   rc   r   r;   r<   s   @r   r   r      sF      
 
6
 
" 
C 
C{  r   r   c                   L   a  ] tR t^t o Rt]V 3R lR l4       tV 3R ltRtV t	R# )SOCKS5ReplyzEncapsulates a reply from the SOCKS5 proxy server

Args:
    reply_code: The code representing the type of reply.
    atype: The address type of the addr field.
    addr: Optional IP address returned.
    port: The port number returned.
c                $   < V ^8  d   QhRS[ RR/# )r'   rg   r)   r   rP   )r*   r+   s   "r   r,   SOCKS5Reply.__annotate__   s     < < <= <r   c           
     B   VR,          R8w  d   \        R4      h \        VR,          4      pV ! \        VR,          4      V\        \        P
                  ! V4      V^R
 4      \        P                  VR
R RR7      R	7      #   \         d   p\        R4      ThRp?ii ; i)zUnpacks the reply data into an instance.

Returns:
    The unpacked reply instance.

Raises:
    ProtocolError: If the data does not match the spec.
:r   rl   Nr?   rj   :      Nrk   NrT   rU   )
reply_coder(   r   r   )	r   r$   r>   r   r   from_socks5_atyper   
from_bytesr6   )r7   rg   r(   rn   s   &&  r   ro   SOCKS5Reply.loads   s     9 122
	<S	*E*495#K$A$A%$H$qQS*U^^DI^?	   	< 12;	<s   A&B BBBc                J   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   # )r'   r   r(   r   r   )r>   r$   strr   )r*   r+   s   "r   r,   r      s7           I  I r   r   Nrr   r<   s   @r   r   r      s%      < <!  r   r   c                   ^   a  ] tR tRt o Rt]V 3R lR l4       tV 3R lR ltV 3R ltRt	V t
R	# )
SOCKS5Datagrami  zPEncapsulates a SOCKS5 datagram for UDP connections.

Currently not implemented.
c                $   < V ^8  d   QhRS[ RR/# )r'   rg   r)   r   rP   )r*   r+   s   "r   r,   SOCKS5Datagram.__annotate__  s     $ $ $#3 $r   c                    \        4       hr/   NotImplementedErrorr   s   &&r   ro   SOCKS5Datagram.loads  s    !##r   c                    < V ^8  d   QhRS[ /# rO   rP   )r*   r+   s   "r   r,   r     s     $ $u $r   c                    \        4       hr/   r   r[   s   &r   r]   SOCKS5Datagram.dumps  s    !##r   c                b   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[;R&   # )r'   r(   r   r   rg   fragmentlast_fragment)r$   rQ   r   r   )r*   r+   s   "r   r,   r     sO        K  I  K  M   r   r   N)r   r   r   r   r   r:   ro   r]   rc   r   r;   r<   s   @r   r   r     s/      $ $$ $%  r   r   c                   6    ] tR tRtRt^t^t^t^t^t	^t
^tRtR# )SOCKS5Statei#  z&Enumeration of SOCKS5 protocol states.r   N)r   r   r   r   r   CLIENT_AUTH_REQUIREDSERVER_AUTH_REPLYCLIENT_AUTHENTICATEDTUNNEL_READY$CLIENT_WAITING_FOR_USERNAME_PASSWORDSERVER_VERIFY_USERNAME_PASSWORD
MUST_CLOSEr   r   r   r   r   r   #  s-    0L+,(&'#Jr   r   c                   @  a  ] tR tRt o RtV 3R lR lt]V 3R lR l4       t]V 3R lR l4       t	]	P                  ]4      V 3R	 lR
 l4       t]	P                  ]4      V 3R lR l4       t]	P                  ]4      V 3R lR l4       tV 3R lR ltV 3R lR ltRtV tR# )SOCKS5Connectioni2  zEncapsulates a SOCKS5 connection.

Packs request objects into data suitable to be send and unpacks reply
data into their appropriate reply objects.
c                   < V ^8  d   QhRR/# )r'   r)   Nr   )r*   r+   s   "r   r,   SOCKS5Connection.__annotate__9  s     7 7$ 7r   c                l    \        4       V n        \        4       V n        \        P                  V n        R # r/   )	bytearray_data_to_send_received_datar   r   _stater[   s   &r   __init__SOCKS5Connection.__init__9  s#    &['k!66r   c                    < V ^8  d   QhRS[ /# rO   )r   )r*   r+   s   "r   r,   r   ?  s      { r   c                    V P                   # )z*Returns the current state of the protocol.)r   r[   s   &r   stateSOCKS5Connection.state>  s     {{r   c                $   < V ^8  d   QhRS[ RR/# r'   requestr)   N)SOCKS5RequestType)r*   r+   s   "r   r,   r   D  s     $ $- $$ $r   c                    \        4       h)zPacks a request object and adds it to the send data buffer.

Also progresses the protocol state of the connection.

Args:
    request: The request instance to be packed.
r   r\   r   s   &&r   sendSOCKS5Connection.sendC  s     "##r   c                $   < V ^8  d   QhRS[ RR/# r   rM   )r*   r+   s   "r   r,   r   O  s     4 4%= 4$ 4r   c                ~    V ;P                   VP                  4       ,          un         \        P                  V n        R # r/   )r   r]   r   r   r   r   s   &&r   _auth_methodsSOCKS5Connection._auth_methodsN  s&    gmmo-!33r   c                $   < V ^8  d   QhRS[ RR/# r   )rt   )r*   r+   s   "r   r,   r   T  s     . ./L .QU .r   c                    V P                   \        P                  8w  d   \        R 4      h\        P                  V n         V ;P
                  VP                  4       ,          un        R# )z/Not currently waiting for username and passwordN)r   r   r   r   r   r   r]   r   s   &&r   _auth_username_password(SOCKS5Connection._auth_username_passwordS  sD    ;;+JJJ QRR!AAgmmo-r   c                $   < V ^8  d   QhRS[ RR/# r   r   )r*   r+   s   "r   r,   r   [  s     . . 8 .T .r   c                    V P                   \        P                  8  d   \        R 4      hV ;P                  VP                  4       ,          un        R# )zASOCKS5 connections must be authenticated before sending a requestN)r   r   r   r   r   r]   r   s   &&r   _commandSOCKS5Connection._commandZ  s=    ;;999S  	gmmo-r   c                T   < V ^8  d   QhRS[ RS[P                  S[S[S[3,          /# )r'   rg   r)   )rQ   r`   r   re   r   r~   )r*   r+   s   "r   r,   r   b  s.     $$ $$$$	o{4OO	P$$r   c                @   V P                   \        P                  8X  d   \        P	                  V4      pVP
                  \        P                  8X  d   \        P                  V n         V# VP
                  \        P                  8X  d   \        P                  V n         V# V P                   \        P                  8X  dV   \        P	                  V4      pVP                  '       d   \        P                  V n         V# \        P                  V n         V# V P                   \        P                  8X  dc   \        P	                  V4      pVP                   \"        P$                  8X  d   \        P&                  V n         V# \        P                  V n         V# \)        4       h)zUnpacks response data into a reply object.

Args:
    data: The raw response data from the proxy server.

Returns:
    A reply instance corresponding to the connection state and reply data.
)r   r   r   re   ro   rm   r   r   r   r   r   r   r~   r   r   r   r   r>   rC   r   r   )r\   rg   
auth_replyusername_password_replyreplys   &&   r   receive_dataSOCKS5Connection.receive_datab  s:    ;;+777(..t4J  $4$F$FF)NN  ""&6&G&GG)>>;;+EEE&A&G&G&M#&...)>> +* *44**;;+:::%%d+E?#<#<<)66 L *44L!##r   c                    < V ^8  d   QhRS[ /# rO   rP   )r*   r+   s   "r   r,   r     s      e r   c                N    \        V P                  4      p\        4       V n        V# )zaReturns the data to be sent via the I/O library of choice.

Also clears the connection's buffer.
)rQ   r   r   )r\   rg   s   & r   data_to_sendSOCKS5Connection.data_to_send  s#    
 T''(&[r   )r   r   r   N)r   r   r   r   r   r   r   r   r   r   registerrM   r   rt   r   r   r   r   r   r   r;   r<   s   @r   r   r   2  s     7 7
   $ $ 
]]+,4 -4 
]]01. 2. 
]]'(. ).$$ $$L r   r   ) enumr`   _typesr   compatr   
exceptionsr   utilsr   r   r   r	   rQ   Enumr   r   r$   r>   
NamedTuplerM   re   rt   r~   r   r   r   IntEnumr   r   r   r   r   r   r   <module>r      s      ( % $udii $E499  %  $)eTYY )
v00 
*<f'' <>
F$5$5 
.0&"3"3 0GC6,, GCT&<&## &<R$V&& $,	$,, 	 LL!9;O!OP ] ]r   