+
    G2]ny  c                   s   ^ RI Ht  ^ RIHt ^ RIHtHtH	t	 ^ RI
t
^ RIHt ^ RIt^ RIt^ RIHt ^ RIt^ RIt^ RItRt]P(                  R8X  d   ]P*                  R38  d    ^ RIt]P.                  ! ]4      t^;tt^;tt^;ttR
]R]R]/t ]!! ]"! ] PG                  4       ] PI                  4       4      4      t%]P                   ;t&t'R t( ! R R])4      t* ! R R]*4      t+ ! R R]*4      t, ! R R]*4      t- ! R R]*4      t. ! R R]*4      t/ ! R R]*4      t0^[R^\R^]R/t1^R^R ^R!^R"^R#^R$^R%^R&/t2]R']R']R(/t3R4R) lt4R* t5R+ t6]6t7R, t8]8t9R5R- lt: ! R. R/]P                   4      t;R0 t<R6 FI  t]=! ];]R4      t>]?! ]>]4      '       d   K  ];P                  P                  ]4       ]B! ];]]<! ]4      4       KK  	   ! R1 R2];4      tCR#   ] d    ^ RIHt  ELi ; i  ] d
    ]! R	4      hi ; i)7    )	b64encode)Callable)
EOPNOTSUPPEINVALEAGAINN)BytesIO)SEEK_CURz1.7.1Zntz8To run PySocks on Windows you must install win_inet_ptonSOCKS4SOCKS5HTTPc                 sF   a  \         P                  ! S 4      V 3R  l4       pV# )c                  s  < V ^ ,          p VP                  4       pV^ 8X  d   VP                  R4       S! V / VB V^ 8X  d   VP                  R4       # #   \         d   ph Rp?ii ; i  X^ 8X  d   TP                  R4       i i ; i)r    TFN)
gettimeoutsetblockingZ	Exception)argskwargsselfZ_is_blockingefunctions   *,   */usr/lib/python3.14/site-packages/socks.pywrapperZ"set_self_blocking.<locals>.wrapper(   s    Aw
	(??,Lq   &T,V,
 q   ' !	  		 q   ' !s#   /A A& A!!A&&A) )B)	functoolsZwraps)r   r   s   f r   set_self_blockingr   &   s%    __X( ( N    c                   s4   a  ] tR t^9t o RtRR ltR tRtV tR# )
ProxyErrorz4Socket_err contains original socket.error exception.Nc                s    Wn         W n        V'       d+   V ;P                   R P                  V4      ,          un         R# R# )z: {}N)msg
socket_errformat)r   r   r   s   &&&r   __init__ZProxyError.__init__;   s+    $HHj11H r   c                    V P                   # N)r   r      &r   __str__ZProxyError.__str__B   s    xxr   )r   r   r   )	__name__
__module____qualname____firstlineno____doc__r   r    __static_attributes____classdictcell____classdict__   @r   r   r   9   s     >2 r   r   c                   s    ] tR t^FtRtR# )GeneralProxyError Nr!   r"   r#   r$   r&   r,   r   r   r+   r+   F       r   r+   c                   s    ] tR t^JtRtR# )ProxyConnectionErrorr,   Nr-   r,   r   r   r/   r/   J   r.   r   r/   c                   s    ] tR t^NtRtR# )SOCKS5AuthErrorr,   Nr-   r,   r   r   r0   r0   N   r.   r   r0   c                   s    ] tR t^RtRtR# )SOCKS5Errorr,   Nr-   r,   r   r   r1   r1   R   r.   r   r1   c                   s    ] tR t^VtRtR# )SOCKS4Errorr,   Nr-   r,   r   r   r2   r2   V   r.   r   r2   c                   s    ] tR t^ZtRtR# )	HTTPErrorr,   Nr-   r,   r   r   r3   r3   Z   r.   r   r3   zRequest rejected or failedzLRequest rejected because SOCKS server cannot connect to identd on the clientzPRequest rejected because the client program and identd report different user-idszGeneral SOCKS server failurez!Connection not allowed by rulesetzNetwork unreachablezHost unreachablezConnection refusedzTTL expiredz(Command not supported, or protocol errorzAddress type not supportedi8  i  c                s    YY#V'       d   VP                  4       MRV'       d   VP                  4       MR3\        n        R# )zSets a default proxy.

All further socksocket objects will use the default unless explicitly
changed. All parameters are as for socket.set_proxy().N)encode
socksocketdefault_proxy)
proxy_typeaddrportrdnsusernamepasswords   &&&&&&r   set_default_proxyr=   s   s0     !+$5= 145= 14 IJr   c                  sN    R V9   d   VP                  R 4      VR&   \        V / VB # Z	proxytyper7   )popr=   )r   r   s   *,r   setdefaultproxyr@   ~   s-    f%zz+6|d-f--r   c                 s"    \         P                  # )z4Returns the default proxy, set by set_default_proxy.)r5   r6   r,   r   r   get_default_proxyrA      s    ###r   c                sr    \         P                  '       d   \         V P                  n        R# \        R4      h)a  Attempts to replace a module's socket library with a SOCKS socket.

Must set a default proxy using set_default_proxy(...) first. This will
only work on modules that import socket directly into the namespace;
most of the Python Standard Library falls into this category.zNo default proxy specifiedN)r5   r6   socketr+   )Zmoduler   r   wrap_modulerC      s(     ) <==r   c
           	     sJ   V w  rV
P                  R4      '       d   V
P                  R4      p
V'       d)   VP                  R4      '       d   VP                  R4      pRp\        P                  ! WE^ \        P                  4       F  pVw  rpppRp \        WV4      pV	'       d   V	 F  pVP                  ! V!   K  	  \        V\        \        34      '       d   VP                  V4       V'       d   VP                  W4WVWx4       V'       d   VP                  V4       VP                  W34       Vu # 	  V'       d   Vh\        P                  ! R4      h  \        P                  \        3 d0   pTpT'       d   TP!                  4        Rp Rp?EK   Rp?EK  Rp?ii ; i)a  create_connection(dest_pair, *[, timeout], **proxy_args) -> socket object

Like socket.create_connection(), but connects to proxy
before returning the socket object.

dest_pair - 2-tuple of (IP/hostname, port).
**proxy_args - Same args passed to socksocket.set_proxy() if present.
timeout - Optional socket timeout value, in seconds.
source_address - tuple (host, port) for the socket to bind to as its source
address before connecting (only for compatibility)
[z[]Nzgai returned empty list.)
startswithZstriprB   getaddrinfoSOCK_STREAMr5   Z
setsockopt
isinstanceintZfloat
settimeout	set_proxybindconnecterrorr   close)	dest_pairtimeoutZsource_addressr7   
proxy_addr
proxy_portZ
proxy_rdnsZproxy_usernameZproxy_passwordZsocket_optionsZremote_hostZremote_portZerrZrfamilyZsocket_typeprotoZ	canonnameZsaZsockZoptr   s   &&&&&&&&&&            r   create_connectionrV      s\   $  )Kc""!''-j++C00%%d+

C 
6;M;MN451UIr	f59D)COOS) * 'C<00(zz-?		.)LL+34K) O8 	
,,1
22 j) 	C

 	s%   A!E4E$EF"3FF"c                   s8   a  ] tR t^t o RtR t]! 4       tRtV t	R# )_BaseSocketzBAllows Python 2 delegated methods such as send() to be overridden.c                s    \         P                  ! V .VO5/ VB  \        4       V n        V P                   F&  p\        W4      V P                  V&   \        W4       K(  	  R # r   )_orig_socketr   dict_savedmethods
_savenamesgetattrZdelattrr   poskwnames   &*, r   r   Z_BaseSocket.__init__   sO    d/S/B/!VOOD'.t':Dt$D $r   rZ   N)
r!   r"   r#   r$   r%   r   listr[   r&   r'   r(   r*   r   rW   rW      s     L  Jr   rW   c                 s   a  V 3R  l# )c                 s6   < V P                   S,          ! V/ VB # r   ra   r]   s   &*,r   Z<lambda>Z_makemethod.<locals>.<lambda>   s    D$6$6t$<c$HR$Hr   r,   )r`   s   fr   _makemethodrc      s	    HHr   c                   sl  a a ] tR t^t oRtRt]P                  ]P                  ^ 3V 3R llt	R t
V 3R ltR tR tRR ltR	 tV 3R
 ltV 3R ltRV 3R lltRV 3R lltR tV 3R ltR t]tR t]tR t]tR tV 3R ltR tR tR t R t!]"] ]#]]$]!/t%]&RV 3R ll4       t']&R 4       t(R t)Rt*Vt+V ;t,# ) r5   a  socksocket([family[, type[, proto]]]) -> socket object

Open a SOCKS enabled socket. The parameters are the same as
those of the standard socket init. In order for SOCKS to work,
you must specify family=AF_INET and proto=0.
The "type" argument must be either SOCK_STREAM or SOCK_DGRAM.
Nc                sJ  < V\         P                  \         P                  39  d   R p\        VP	                  V4      4      h\
        \        V `  ! WV.VO5/ VB  RV n        V P                  '       d   V P                  V n
        MRV n
        RV n        RV n        RV n        R# )z0Socket type must be stream or datagram, not {!r}N)NNNNNN)rB   rG   
SOCK_DGRAM
ValueErrorr   superr5   r   
_proxyconnr6   proxyproxy_socknameproxy_peername_timeout)r   rT   typerU   r   r   r   	__class__s   &&&&*, r   r   Zsocksocket.__init__   s    **F,=,=>>DCSZZ-..j$(uNtNvN++DJ=DJ""r   c                s    Rp\        V4      V8  d?   VP                  V\        V4      ,
          4      pV'       g   \        R4      hW4,          pKN  V# )zReceive EXACTLY the number of bytes requested from the file object.

Blocks until the required number of bytes have been received.r   Connection closed unexpectedly)lenreadr+   )r   fileZcountZdataZds   &&&  r   _readallZsocksocket._readall  sG     $i%		%#d)+,A'(HIIIDr   c                s   < Wn          V P                  4       p\        \        V `  V P                   4       R #   \
        P                   d     R # i ; ir   )rk   get_proxy_peernamerf   r5   rJ   rB   rN   )r   rQ   Zpeerrm   s   && r   rJ   Zsocksocket.settimeout  sD    	**,D*d.t}}=|| 		s   -8 AAc                r   r   )rk   r   r   r   r   Zsocksocket.gettimeout#  s    }}r   c                s^    V'       d   V P                  R 4       R # V P                  R4       R # )Ng        )rJ   )r   Zvs   &&r   r   Zsocksocket.setblocking&  s    OOD!OOC r   c                s|    YY4V'       d   VP                  4       MRV'       d   VP                  4       MR3V n        R# )a&  Sets the proxy to be used.

proxy_type -  The type of the proxy to be used. Three types
                are supported: PROXY_TYPE_SOCKS4 (including socks4a),
                PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP
addr -        The address of the server (IP or DNS).
port -        The port of the server. Defaults to 1080 for SOCKS
                servers and 8080 for HTTP proxy servers.
rdns -        Should DNS queries be performed on the remote side
               (rather than the local side). The default is True.
               Note: This has no effect with SOCKS4 servers.
username -    Username to authenticate with to the server.
               The default is no authentication.
password -    Password to authenticate with to the server.
               Only relevant when username is also provided.N)r4   rh   )r   r7   r8   r9   r:   r;   r<   s   &&&&&&&r   rK   Zsocksocket.set_proxy,  s.    " !+3hoo'+3hoo'?
r   c                s\    R V9   d   VP                  R 4      VR&   V P                  ! V/ VB # r>   )r?   rK   )r   r   r   s   &*,r   setproxyZsocksocket.setproxyA  s1    & #)::k#:F< ~~t.v..r   c                s  < V P                   w  r4rVppV'       d    V P                  \        P                  8w  d   \        P
                  ! V .VO5/ VB # V P                  '       d   \        P                  ! \        R4      hV\        8w  d   Rp	\        P                  ! \        V	4      h\        \        V `  ! V/ VB  V P                  4       w  rRV3p\	        4       V n        V P                  4       pV P                  P                  V4       RpV P!                  V P                  W4      w  rVw  pp
Vw  r\        \        V `?  VV34       \        \        V `G  V P$                  4       RV n        R# )zNImplements proxy connection for UDP sockets.

Happens during the bind() phase.z"Socket already bound to an addressz'UDP only supported by SOCKS5 proxy typeZ0   N)0.0.0.0r    )rh   rl   rB   rd   rX   rL   rg   rN   r   r	   r   rf   r5   Zgetsockname_proxy_addrrM   _SOCKS5_requestrJ   rk   ri   )r   r^   r_   r7   rR   rS   r:   r;   r<   r   _r9   dstrh   ZUDP_ASSOCIATEZrelayhostrm   s   &*,              r   rL   Zsocksocket.bindF  s7   
 ZZ	8	TYY&*;*;;$$T6C6266???,,v'KLL;C,,z3//j$$c0R0
 ""$Dk&.  "&''L aj$'t5j$*4==9,r   c                s  < V P                   \        P                  8w  d   \        \        V `  ! V.VO5/ VB # V P                  '       g   V P                  R4       VR,          pVRR p\        4       pRpVP                  V4       RpVP                  V4       V P                  WF4       \        \        V `.  ! VP                  4       V,           .VO5/ VB p	WP                  4       ,
          # ) Ns         r|   r    i)rl   rB   rd   rf   r5   sendtorg   rL   r   write_write_SOCKS5_addresssendZgetvalueZtell)r   bytesr   r   ZaddressflagsZheaderZRSVZ
STANDALONEZsentrm   s   &&*,      r   r   Zsocksocket.sendtok  s    99)))T1%I$I&IIIIgr(Sb	S
Z ""73Z+FOO,=,E 6 6.46kkm##r   c                s   < V P                   \        P                  8X  d   V P                  ! WV P                  3/ VB # \
        \        V `  ! W3/ VB # r   )rl   rB   rd   r   rj   rf   r5   r   )r   r   r   r   rm   s   &&&,r   r   Zsocksocket.send  sH    99)));;uT-@-@KFKKT/GGGr   c                s^  < V P                   \        P                  8w  d   \        \        V `  W4      # V P                  '       g   V P                  R4       \        \        \        V `'  VR,           V4      4      pVP                  ^\        4       VP                  ^4      p\        V4      '       d   \        R4      hV P                  V4      w  rVV P                   '       d9   V P                   w  rxWW8w  g
   V^ V39  d   \        P"                  ! \$        R4      hVP                  V4      WV33# )r|   i   zReceived UDP packet fragmentzPacket filteredr~   )rl   rB   rd   rf   r5   recvfromrg   rL   r   recvZseekr   rp   ordZNotImplementedError_read_SOCKS5_addressrj   rN   r   )
r   Zbufsizer   ZbufZfragZfromhostZfromportZpeerhostZpeerportrm   s
   &&&      r   r   Zsocksocket.recvfrom  s    99)))T3GCCIIgeJ27T>5IJHxx{t99%&DEE!66s;!%!4!4H#x8}'Dll6+<==!H#788r   c                s.    V P                   ! V/ VB w  r4V# r   )r   )r   r^   r_   r   ry   s   &*,  r   r   Zsocksocket.recv  s    ==#,,r   c                s   < V P                   '       d   V P                   P                  4        \        \        V `  4       # r   )rg   rO   rf   r5   )r   rm   s   &r   rO   Zsocksocket.close  s,    ???OO!!#Z,..r   c                r   )z:Returns the bound IP address and port number at the proxy.)ri   r   r   r   get_proxy_socknameZsocksocket.get_proxy_sockname  s    """r   c                s"    V P                  4       # )z.
Returns the IP and port number of the proxy.
)getpeernamer   r   r   rs   Zsocksocket.get_proxy_peername  s     !!r   c                r   )zoReturns the IP address and port number of the destination machine.

Note: get_proxy_peername returns the proxy.)rj   r   r   r   get_peernameZsocksocket.get_peername  s     """r   c                sH    RpV P                  WV4      w  V n        V n        R# )z7Negotiates a stream connection through a SOCKS5 server.   N)rx   rj   ri   )r   	dest_addrZCONNECTs   &* r   _negotiate_SOCKS5Zsocksocket._negotiate_SOCKS5  s'    373G3G94&0T0r   c                s  < V P                   w  rErgrVP                  R4      p
VP                  R^ 4      p V'       d   V	'       d   V
P                  R4       MV
P                  R4       V
P                  4        V P	                  V^4      pVR,          R8w  d   \        R4      hVR,          R	8X  d   V'       d	   V	'       g   \        R
4      hV
P                  R\        \        V4      4      P                  4       ,           V,           \        \        V	4      4      P                  4       ,           V	,           4       V
P                  4        V P	                  V^4      pVR,          R8w  d   \        R4      hVR,          R8w  d   \        R4      hM2VR,          R8w  d%   VR,          R8X  d   \        R4      h\        R4      hV
P                  RV,           R,           4       V P                  W:4      pV
P                  4        V P	                  V^4      pVR,          R8w  d   \        R4      h\        VR,          4      pV^ 8w  d2   \        P                  VR4      p\        RP                  VV4      4      hV P!                  V4      p\"        \$        V `O  V P(                  4       VV3VP+                  4        V
P+                  4        #   TP+                  4        T
P+                  4        i ; i)zy
Send SOCKS5 request with given command (CMD field) and
address (DST field). Returns resolved DST address that was used.
wbrbs    s    r       Ns   %SOCKS5 proxy server sent invalid datar      Ns   zPNo username/password supplied. Server requested username/password authenticationr   r}   zSOCKS5 authentication faileds   z7All offered SOCKS5 authentication methods were rejectedUnknown error{:#04x}: {})rh   makefiler   flushrr   r+   r0   chrro   r4   r   r   SOCKS5_ERRORSgetr1   r   r   rf   r5   rJ   rk   rO   )r   ZconnZcmdrz   r7   r8   r9   r:   r;   r<   writerreaderZchosen_authZauth_statusZresolvedrespstatusrN   Zbndrm   s   &&&&               r   rx   Zsocksocket._SOCKS5_request  s   
 <@::8
$ht$tQ'W	H 01 _- LLN--2K37* (;= =
 37* !X * +< = = Ws3x='9'@'@'BB'("3x=188:;  (( ) "mmFA6s#w.+?A As#w.)*HII / S!W,s#w.)$% % ,?A A LL30111#>HLLN ==+DCyG#';= = c^F~%))&/B!-"6"6vu"EFF ++F3C*d.t}}=c?LLNLLN LLNLLNs   K A3K :K G%K "K*c                s`   Vw  r4V P                   w  p rgr\        P                  R\        P                  R/p
\        P                  \        P                  3 Fw  p \        P                  ! W4      pVP                  W,          V,           4       \        P                  ! W4      pVP                  \        P                  ! RV4      4       W43u # 	  V'       dR   VP                  R4      pVP                  R\        \        V4      4      P                  4       ,           V,           4       M\        P                  ! W4\        P                  \        P                  \        P                   \        P"                  4      pV^ ,          pV^ ,          pV^,          ^ ,          p\        P                  ! W4      pVP                  W,          V,           4       \        P                  ! W4      pVP                  \        P                  ! RV4      4       W43#   \        P                   d     EK  i ; i)zf
Return the host and port packed for the SOCKS5 protocol,
and the resolved address as a tuple object.
r      >Hidnaru   )rh   rB   AF_INETAF_INET6Z	inet_ptonr   	inet_ntopstructpackrN   r4   r   ro   rF   Z	AF_UNSPECrG   ZIPPROTO_TCPZAI_ADDRCONFIG)r   r8   rq   r{   r9   r7   ry   r:   r;   r<   Zfamily_to_byterT   
addr_bytesZ
host_bytesZ	addressesZtarget_addr   &&&             r   r   Z socksocket._write_SOCKS5_address   s   
 
59ZZ2
Aq ..'6??GL
 ~~v7F#--f;


>1J>?'';

6;;tT23z! 8 V,JJJwS_!5!<!<!>>KL **4v7G7G+1+=+=+1+=+=+1+?+?AI $A,K ^Fq>!$D))&7JJJ~-
:;##F7D

6;;tT*+z1 << s   A2HH-,H-c                s   V P                  V^4      pVR8X  d(   \        P                  ! V P                  V^4      4      pM}VR8X  d/   V P                  V^4      pV P                  V\        V4      4      pMHVR8X  d7   \        P                  ! \        P
                  V P                  V^4      4      pM\        R4      h\        P                  ! RV P                  V^4      4      ^ ,          pW53# )r   r   ru   r   r   r   )	rr   rB   	inet_ntoar   r   r   r+   r   unpack)r   rq   Zatypr8   Zlengthr9   s   &&    r   r   Zsocksocket._read_SOCKS5_addressM  s    }}T1%7?##DMM$$:;DW_]]4+F==s6{3DW_##FOOT]]45LMD#$KLL}}T4==q#9:1=zr   c                s   V P                   w  r4rVrxV P                  R4      p	V P                  R^ 4      p
 Rp \        P                  ! V4      pV	P                  \        P                  ! R^^V4      4       V	P                  V4       V'       d   V	P                  V4       V	P                  R4       V'       d(   V	P                  VP                  R4      R,           4       V	P                  4        V P                  V
^4      pVR	,          R8w  d   \        R
4      h\        VR,          4      pV^Z8w  d1   \        P                  VR4      p\!        RP#                  W4      4      h\        P$                  ! VR,          4      \        P&                  ! RVR,          4      ^ ,          3V n        V'       d   \        P$                  ! V4      V3V n        MW3V n        V
P-                  4        V	P-                  4        R#   \        P                   d>    T'       d   RpRp EL\        P                  ! \        P
                  ! T4      4      p ELi ; i  T
P-                  4        T	P-                  4        i ; i)z0Negotiates a connection through a SOCKS4 server.r   r   Fs      Tz>BBHr}   r   r   z%SOCKS4 proxy server sent invalid datar   r   r   :   NNr   :r   r   NN)rh   r   rB   Z	inet_atonrN   gethostbynamer   r   r   r4   r   rr   r+   r   SOCKS4_ERRORSr   r2   r   r   r   ri   rj   rO   )r   r   	dest_portr7   r8   r9   r:   r;   r<   r   r   Zremote_resolver   r   r   rN   r   r   _negotiate_SOCKS4Zsocksocket._negotiate_SOCKS4\  s   ;?::8
$ht$tQ'4	"N	9#--i8
 LLVT4CDLL$ X&LL!
 Y--f5?@LLN ==+DCyG#';= = c^F~%))&/B!-"6"6v"EFF $*#3#3DH#=#)==tCy#A!#D#FD&,&6&6z&BI&M#&/&:#LLNLLN_ << 9!4J%)N!'!1!1,,Y7"9J9\ LLNLLNsT   I G; A I )I 9C9I 3&I ;III *I	I II "I2c                s   V P                   w  r4rVrxV'       d   TM\        P                  ! V4      pRVP                  R4      ,           R,           \	        V4      P                  4       ,           R,           RVP                  R4      ,           .p	V'       d8   V'       d0   V	P                  R\        VR,           V,           4      ,           4       V	P                  R4       V P                  RP                  V	4      4       V P                  4       p
V
P                  4       pV
P                  4        V'       g   \        R4      h VP                  R	^4      w  rpTP                  R4      '       g   \        R4      h \!        T4      pT^8w  d-   RP%                  Y4      pTR9   d
   TR,          p\#        T4      hRT n        YB3T n        R#   \         d    \        R
4      hi ; i  \         d    \#        R4      hi ; i)zoNegotiates a connection through an HTTP server.

NOTE: This currently only supports HTTP CONNECT-style proxies.s   CONNECT r   s   :s	    HTTP/1.1s   Host: s   Proxy-Authorization: basic s   
rn   Z z'HTTP proxy server sent invalid responsezHTTP/z0Proxy server does not appear to be an HTTP proxyz4HTTP proxy server did not return a valid HTTP statusz{}: {}za
[*] Note: The HTTP proxy server may not be supported by PySocks (must be a CONNECT tunnel proxy)N)i  i  i  )s   0.0.0.0r    )rh   rB   r   r4   strappendr   ZsendallZjoinr   ZreadlinerO   r+   Zsplitre   rE   rI   r3   r   ri   rj   )r   r   r   r7   r8   r9   r:   r;   r<   Zhttp_headersZfobjZstatus_linerU   Zstatus_codeZ
status_msgrN   r   r   _negotiate_HTTPZsocksocket._negotiate_HTTP  s    <@::8
$h !yf&:&:9&E 4;;v..59~$$&')56	((00
  >"+HtOh,F"G!H I 	G$W\\,/0 }}mmo

#$DEE	O-8->->sA-F*E
 ((#BD D	Hk*K
 #OOK<Eo-  $ % E""-"o1  	O#$MNN	O  	HFH H	Hs   G 9G" G"G9c                s  < \        V4      ^8w  g   V^ ,          P                  R4      '       d'   \        P                  ! R\	        V4      ,          4      hVw  r4V P
                  \        P                  8X  d\   V P                  '       g   V P                  R
4       \        P                  ! V4      pVR8X  d   V'       g
   RV n
        R# W43V n
        R# V P                  w  rVrxp	p
\        V\        \        34      '       d/   \        V4      ^8w  g   V'       d   \        V\        4      '       g   \!        R4      h\"        \$        V `O  V P(                  4       Vf:   Wn
        \"        \$        V `O  V P(                  4       \"        \$        V `W  W434       R# V P-                  4       p \"        \$        V `W  V4        V P.                  V,          pV! WV4       R#   \        P                   d,   pT'       g   T P1                  4        \!        RT4      hThRp?i\2         d    T P1                  4        h i ; i  \        P                   du   pT P1                  4        T'       gV   Tw  rgRP5                  Yg4      p\6        T,          pRP5                  TT4      p\8        P;                  R	Y4       \=        Y4      hThRp?ii ; i)z
Connects to the specified destination through a proxy.
Uses the same API as socket's connect().
To select the proxy server, use set_proxy().

dest_pair - 2-tuple of (IP/hostname, port).
rD   z PySocks doesn't support IPv6: %srv   Nz0Invalid destination-connection (host, port) pairzSocket errorz{}:{}zError connecting to {} proxy {}z%s due to: %sr~   )ro   rE   rB   rN   r   rl   rd   rg   rL   r   rj   rh   rH   rb   ZtuplerI   r+   rf   r5   rJ   rk   rM   rw   _proxy_negotiatorsrO   r   r   PRINTABLE_PROXY_TYPESlogZdebugr/   )r   rP   catch_errorsr   r   r7   rR   rS   r:   r;   r<   Z	negotiaterN   Zproxy_serverZprintable_typer   rm   s   &&&             r   rM   Zsocksocket.connect  sN    y>Q)A,"9"9#">"> ,,A!$Y 0 1 1  )	99)))???		'",,Y7I I%i&*#  (1&<# ZZ	8	 9tUm44y>Q& !)S11#BD D
 	j$*4==9"+*d.t}}=*d+Y,BC%%'
#	*d+J7& 33J?	$95<<  #JJL+NEBBK 

9 || 	JJL)3&
&~~jE!6z!B7>>~DPR		/36*366	s7   %H5 9G H2,&HH2H25J>
A/J99J>c                s     V P                  VRR7       ^ #   \         d*   pTP                  '       d   TP                  u Rp?# h Rp?ii ; i)a  https://docs.python.org/3/library/socket.html#socket.socket.connect_ex
Like connect(address), but return an error indicator instead of raising an exception for errors returned by the C-level connect() call (other problems, such as "host not found" can still raise exceptions).
T)r   N)rM   ZOSErrorerrno)r   rP   r   s   && r   
connect_exZsocksocket.connect_ex6  sA    
		LLL6 	 wwwww	s    AAAAAc                s    V P                   w  rr4ppT;'       g    \        P                  V4      pV'       g   \        R4      hW#3# )z4
Return proxy address to connect to as tuple object
zInvalid proxy type)rh   DEFAULT_PORTSr   r+   )r   r7   rR   rS   r:   r;   r<   s   &      r   rw   Zsocksocket._proxy_addrF  sI    
 ZZ	8	@@=#4#4Z#@
#$899%%r   )rg   rk   rh   rj   ri   NNNTNN)r    r   )-r!   r"   r#   r$   r%   r6   rB   r   rG   r   rr   rJ   r   r   rK   rt   rL   r   r   r   r   rO   r   Zgetproxysocknamers   Zgetproxypeernamer   r   r   rx   r   r   r   r   r   r	   r
   r   r   rM   r   rw   r&   r'   Z__classcell__)rm   r)   s   @@r   r5   r5      s      M$nn63E3E$
!?*/
#-J$(H9(/
# *" *# K&`D+Z:x9.x "#4!#4 Z Zx  	& 	&r   r5   )i   r    r   )	NNNNNTNNN)r   r   r   r   )DZbase64r   Zcollections.abcr   ZImportErrorZcollectionsr   r   r   r   r   Zior   ZloggingZosr   rB   r   ZsysZ__version__r`   Zversion_infoZwin_inet_ptonZ	getLoggerr!   r   ZPROXY_TYPE_SOCKS4r   ZPROXY_TYPE_SOCKS5r	   ZPROXY_TYPE_HTTPr
   ZPROXY_TYPESrY   ZzipZvaluesZkeysr   Z
_orgsocketrX   r   ZIOErrorr   r+   r/   r0   r1   r2   r3   r   r   r   r=   r@   rA   ZgetdefaultproxyrC   Z
wrapmodulerV   rW   rc   r\   ZmethodrH   r[   r   Zsetattrr5   r,   r   r   <module>r      sg   %( - ,    	    
 77d?s''&0H
 !  F  F $664@S!3!3!5{7G7G7IJK "MM )
\&
 
	
 		: 		j 		* 		* 		
 	 	
&  !	 	
(
-


-
4
&	 vtT48I.$ $	> 
:3z
&-- 
I2D[$-F fh''%%d+T;t#45 3^	& ^	&[  %$$%$  HFH 	HHs   G !G GGG%