
    _?iD              
          % S r SSKrSSKrSSKrSSKrSSKJrJr  SSKr	SSK
r	SSKr	SSKr	SSKr	SSKr	SSKr	 " S S\	R                   R"                  5      r " S S5      r " S S	\5      r " S
 S\5      r " S S\	R                   R"                  5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r\R6                  \\R8                  \\R:                  \\R<                  \\R>                  \0r \\\4   \!S'   S\S\4S jr"S\\#-  SSS\4S jr$S\\#-  S\%S\&S\&S\4
S  jr'S!\S\SS4S" jr(\R:                  r\RR                  r)\RT                  r*\RV                  r+\R6                  r\RX                  r,\R<                  r\RZ                  r-\R\                  r.\R^                  r/\R8                  r\R>                  rg)#zEDNS Options    N)AnyDictc                   X    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSr\S 5       rSrg)
OptionType#   zEDNS option type codes               	   
                  c                     gNi   clss    L/var/www/html/livechat/backend/venv/lib/python3.13/site-packages/dns/edns.py_maximumOptionType._maximum?           r   N)__name__
__module____qualname____firstlineno____doc__NSIDDAUDHUN3UECSEXPIRECOOKIE	KEEPALIVEPADDINGCHAINEDEREPORTCHANNELclassmethodr   __static_attributes__r   r   r   r   r   #   sU      D
C
C
C
CFFIGE
CM r   r   c                       \ rS rSrSrS\\-  4S jrSS\S-  S\	S-  4S jjr
S\4S	 jrSS
 jr\S\SSSS 4S j5       rS rS rS rS rS rS rS rS rSrg)OptionD   z%Base class for all EDNS option types.otypec                 8    [         R                  U5      U l        g)zOInitialize an option.

*otype*, a ``dns.edns.OptionType``, is the option type.
N)r   maker4   )selfr4   s     r   __init__Option.__init__G   s    
  __U+
r   Nfilereturnc                     [         e)zEConvert an option to wire format.

Returns a ``bytes`` or ``None``.

NotImplementedErrorr7   r:   s     r   to_wireOption.to_wireN   s
     "!r   c                     [         eNr=   r7   s    r   to_textOption.to_textV   s    !!r   c                 X    U R                  5       nUc   e[        U R                  U5      $ )zbCreates a dns.edns.GenericOption equivalent of this rdata.

Returns a ``dns.edns.GenericOption``.
)r@   GenericOptionr4   )r7   wires     r   
to_genericOption.to_genericY   s,    
 ||~TZZ..r   parserdns.wire.Parserc                     [         e)zBuild an EDNS option object from wire format.

*otype*, a ``dns.edns.OptionType``, is the option type.

*parser*, a ``dns.wire.Parser``, the parser, which should be
restructed to the option length.

Returns a ``dns.edns.Option``.
r=   r   r4   rL   s      r   from_wire_parserOption.from_wire_parserb   s
     "!r   c                 \    U R                  5       nUR                  5       nX#:X  a  gX#:  a  gg)zCompare an EDNS option with another option of the same type.

Returns < 0 if < *other*, 0 if == *other*, and > 0 if > *other*.
r      )r@   )r7   otherrI   owires       r   _cmpOption._cmpo   s-    
 ||~=<r   c                     [        U[        5      (       d  gU R                  UR                  :w  a  gU R                  U5      S:H  $ )NFr   
isinstancer2   r4   rW   r7   rU   s     r   __eq__Option.__eq__|   s9    %((::$yy1$$r   c                     [        U[        5      (       d  gU R                  UR                  :w  a  gU R                  U5      S:g  $ )NTr   rZ   r\   s     r   __ne__Option.__ne__   s9    %((::$yy1$$r   c                     [        U[        5      (       a  U R                  UR                  :w  a  [        $ U R	                  U5      S:  $ Nr   r[   r2   r4   NotImplementedrW   r\   s     r   __lt__Option.__lt__   8    %((DJJ%++,E!!yy!##r   c                     [        U[        5      (       a  U R                  UR                  :w  a  [        $ U R	                  U5      S:*  $ rc   rd   r\   s     r   __le__Option.__le__   8    %((DJJ%++,E!!yy1$$r   c                     [        U[        5      (       a  U R                  UR                  :w  a  [        $ U R	                  U5      S:  $ rc   rd   r\   s     r   __ge__Option.__ge__   rl   r   c                     [        U[        5      (       a  U R                  UR                  :w  a  [        $ U R	                  U5      S:  $ rc   rd   r\   s     r   __gt__Option.__gt__   rh   r   c                 "    U R                  5       $ rC   )rE   rD   s    r   __str__Option.__str__   s    ||~r   r4   rC   r;   rH   )r   r   r    r!   r"   r   strr8   r   bytesr@   rE   rJ   r/   rP   rW   r]   r`   rf   rj   rn   rq   rt   r0   r   r   r   r2   r2   D   s    /,j3. ,"C$J "%$, "" "/ 
"Z 
"9J 
"x 
" 
"%%$
%
%
$
r   r2   c                      ^  \ rS rSrSrS\\-  S\\-  4U 4S jjrSS\	S-  S\S-  4S	 jjr
S\4S
 jrSS jr\S\\-  SSS\4S j5       rSrU =r$ )rH      zkGeneric Option Class

This class is used for EDNS option types for which we have no better
implementation.
r4   datac                    > [         TU ]  U5        [        R                  R                  R                  US5      U l        g )NT)superr8   dnsrdataRdata	_as_bytesr|   )r7   r4   r|   	__class__s      r   r8   GenericOption.__init__   s,    IIOO--dD9	r   Nr:   r;   c                 `    U(       a  UR                  U R                  5        g U R                  $ rC   )writer|   r?   s     r   r@   GenericOption.to_wire   "    JJtyy!99r   c                      SU R                    3$ )NzGeneric rv   rD   s    r   rE   GenericOption.to_text   s    $**&&r   c                     U $ rC   r   rD   s    r   rJ   GenericOption.to_generic   s    r   rL   rM   c                 .    U " XR                  5       5      $ rC   get_remainingrO   s      r   rP   GenericOption.from_wire_parser   s     5..011r   )r|   rC   rw   )r   r   r    r!   r"   r   rx   ry   r8   r   r@   rE   rJ   r/   r2   rP   r0   __classcell__r   s   @r   rH   rH      s    :j3. :eck :C$J %$, ' ' 2$2.?2	2 2r   rH   c                      ^  \ rS rSrSrSS\S\S-  S\4U 4S jjjrS\4S	 jr\	S
\S\
4S j5       rSS\S-  S\S-  4S jjr\S\\-  SSS\
4S j5       rSrU =r$ )	ECSOption   z!EDNS Client Subnet (ECS, RFC7871)Naddresssrclenscopelenc                   > [         T	U ]  [        R                  5        [        R
                  R                  U5      nU[        R                  :X  a  SU l	        Uc  Sn[        R                  R                  R                  U5      n[        R                  R                  R                  USS5      n[        R                  R                  R                  USS5      nOU[        R                  :X  a  SU l	        Uc  Sn[        R                  R                  R                  U5      n[        R                  R                  R                  USS5      n[        R                  R                  R                  USS5      nO[!        S	5      eUc   eXl        X l        X0l        [        R
                  R)                  XA5      n[+        [,        R.                  " US
-  5      5      nUSU U l        US-  nUS:w  aN  [2        R4                  " S[7        U R0                  SS 5      SSU-
  -  -  5      nU R0                  SS U-   U l        gg)aZ  *address*, a ``str``, is the client address information.

*srclen*, an ``int``, the source prefix length, which is the
leftmost number of bits of the address to be used for the
lookup.  The default is 24 for IPv4 and 56 for IPv6.

*scopelen*, an ``int``, the scope prefix length.  This value
must be 0 in queries, and should be set in responses.
   N8   r      rS          zBad address family       @r   BrT      )r~   r8   r   r'   r   inetaf_for_addresssocketAF_INET6familyr   r   _as_ipv6_address_as_intAF_INET_as_ipv4_address
ValueErrorr   r   r   	inet_ptonintmathceiladdrdatastructpackord)
r7   r   r   r   afr   nbytesnbitslastr   s
            r   r8   ECSOption.__init__   s    	(XX$$W- DK~iioo66w?GYY__,,VQ<Fyy..xC@H6>>!DK~iioo66w?GYY__,,VQ;Fyy..xB?H122!!! 88%%b2TYYv|,- !&)
A:;;sCbc(:$;tE	?R$STD MM#2.5DM r   r;   c                 T    SU R                    SU R                   SU R                   3$ )NzECS /z scope/)r   r   r   rD   s    r   rE   ECSOption.to_text   s'    dll^1T[[MHHr   textc                 B   SnU R                  5       nSn[        U5      S:X  a  US   nO<[        U5      S:X  a  US   U:w  a  [        SU  S35      eUS   nO[        SU  S35      eUR                  S5      nUS:X  a  UR                  S5      u  pVS	nO*US:X  a  UR                  S5      u  pVnO[        SU  S35      e [	        U5      n [	        U5      n	[        XYU5      $ ! [         a    [        S
SU S3-   5      ef = f! [         a    [        SSU S3-   5      ef = f)a  Convert a string into a `dns.edns.ECSOption`

*text*, a `str`, the text form of the option.

Returns a `dns.edns.ECSOption`.

Examples:

>>> import dns.edns
>>>
>>> # basic example
>>> dns.edns.ECSOption.from_text('1.2.3.4/24')
>>>
>>> # also understands scope
>>> dns.edns.ECSOption.from_text('1.2.3.4/24/32')
>>>
>>> # IPv6
>>> dns.edns.ECSOption.from_text('2001:4b98::1/64/64')
>>>
>>> # it understands results from `dns.edns.ECSOption.to_text()`
>>> dns.edns.ECSOption.from_text('ECS 1.2.3.4/24/32')
r'   NrS   r   r   zcould not parse ECS from ""r   0zinvalid scope z": scope must be an integerzinvalid srclen z": srclen must be an integer)splitlenr   countr   r   )
r   optional_prefixtokensecs_text	n_slashesr   tsrclentscopescoper   s
             r   	from_textECSOption.from_text   s\   0  v;!ayH[AayO+ #=dV1!EFFayH9$qABBNN3'	>'~~c2GF!^'/~~c':$Gf9$qABB	YKE	\F
 %00  	Y-!F8;V0WWXX	Y  	!ay0L$MM 	s   >C! 
D !C>Dr:   c                     [         R                  " SU R                  U R                  U R                  5      U R
                  -   nU(       a  UR                  U5        g U$ )N!HBB)r   r   r   r   r   r   r   r7   r:   values      r   r@   ECSOption.to_wire-  sG    KKT[[$--H4==X 	 JJuLr   r4   rL   rM   c                 |   UR                  S5      u  p4n[        [        R                  " US-  5      5      nUR	                  U5      nUS:X  a+  SU-
  n[
        R                  R                  USU-  -   5      n	O<US:X  a+  SU-
  n[
        R                  R                  USU-  -   5      n	O[        S5      eU " XU5      $ )	Nr   r   rS          r      zunsupported family)

get_structr   r   r   	get_bytesr   ipv4	inet_ntoaipv6r   )
r   r4   rL   r   srcr   addrlenprefixpadaddrs
             r   rP   ECSOption.from_wire_parser7  s     $..v6Udiic	*+!!'*Q;g+C88%%fw}&<=Dq[w,C88%%fw}&<=D1224e$$r   )r   r   r   r   r   rc   rC   )r   r   r    r!   r"   rx   r   r8   rE   staticmethodr2   r   r   ry   r@   r/   r   rP   r0   r   r   s   @r   r   r      s    +-6 -6S4Z -6# -6 -6^I I 41 41 41 41lC$J %$,  %$%.?%	% %r   r   c                       \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr\S 5       rSr g)EDECodeiJ  zExtended DNS Error (EDE) codesr   rS   r   r   r   r	   r
   r   r   r   r   r   r   r      r   r      r                  r   c                     gr   r   r   s    r   r   EDECode._maximumg  r   r   r   N)!r   r   r    r!   r"   OTHERUNSUPPORTED_DNSKEY_ALGORITHMUNSUPPORTED_DS_DIGEST_TYPESTALE_ANSWERFORGED_ANSWERDNSSEC_INDETERMINATEDNSSEC_BOGUSSIGNATURE_EXPIREDSIGNATURE_NOT_YET_VALIDDNSKEY_MISSINGRRSIGS_MISSINGNO_ZONE_KEY_BIT_SETNSEC_MISSINGCACHED_ERROR	NOT_READYBLOCKEDCENSOREDFILTERED
PROHIBITEDSTALE_NXDOMAIN_ANSWERNOT_AUTHORITATIVENOT_SUPPORTEDNO_REACHABLE_AUTHORITYNETWORK_ERRORINVALID_DATAr/   r   r0   r   r   r   r   r   J  s    (E#$ !"LMLNNLLIGHHJMML r   r   c                      ^  \ rS rSrSr1 SkrSS\\-  S\S-  4U 4S jjjrS\4S	 jr	SS
\
S-  S\S-  4S jjr\S\\-  SSS\4S j5       rSrU =r$ )	EDEOptionil  z!Extended DNS Error (EDE, RFC8914)>   DSNSECDNSKEYDNSSECRRSIGsNXDOMAINNcoder   c                    > [         TU ]  [        R                  5        [        R                  U5      U l        Ub   [        U[        5      (       d  [        S5      eX l
        g)z*code*, a ``dns.edns.EDECode`` or ``str``, the info code of the
extended error.

*text*, a ``str`` or ``None``, specifying additional information about
the error.
Nztext must be string or None)r~   r8   r   r-   r   r6   r  r[   rx   r   r   )r7   r  r   r   s      r   r8   EDEOption.__init__q  sI     	(LL&	JtS$9$9:;;	r   r;   c                 0  ^  ST R                    3nT R                   [        ;   aR  [        R                  T R                   5      nSR                  U 4S jUR	                  S5       5       5      nUSU S3-  nT R
                  b  UST R
                   3-  nU$ )NzEDE  c              3   h   >#    U  H'  nUTR                   ;   a  UOUR                  5       v   M)     g 7frC   )_preserve_casetitle).0wordr7   s     r   	<genexpr>$EDEOption.to_text.<locals>.<genexpr>  s0      +D  3 33E+s   /2_z ()z: )r  r   rE   joinr   r   )r7   outputdescs   `  r   rE   EDEOption.to_text  s    		{#99??499-D88  JJsO D 4&l"F99 499+&&Fr   r:   c                     [         R                  " SU R                  5      nU R                  b  X R                  R	                  S5      -  nU(       a  UR                  U5        g U$ )Nz!Hutf8)r   r   r  r   encoder   r   s      r   r@   EDEOption.to_wire  sN    D$)),99 YY%%f--EJJuLr   r4   rL   rM   c                     [         R                  UR                  5       5      nUR                  5       nU(       a   US   S:X  a  US S nUR	                  S5      nOS nU " X55      $ )NrT   r   r   )r   r6   
get_uint16r   decode)r   r4   rL   r  r   btexts         r   rP   EDEOption.from_wire_parser  s`     ||F--/0##%Bx1}CRyKK'EE4r   )r  r   rC   )r   r   r    r!   r"   r  r   rx   r8   rE   r   ry   r@   r/   r   r2   rP   r0   r   r   s   @r   r  r  l  s    +MNWs] #*   	C$J 	%$, 	  $ .? 	   r   r  c                      ^  \ rS rSrS\4U 4S jjrSS\S\S-  4S jjrS\4S jr	\
S	\\-  S
\R                  R                  S\4S j5       rSrU =r$ )
NSIDOptioni  nsidc                 L   > [         TU ]  [        R                  5        Xl        g rC   )r~   r8   r   r#   r*  )r7   r*  r   s     r   r8   NSIDOption.__init__  s    )	r   Nr:   r;   c                 `    U(       a  UR                  U R                  5        g U R                  $ rC   )r   r*  r?   s     r   r@   NSIDOption.to_wire  r   r   c                     [        S U R                   5       5      (       a  U R                  R                  5       nO.[        R                  " U R                  5      R                  5       nSU 3$ )Nc              3   B   #    U  H  oS :  =(       a    US:*  v   M     g7f)r   ~   Nr   )r  cs     r   r  %NSIDOption.to_text.<locals>.<genexpr>  s     :	1Dy&Q$Y&	s   zNSID )allr*  r%  binasciihexlify)r7   r   s     r   rE   NSIDOption.to_text  sR    :		:::II$$&E$$TYY/668Eugr   r4   rL   c                 .    U " UR                  5       5      $ rC   r   rO   s      r   rP   NSIDOption.from_wire_parser  s     6'')**r   )r*  rC   r   r   r    r!   ry   r8   r   r@   rx   rE   r/   r   r   rI   Parserr2   rP   r0   r   r   s   @r   r)  r)    sk    U C 54<   +$+.1hhoo+	+ +r   r)  c                      ^  \ rS rSrS\S\4U 4S jjrSS\S\S-  4S jjrS\4S	 jr	\
S
\\-  S\R                  R                  S\4S j5       rSrU =r$ )CookieOptioni  clientserverc                    > [         TU ]  [        R                  5        Xl        X l        [        U5      S:w  a  [        S5      e[        U5      S:w  a*  [        U5      S:  d  [        U5      S:  a  [        S5      eg g )Nr   zclient cookie must be 8 bytesr   r   z5server cookie must be empty or between 8 and 32 bytes)r~   r8   r   r)   r>  r?  r   r   )r7   r>  r?  r   s      r   r8   CookieOption.__init__  sn    **+v;!<==v;!VqCK"4DTUU 5Er   Nr:   r;   c                     U(       aP  UR                  U R                  5        [        U R                  5      S:  a  UR                  U R                  5        g U R                  U R                  -   $ rc   )r   r>  r   r?  r?   s     r   r@   CookieOption.to_wire  sL    JJt{{#4;;!#

4;;';;,,r   c                     [         R                  " U R                  5      R                  5       n[	        U R
                  5      S:  a/  [         R                  " U R
                  5      R                  5       nOSnSU U 3$ )Nr    zCOOKIE )r5  r6  r>  r%  r   r?  )r7   r>  r?  s      r   rE   CookieOption.to_text  sc    !!$++.557t{{a%%dkk299;FF))r   r4   rL   c                 N    U " UR                  S5      UR                  5       5      $ )Nr   )r   r   rO   s      r   rP   CookieOption.from_wire_parser  s%     6##A&(<(<(>??r   )r>  r?  rC   r:  r   s   @r   r=  r=    sz    Vu Ve V-C -54< -* * @$@.1hhoo@	@ @r   r=  c                      ^  \ rS rSrS\R
                  R                  4U 4S jjrSS\S\	S-  4S jjr
S\4S jr\S	\\-  S
\R                  R                   S\4S j5       rSrU =r$ )ReportChannelOptioni  agent_domainc                 L   > [         TU ]  [        R                  5        Xl        g rC   )r~   r8   r   r.   rK  )r7   rK  r   s     r   r8   ReportChannelOption.__init__  s    112(r   Nr:   r;   c                 8    U R                   R                  U5      $ rC   )rK  r@   r?   s     r   r@   ReportChannelOption.to_wire  s      ((..r   c                 <    SU R                   R                  5       -   $ )NzREPORTCHANNEL )rK  rE   rD   s    r   rE   ReportChannelOption.to_text  s    $"3"3";";"===r   r4   rL   c                 .    U " UR                  5       5      $ rC   )get_namerO   s      r   rP   $ReportChannelOption.from_wire_parser  s     6??$%%r   )rK  rC   )r   r   r    r!   r   nameNamer8   r   ry   r@   rx   rE   r/   r   rI   r;  r2   rP   r0   r   r   s   @r   rJ  rJ    ss    )SXX]] )/C /54< /> > &$&.1hhoo&	& &r   rJ  _type_to_classr4   r;   c                 B    [         R                  U 5      nUc  [        nU$ )zxReturn the class for the specified option type.

The GenericOption class is used if a more specific class is not
known.
)rW  getrH   )r4   r   s     r   get_option_classrZ    s#     

U
#C
{Jr   rL   rM   c                 d    [         R                  U 5      n [        U 5      nUR                  X5      $ )zBuild an EDNS option object from wire format.

*otype*, an ``int``, is the option type.

*parser*, a ``dns.wire.Parser``, the parser, which should be
restricted to the option length.

Returns an instance of a subclass of ``dns.edns.Option``.
)r   r6   rZ  rP   )r4   rL   r   s      r   option_from_wire_parserr\    s-     OOE"E
5
!C..r   rI   currentolenc                     [         R                  R                  X5      nUR                  U5         [	        X5      sSSS5        $ ! , (       d  f       g= f)aV  Build an EDNS option object from wire format.

*otype*, an ``int``, is the option type.

*wire*, a ``bytes``, is the wire-format message.

*current*, an ``int``, is the offset in *wire* of the beginning
of the rdata.

*olen*, an ``int``, is the length of the wire-format option data

Returns an instance of a subclass of ``dns.edns.Option``.
N)r   rI   r;  restrict_tor\  )r4   rI   r]  r^  rL   s        r   option_from_wirera     s8      XX__T+F			D	!&u5 
"	!	!s   A
Aimplementationc                     U [         U'   g)zRegister the implementation of an option type.

*implementation*, a ``class``, is a subclass of ``dns.edns.Option``.

*otype*, an ``int``, is the option type.
N)rW  )rb  r4   s     r   register_typerd  5  s     +N5r   )0r"   r5  r   r   r   typingr   r   dns.enumr   dns.inetdns.ipv4dns.ipv6dns.name	dns.rdatadns.wireenumIntEnumr   r2   rH   r   r   r  r)  r=  rJ  r'   r-   r#   r)   r.   rW  __annotations__rZ  rx   r\  ry   r   ra  rd  r$   r%   r&   r(   r*   r+   r,   r   r   r   <module>rp     s  $             !! B[ [|2F 2>F% F%Rchh D:  : z+ +6@6 @D&& &( NNINNIOOZ|1)Z_% 
J 
3 
//%6//"66#(6366>A66*+# +j +T + nnnnnnnn						  	


nn((r   