Qf  ddlZddlddlZddlZddlZddlZddlmZmZ ddlZe eddZ e eddZ e eddZ gd Zejej eej"d ed ej"d ed ej"dedej"deddZdZdZej,j/j1driZded<ded<ded<ded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<d4ed5<d6ed7<d8ed9<d:ed;<ded?<d@edA<dBedC<dDedE<dFedG<dHedI<dJedK<dLedM<dNedO<dPedQ<dRedS<dTedU<dVedW<dXedY<dZed[<d\ed]<d^ed_<d`eda<dbedc<ddede<dfedg<dhedi<djedk<dledm<dnedo<dpedq<dreds<dtedu<dvedw<dxedy<dzed{<d|ed}<d~ed<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ded<ej5dҫGdӄdeZGdՄdej:ZddׄZeej:dثrddl Z ddلZ!ej5dګeej:d۫rddl Z dd܄Z"ej5dݫeej:dޫrd߄Z#ej5de$e%dfdZ&eedrde%dfdZ'ne&Z'ej5dde'_(e e hZ)GddejTZ+ddZ,e-Z.e.dfdddZ/dZ0e$dddddZ1ddZ2y#e $rdZYwxYw)N)*)IntEnumIntFlagEBADF EAGAIN EWOULDBLOCK)fromfdgetfqdncreate_connection create_serverhas_dualstack_ipv6 AddressFamily SocketKindrcH|jxr|jdS)NAF_isupper startswithCs -/opt/alt/python312/lib64/python3.12/socket.pyrO!))+5!,,u"55rcH|jxr|jdS)NSOCK_rrs rrrTs!))+7!,,w"77rMsgFlagcH|jxr|jdS)NMSG_rrs rrrYs!))+6!,,v"66r AddressInfocH|jxr|jdS)NAI_rrs rrr^rrz 127.0.0.1z::1c8 ||S#t$r|cYSwxYwN) ValueError)value enum_klasss r_intenum_converterr*ds+%   s  winz)Specified event object handle is invalid.zInsufficient memory available.z#One or more parameters are invalid.WzOverlapped operation aborted.iz2Overlapped I/O event object not in signaled state.iz)Overlapped operation will complete later.izThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'zToo many open files.i('z!The socket operation would block.i3'z,A blocking operation is already in progress.i4'zOperation already in progress.i5'zSocket operation on nonsocket.i6'zDestination address required.i7'zMessage too long.i8'zProtocol wrong type for socket.i9'zBad protocol option.i:'zProtocol not supported.i;'zSocket type not supported.i<'zOperation not supported.i='zProtocol family not supported.i>'z0Address family not supported by protocol family.i?'zThe network address is in use.i@'z Cannot assign requested address.iA'zNetwork is down.iB'zNetwork is unreachable.iC'z$Network dropped connection on reset.iD'z!Software caused connection abort.iE'zThe connection has been reset.iF'zNo buffer space available.iG'zSocket is already connected.iH'zSocket is not connected.iI'zThe network has been shut down.iJ'zToo many references.iK'zThe operation timed out.iL'zConnection refused.iM'zCannot translate name.iN'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'zDirectory not empty.iR'zToo many processes.iS'zUser quota exceeded.iT'zDisk quota exceeded.iU'zStale file handle reference.iV'zItem is remote.iW'z!Network subsystem is unavailable.ik'z!Winsock.dll version out of range.il'z(Successful WSAStartup not yet performed.im'zGraceful shutdown in progress.iu'z*No more results from WSALookupServiceNext.iv'zCall has been canceled.iw'z Procedure call table is invalid.ix'zService provider is invalid.iy'z&Service provider failed to initialize.iz'zSystem call failure.i{'zService not found.i|'zClass type not found.i}'i~'zCall was canceled.i'zDatabase query was refused.i'zHost not found.i*z Nonauthoritative host not found.i*zThis is a nonrecoverable error.i*z*Valid name, no data record requested type.i*zQoS receivers.i*z QoS senders.i*zNo QoS senders.i*zQoS no receivers.i+zQoS request confirmed.i+zQoS admission error.i+zQoS policy failure.i+zQoS bad style.i+zQoS bad object.i+zQoS traffic control error.i+zQoS generic error.i+zQoS service type error.i+zQoS flowspec error.i +zInvalid QoS provider buffer.i +zInvalid QoS filter style.i +i +zIncorrect QoS filter count.i +zInvalid QoS object length.i+zIncorrect QoS flow count.i+zUnrecognized QoS object.i+zInvalid QoS policy object.i+zInvalid QoS flow descriptor.i+z'Invalid QoS provider-specific flowspec.i+z)Invalid QoS provider-specific filterspec.i+z&Invalid QoS shape discard mode object.i+z Invalid QoS shaping rate object.i+z!Reserved policy QoS element type.i+errorTabc eZdZy)_GiveupOnSendfileN)__name__ __module__ __qualname__rrr1r1srr1cFeZdZ gdZddZdZdZdZdZdZ d Z d dddd d Z e e d rd!d Znd!dZd!dZdZd!dZdZej(fdZdZfdZefdZefdZe j6dk(rdZdZndZdZde_de_xZS)"socket) __weakref___io_refs_closedNc||dk(rt}|dk(rt}|dk(rd}tjj |||||d|_d|_y)NrF)AF_INET SOCK_STREAM_socketr7__init__r9r:)selffamilytypeprotofilenos rr@zsocket.__init__sU >| rz"{fdE6B  rc|Sr&r5rAs r __enter__zsocket.__enter__s rc>|js|jyyr&)r:close)rAargss r__exit__zsocket.__exit__s|| JJLrc t|dd}d|jj|jj|rdnd|j |j |j |jfz}|sH |j}|r|dt|zz } |j}|r|dt|zz }|dz }|S#ttf$rY) getattr __class__r3r4rErBrCrD getsocknamestrerrorAttributeError getpeername)rAclosedsladdrraddrs r__repr__zsocket.__repr__s y%0 :~~((~~**${"{{}{{yyzz   ((*E 22A ((*E 22A S>*   >*  s$6#C#CCCC+*C+cHtd|jjd)Nzcannot pickle z object) TypeErrorrQr2rGs r __getstate__zsocket.__getstate__s!.)@)@(C7KLLrc t|j}|j|j|j|j |}|j |j|S)NrE)duprErQrBrCrD settimeout gettimeout)rAfdsocks rraz socket.dupsS  ~~dkk499djj~L )* rc |j\}}t|j|j|j|}t !|j r|jd||fS)Nr`T)_acceptr7rBrCrDgetdefaulttimeoutrc setblocking)rArdaddrres racceptz socket.accept s` <<>Ddkk499djjD   &4??+<   T "Tzr)encodingerrorsnewlinec* t|hdkstd|dd|v}d|vxs| }d|v}d} |r| dz } |r| dz } t|| } |xjdz c_|d }|d krtj }|d k(r|s td | S|r|rt j | | |} n/|rt j| |} nt j| |} |r| St j|}t j| |||} || _ | S) N>brwz invalid mode z (only r, w, b allowed)rrrqrprNr<rz!unbuffered streams must be binary) setr'SocketIOr9ioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriter text_encoding TextIOWrappermode) rAr} bufferingrlrmrnwritingreadingbinaryrawmoderawbuffertexts rmakefilezsocket.makefile0s0 4yO+OP P++,W  sNG  sNGtW%   I q=..I > !DEEJ w&&sC;F &&sI6F&&sI6F M##H-&'B  rsendfilec0|j||||j} |j} t j|j}|syt|xs|d}|j} | dk(r tdttdrtj} ntj } | j#|tj$d} | j&} t j(} | r| | s t+d|rt|| z |}|dkrn | ||||}|dk(rn ||z }| |z } I| | dkDrt|dr|j/|SSS#ttjf$r}t |d}~wwxYw#t$r}t |d}~wwxYw#t,$r | s| Yt$r}| dk(r t ||dd}~wwxYw#| dkDrt|dr|j/|wwwxYw)Nri@&non-blocking sockets are not supported PollSelectorz timed outseek)_check_sendfile_paramsrErUrvUnsupportedOperationr1osfstatst_sizeOSErrorminrcr'hasattr selectorsrSelectSelectorregister EVENT_WRITEselectr TimeoutErrorBlockingIOErrorr)rAfileoffsetcountsocknorEerrfsize blocksizetimeoutselector total_sentselector_select os_sendfilesents r_sendfile_use_sendfilezsocket._sendfile_use_sendfile^s  ' 'fe <[[]F - -(00ENUG4Ioo'G!| !IJJy.1$113$335   fi&;&; <J&ooO++K &w'?*;77$' (:I$F $>!+*6669M  19!$"d* 78">gdF&;IIf%'<>s#B$;$;< -',, - -',, -@+!&,- ",%? #4C"88!t+,>gdF&;IIf%'<>sjE0F-G/. F89G/0F FF F5% F00F58G, G/ G,G''G,,G//&Hctd)Nz,os.sendfile() not available on this platform)r1rArrrs rrzsocket._sendfile_use_sendfiles#>@ @rcL|j||||jdk(r td|r|j||r t |dnd}d}|j }|j } |rt ||z |}|dkrn:t||}|sn& ||} || z }| t|kr|| d}nn$Q||dkDr"t|dr|j||zSSS#t$rYZwxYw#|dkDr"t|dr|j||zwwwxYw)Nrri r) rrcr'rrreadsend memoryviewlenrr) rArrrrr file_read sock_senddatars r_sendfile_use_sendzsocket._sendfile_use_sendsM ##D&%8 ??  !EF F  IIf (-Ct$4  II II  / #EJ$6 BI A~!)I"67 "(#d* #d)+#';D!&A~'$"7 &:-.#8~+! !A~'$"7 &:-.#8~s00-C:C+&C:+ C74C:6C77C::)D#c dt|ddvr td|jtzs td|Jt |t st dj||dkrtdj|yy)Nrpr}z$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)rPr'rCr> isinstanceintr]formatrs rrzsocket._check_sendfile_paramss gdFC0 0CD Dyy;&JK K  eS)AHHOQQz AHHOQQ rcp |j|||S#t$r|j|||cYSwxYwr&)rr1rrs rrzsocket.sendfilesH " @..tVUC C  @**4? ? @s 55c|jdkDr|xjdzc_|jr|jyy)Nrrs)r9r:rJrGs r_decref_socketioszsocket._decref_socketioss1 ==1  MMQ M << JJL rc&|j|yr&)rJ)rA_sss r _real_closezsocket._real_closes  $rcRd|_|jdkr|jyy)NTr)r:r9rrGs rrJz socket.closes& ==A      rc0 d|_t| S)NT)r:superdetachrArQs rrz socket.detachs  w~rc6 tt|tSr&)r*rrBrrs rrBz socket.familys !%'.-@@rc6 tt|tSr&)r*rrCrrs rrCz socket.type s !%', ;;rntcHtj|jSr&)rget_handle_inheritablerErGs rget_inheritablezsocket.get_inheritables,,T[[]; ;rcLtj|j|yr&)rset_handle_inheritablerErA inheritables rset_inheritablezsocket.set_inheritables  % %dkkm[ ArcHtj|jSr&)rrrErGs rrzsocket.get_inheritables%%dkkm4 4rcLtj|j|yr&)rrrErs rrzsocket.set_inheritables   t{{}k :rz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r<r<r<N)rqNrN) r2r3r4 __slots__r@rHrLr[r^rarkrrrrrrrrr?r7rrJrpropertyrBrCnamerr__doc__ __classcell__rQs@rr7r7sD6I <M  *tT*Xr:? &B @"/H Q@. &nn  AA <<  ww$ < B 5 ;FOFOrr7c6 t|}t||||Sr&)rar7)rdrBrCrDnfds rr r s# b'C &$s ++rsendmsgc  |j|tjtjt jd|fgSNi)rr? SOL_SOCKET SCM_RIGHTSarray)rebuffersfdsflagsaddresss rsend_fdsr*sD ||Gw'9'9    C 5'7&89 9rrrecvmsgc  tjd}|j|tj||jz\}}}}|D]d\}} } |tj k(s| tj k(s/|j| dt| t| |jzz f|t|||fSr) rrr?CMSG_LENitemsizerr frombytesrlist) rebufsizemaxfdsrrmsgancdatarj cmsg_level cmsg_type cmsg_datas rrecv_fdsr6s kk#$(LL   Vcll2 3%5!WeT07 ,J 9g000Y'BTBT5T i)II#i.3<<*GHJK18 DIud**rrsharec tddd|S)Nr)r7)infos r fromsharerJs aAt$$rrcp|tk(rt}n|tk(rt}n t d|t k7r t d|dk7r t dt |||} |j|df|j|jdd\}}t |||} |jd |j||f|jd|j\}} |j |j|j!k7s!|j|j!k7r t#d ||fS#ttf$rYwxYw#|jxYw#|jwxYw#|j|jxYw) Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supportedFTzUnexpected peer connection)r= _LOCALHOSTAF_INET6 _LOCALHOST_V6r'r>r7bindlistenrRriconnectrInterruptedErrorrkrJrVConnectionError) rBrCrDhostlsockrjportcsockssock_s r_fallback_socketpairrVs  8 )* * {DEE z:;; 64 'E D!9 &&(!, dvtU+    e $  tTl+   d #||~HE1      5#4#4#6 6  "e&7&7&99!">? ?: 5>5$%56    KKM      sPAE=%E'7E $E'A FE$!E'#E$$E''E::E==F#F5 socketpairc| t}tj|||\}}t ||||j }t ||||j }||fS#t$r t}YgwxYwr&)AF_UNIX NameErrorr=r?rr7r)rBrCrDarps rrrsv > ! !!&$61 64 3 64 3!t  !  !sA A21A2a8socketpair([family[, type[, proto]]]) -> (socket object, socket object) Create a pair of socket objects from the sockets returned by the platform socketpair() function. The arguments are the same as for socket() except the default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET. cjeZdZ dZdZdZdZdZfdZdZ e dZ e d Z d Z xZS) ruc|dvrtd|ztjj|||_d|vr|dz }||_d|v|_d|v|_d|_y)N)rqrrrwrbwbrwbzinvalid mode: %rrprqrrF) r'rv RawIOBaser@_sock_mode_reading_writing_timeout_occurred)rArer}s rr@zSocketIO.__init__sj : :/$67 7 d# d? CKD t  t  !&rc |j|j|jr td |jj |S#t $r d|_t$r}|jtvrYd}~yd}~wwxYw)Nz!cannot read from timed out objectT) _checkClosed_checkReadablerrr recv_intorrTerrno_blocking_errnosrArpes rreadintozSocketIO.readintos     ! !=> > zz++A.. )-& 77.. sAB /BBB c |j|j |jj|S#t$r}|j t vrYd}~yd}~wwxYwr&)r_checkWritablerrrTrrrs rwritezSocketIO.writes\   ::??1% % ww**   s> A$AAA$cJ |jr td|jSNzI/O operation on closed socket.)rWr'rrGs rreadablezSocketIO.readable$ ;;>? ?}}rcJ |jr td|jSr&)rWr'rrGs rwritablezSocketIO.writabler(rcP |jr tdt| Sr&)rWr'rseekablers rr,zSocketIO.seekables) ;;>? ?w!!rcX |j|jjSr&)rrrErGs rrEzSocketIO.filenos&  zz  ""rc<|js|jSy)Nr<)rWrErGs rrz SocketIO.names{{;;= rc|jSr&)rrGs rr}z SocketIO.mode s zzrc |jrytjj||jj d|_yr&)rWrvrrJrrrGs rrJzSocketIO.closes<  ;;  4  $$& r)r2r3r4r@r!r$r'r*r,rErrr}rJrrs@rrurusX '. "#  rruc |j}|r|dvr t} t|\}}}|jd||D] }d|vs|S|}|S#t$rY|SwxYw)N)z0.0.0.0z::r.)strip gethostname gethostbyaddrinsertrT)rhostnamealiasesipaddrss rr r s ::r7_GLOBAL_DEFAULT_TIMEOUTrbrrclearrTappendrJrExceptionGroup)rrsource_addressr:rr exceptionsresafsocktyperD canonnamesareexcs rr r 7s JD$J4q+6-0*HeY "h.D55( .) LL     K7* :  m# !;ZH H 788!   "   c "      s$AB2C=2 C:;5C55C:=Dc tr ttdrttdsy ttt 5}|j ttd dddy#1swYyxYw#t$rYywxYw)N IPPROTO_IPV6 IPV6_V6ONLYFrT) has_ipv6rr?r7rr> setsockoptrJrKrT)res rrrjsk 7N37M2 Hk *d OOL+q 9   * * s.A0A$A0$A-)A0-A00 A<;A<)rBbacklog reuse_portdualstack_ipv6c| |rttds td|r)ts td|tk7r tdt |t } tjdvr,ttdr |jttd|r|jttdtrb|tk(rY|r|jtt dn;ttd r+ttd r|jtt d |j#|||j)|S|j)||S#t$rYwxYw#t$r.}|j$d |d }t|j&|dd}~wwxYw#t$r|j+wxYw) N SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)rcygwin SO_REUSEADDRrsrrKrJz& (while attempting to bind on address ))rr?r'rrr7r>rrrMrrTrTrRrLrJrKrstrerrorrrrJ)rrBrNrOrPrerrs rrrzs"''>:FGG!#LM M X FG G &+ &D' 77* *0  L!<  OOJ a 8 (* k1=-0G^4 k1= 2 IIg  ? KKM  KK  -   2w(C 3'T 1 2   s["F >EBF E&0F F  E# F "E##F & F/)FFF F;c g}tj||||||D]<}|\}} }} } |jt|tt| t || | f>|Sr&)r?r<r?r*rr) rrrBrCrDraddrlistrCrDrErFrGs rr<r<sq H""4vtUEJ-0*HeY+B >+HjA 2/ 0K Or)rr)rN)rrrr)3r?rsysrvrenumrrr ImportErrorrPrrr __all__extend_get_exports_list _convert_r2rrr*platformlowerrr/r? Exceptionr1r7r rrrrrr=r>rrrrrrur objectr=r rrr<r5rrrds.`! w" " %e]B/  @#r##G,-57 79 68 57   <<""5)H=HQK2HQK8HRL3HSMHHSM?HSM6HUO5HUO*HUO9HUO;HUO,HUO9HUODHUO6HUO6HUO5HUO)HUO7HUO,HUO/HUO2HUO0HUO6HUOHHUO6HUO8HUO(HUO/HUOHUO,HUO*HUO-HUOBHUO*HUO3HUO'HUO8HUO7HUOBHUO&HUO$HUO'HUO)HUO.HUO,HUO+HUO&HUO'HUO2HUO*HUO/HUO+HUO4HUO1HUO1HUO3HUO2HUO1HUO0HUO2HUO4HUO?HUOAHUO>HUO8HUO9HUO NN:) (EGW^^EGN , 7>>9%9 NN: 7>>9%+" NN: 7>>7#% NN; !(k4l 7L![ &J NN<  [*rr||rj6!('>%)099>09f  &-du!&BJG EsO11O<;O<