+
    0j                     4   ^ RI t ^ RIt^RIHt ^RIHt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4      tR# )    N)
StrOrBytes)ProtocolError
SOCKSError)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# )SOCKS4ReplyCodez"Enumeration of SOCKS4 reply codes.   Z   [   \   ] N)
__name__
__module____qualname____firstlineno____doc__REQUEST_GRANTEDREQUEST_REJECTED_OR_FAILEDCONNECTION_FAILEDAUTHENTICATION_FAILED__static_attributes__r       c/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/socksio/socks4.pyr   r      s    ,O!(#r   r   c                   "    ] tR t^tRtRtRtRtR# )SOCKS4Commandz$Enumeration of SOCKS4 command codes.      r   N)r   r   r   r   r   CONNECTBINDr   r   r   r   r   r      s    .GDr   r   c                   j   a  ] tR t^t o RtRt]R	V 3R lR ll4       tR	V 3R lR lltV 3R lt	Rt
V tR# )
SOCKS4RequestaN  Encapsulates a request to the SOCKS4 proxy server

Args:
    command: The command to request.
    port: The port number to connect to on the target host.
    addr: IP address of the target host.
    user_id: Optional user ID to be included in the request, if not supplied
        the user *must* provide one in the packing operation.
Nc                   < V ^8  d   QhRS[ RS[P                  S[S[P                  S[S[3,          3,          RS[P                  S[,          RR/# )   commandaddressuser_idreturnr$   r   typingUnionr   TupleintOptionalbytes)format__classdict__s   "r   __annotate__SOCKS4Request.__annotate__/   s]     S SS j&,,z3*GGHS '	S
 
Sr   c                    \        V4      w  r$\        V4      w  rVV\        P                  8w  d   \	        R4      hV ! WWCR7      # )aj  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.
    user_id: Optional user ID.

Returns:
    A SOCKS4Request instance.

Raises:
    SOCKSError: If a domain name or IPv6 address was supplied.
z;IPv6 addresses and domain names are not supported by SOCKS4r'   addrportr)   )r	   r   r   IPV4r   clsr'   r(   r)   r9   atypeencoded_addrs   &&&&   r   from_addressSOCKS4Request.from_address.   sJ    * <GD,W5K$$$M  7DRRr   c                J   < V ^8  d   QhRS[ P                  S[,          RS[/# r&   r)   r*   r,   r0   r1   )r2   r3   s   "r   r4   r5   K   s$     
 
V__U3 
u 
r   c           	         T;'       g    V P                   pVf   \        R4      hRP                  RV P                  V P                  P                  ^RR7      V P                  VR.4      # )Z  Packs the instance into a raw binary in the appropriate form.

Args:
    user_id: Optional user ID as an override, if not provided the instance's
        will be used, if none was provided at initialization an error is raised.

Returns:
    The packed request.

Raises:
    SOCKSError: If no user was specified in this call or on initialization.
-SOCKS4 requires a user_id, none was specifiedr      big	byteorder    r)   r   joinr'   r9   to_bytesr8   selfr)   s   &&r   dumpsSOCKS4Request.dumpsK   sj     ))T\\?LMMxx$$Q%$8			
 		
r   c                n   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[P                  S[,          ;R&   # r&   r'   r9   r8   r)   r   r/   r1   r,   r0   )r2   r3   s   "r   r4   r5      @        I  K  __U#* r   r   Nr   r   r   r   r   r)   classmethodr?   rQ   __annotate_func__r   __classdictcell__r3   s   @r   r$   r$      s=      '+GS S S8
 
[  r   r$   c                   j   a  ] tR t^ht o RtRt]R	V 3R lR ll4       tR	V 3R lR lltV 3R lt	Rt
V tR# )
SOCKS4ARequestaO  Encapsulates a request to the SOCKS4A proxy server

Args:
    command: The command to request.
    port: The port number to connect to on the target host.
    addr: IP address of the target host.
    user_id: Optional user ID to be included in the request, if not supplied
        the user *must* provide one in the packing operation.
Nc                   < V ^8  d   QhRS[ RS[P                  S[S[P                  S[S[3,          3,          RS[P                  S[,          RR/# )r&   r'   r(   r)   r*   r^   r+   )r2   r3   s   "r   r4   SOCKS4ARequest.__annotate__y   s]     S SS j&,,z3*GGHS '	S
 
Sr   c                J    \        V4      w  r$\        V4      w  rVV ! WWCR7      # )a#  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.
    user_id: Optional user ID.

Returns:
    A SOCKS4ARequest instance.
r7   )r	   r   r;   s   &&&&   r   r?   SOCKS4ARequest.from_addressx   s*    $ <GD,W57DRRr   c                J   < V ^8  d   QhRS[ P                  S[,          RS[/# rB   rC   )r2   r3   s   "r   r4   r`      s$     
 
V__U3 
u 
r   c           
         T;'       g    V P                   pVf   \        R4      hRP                  RV P                  V P                  P                  ^RR7      RVRV P                  R.4      # )rE   rF   r   rG   rH   rI   s      rK   rL   rO   s   &&r   rQ   SOCKS4ARequest.dumps   sp     ))T\\?LMMxx$$Q%$8#			
 	
r   c                n   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[P                  S[,          ;R&   # rT   rU   )r2   r3   s   "r   r4   r`   h   rV   r   r   rW   rX   r\   s   @r   r^   r^   h   s=      '+GS S S*
 
M  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# )SOCKS4ReplyzEncapsulates a reply from the SOCKS4 proxy server

Args:
    reply_code: The code representing the type of reply.
    port: The port number returned.
    addr: Optional IP address returned.
c                $   < V ^8  d   QhRS[ RR/# )r&   datar*   rh   r1   )r2   r3   s   "r   r4   SOCKS4Reply.__annotate__   s     < < <= <r   c           	     @   \        V4      ^8w  g   VR,          R8w  d   \        R4      h V ! \        VR,          4      \        P	                  VR,          RR7      \        \        P                  VR,          4      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      NrK   zMalformed reply:rn   r&   N:r&      NrH   rI   :ro      N)
reply_coder9   r8   N)	lenr   r   r/   
from_bytesr   r   r:   
ValueError)r<   rj   excs   && r   loadsSOCKS4Reply.loads   s     t9>T#Y'1 122	<*495^^DI^?#K$4$4d3i@ 
  	< 12;	<s   AB BBBc                b   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[P                  S[,          ;R&   # )r&   rq   r9   r8   )r   r/   r,   r0   str)r2   r3   s   "r   r4   rl      s4         I  //#
 r   r   N)
r   r   r   r   r   rY   rv   rZ   r   r[   r\   s   @r   rh   rh      s%      < <  r   rh   c                   l   a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltR
t	V t
R# )SOCKS4ConnectionzEncapsulates a SOCKS4 and SOCKS4A connection.

Packs request objects into data suitable to be send and unpacks reply
data into their appropriate reply objects.

Args:
    user_id: The user ID to be sent as part of the requests.
c                    < V ^8  d   QhRS[ /# )r&   r)   rk   )r2   r3   s   "r   r4   SOCKS4Connection.__annotate__   s     * * *r   c                N    Wn         \        4       V n        \        4       V n        R # rW   )r)   	bytearray_data_to_send_received_datarO   s   &&r   __init__SOCKS4Connection.__init__   s    &['kr   c                N   < V ^8  d   QhRS[ P                  S[S[3,          RR/# )r&   requestr*   N)r,   r-   r$   r^   )r2   r3   s   "r   r4   r}      s)     = =FLL)FG =D =r   c                    VP                   ;'       g    V P                   pV ;P                  VP                  VR7      ,          un        R# )zsPacks a request object and adds it to the send data buffer.

Args:
    request: The request instance to be packed.
)r)   N)r)   r   rQ   )rP   r   r)   s   && r   sendSOCKS4Connection.send   s5     //11T\\gmmGm<<r   c                &   < V ^8  d   QhRS[ RS[/# )r&   rj   r*   )r1   rh   )r2   r3   s   "r   r4   r}      s     
= 
= 
=; 
=r   c                    V ;P                   V,          un         \        P                  \        V P                   4      4      # )zUnpacks response data into a reply object.

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

Returns:
    The appropriate reply object.
)r   rh   rv   r1   rP   rj   s   &&r   receive_dataSOCKS4Connection.receive_data   s1     	t#  t':':!;<<r   c                    < V ^8  d   QhRS[ /# )r&   r*   rk   )r2   r3   s   "r   r4   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.
)r1   r   r   r   s   & r   data_to_sendSOCKS4Connection.data_to_send   s#    
 T''(&[r   )r   r   r)   N)r   r   r   r   r   r   r   r   r   r   r[   r\   s   @r   r{   r{      s2     * *= =
= 
= r   r{   )enumr,   _typesr   
exceptionsr   r   utilsr   r   r   r	   r1   Enumr   r   
NamedTupler$   r^   rh   r{   r   r   r   <module>r      s       1 $eTYY $E499 G
F%% G
TB
V&& B
J!<&## !<H, ,r   