Ë
    ¶�/jS1  ã                   ó²  — d Z ddlZddlZddlmZmZ ddlZddlZddl	Zddl
ZddlZddlZej                  j                  hZej                  j                   ej                  j"                  ej                  j$                  hZd„ Zej*                   G d„ dej,                  «      «       Z G d„ d«      Zej2                  j2                   G d	„ d
e«      «       Zy)z)DNS nodes.  A node is a set of rdatasets.é    N)ÚAnyÚDictc                 óT   — || v xs# |t         j                  j                  k(  xr || v S ©N)ÚdnsÚ	rdatatypeÚRRSIG)ÚrdtypesÚrdtypeÚcoverss      úJC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\dns/node.pyÚ_matches_type_or_its_signaturer   +   s+   € Ø�WÐÒU ¬3¯=©=×+>Ñ+>Ñ!>Ò!TÀ6ÈWÐCTÐUó    c                   óÌ   — e Zd ZdZdZdZdZedej                  j                  dej                  j                  dd fd„«       Zed	ej                  j                  dd fd
„«       Zy)ÚNodeKindzRdatasets in nodesr   é   é   r   r   Úreturnc                 ó¦   — t        t        ||«      rt        j                  S t        t        ||«      rt        j
                  S t        j                  S r   )r   Ú_cname_typesr   ÚCNAMEÚ_neutral_typesÚNEUTRALÚREGULAR)Úclsr   r   s      r   ÚclassifyzNodeKind.classify7   s>   € ô *¬,¸ÀÔGÜ—>‘>Ð!Ü+¬N¸FÀFÔKÜ×#Ñ#Ð#ä×#Ñ#Ð#r   Úrdatasetc                 óN   — | j                  |j                  |j                  «      S r   )r   r   r   )r   r   s     r   Úclassify_rdatasetzNodeKind.classify_rdatasetB   s   € à�|‰|˜HŸO™O¨X¯_©_Ó=Ð=r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úclassmethodr   r   Ú	RdataTyper   r   ÚRdatasetr   © r   r   r   r   /   s~   „ áà€GØ€GØ€Eàð$Ø—]‘]×,Ñ,ð$Ø69·m±m×6MÑ6Mð$à	ò$ó ð$ð ð>¨¯©×)>Ñ)>ð >À:ò >ó ñ>r   r   c                   ól  — e Zd ZdZdgZd„ Zdej                  j                  de	e
ef   de
fd„Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zej&                  j(                  dfdej*                  j,                  dej&                  j.                  dej&                  j.                  dedej2                  j4                  f
d„Zej&                  j(                  dfdej*                  j,                  dej&                  j.                  dej&                  j.                  dedej2                  j4                  dz  f
d„Zej&                  j(                  fdej*                  j,                  dej&                  j.                  dej&                  j.                  ddfd„Zdej2                  j4                  ddfd„Zdefd„Z defd„Z!y)ÚNodeaÖ  A Node is a set of rdatasets.

    A node is either a CNAME node or an "other data" node.  A CNAME
    node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their
    covering RRSIG rdatasets.  An "other data" node contains any
    rdataset other than a CNAME or RRSIG(CNAME) rdataset.  When
    changes are made to a node, the CNAME or "other data" state is
    always consistent with the update, i.e. the most recent change
    wins.  For example, if you have a node which contains a CNAME
    rdataset, and then add an MX rdataset to it, then the CNAME
    rdataset will be deleted.  Likewise if you have a node containing
    an MX rdataset and add a CNAME rdataset, the MX rdataset will be
    deleted.
    Ú	rdatasetsc                 ó   — g | _         y r   ©r*   ©Úselfs    r   Ú__init__zNode.__init__Y   s	   € àˆ�r   ÚnameÚkwr   c                 óö   — t        j                  «       }| j                  D ]D  }t        |«      dkD  sŒ|j	                   |j
                  |fi |¤Ž«       |j	                  d«       ŒF |j                  «       dd S )a"  Convert a node to text format.

        Each rdataset at the node is printed.  Any keyword arguments
        to this method are passed on to the rdataset's to_text() method.

        *name*, a ``dns.name.Name``, the owner name of the
        rdatasets.

        Returns a ``str``.

        r   Ú
Néÿÿÿÿ)ÚioÚStringIOr*   ÚlenÚwriteÚto_textÚgetvalue)r.   r0   r1   ÚsÚrdss        r   r9   zNode.to_text]   sd   € ô �K‰K‹MˆØ—>”>ˆCÜ�3‹x˜!‹|Ø—‘˜˜Ÿ™ DÑ/¨BÑ/Ô0Ø—‘˜•ð "ð �z‰z‹|˜C˜RÐ Ð r   c                 ó6   — dt        t        | «      «      z   dz   S )Nz
<DNS node Ú>)ÚstrÚidr-   s    r   Ú__repr__zNode.__repr__q   s   € Øœc¤" T£(›mÑ+¨cÑ1Ð1r   c                 óˆ   — | j                   D ]  }||j                   vsŒ y |j                   D ]  }|| j                   vsŒ y y)NFTr,   )r.   ÚotherÚrds      r   Ú__eq__zNode.__eq__t   sE   € ð —.”.ˆBØ˜Ÿ™Ò(Ùð !ð —/”/ˆBØ˜Ÿ™Ò'Ùð "ð r   c                 ó&   — | j                  |«       S r   )rE   )r.   rC   s     r   Ú__ne__zNode.__ne__€   s   € Ø—;‘;˜uÓ%Ð%Ð%r   c                 ó,   — t        | j                  «      S r   )r7   r*   r-   s    r   Ú__len__zNode.__len__ƒ   s   € Ü�4—>‘>Ó"Ð"r   c                 ó,   — t        | j                  «      S r   )Úiterr*   r-   s    r   Ú__iter__zNode.__iter__†   s   € Ü�D—N‘NÓ#Ð#r   c                 ó
  — t        | j                  «      dkD  rÆt        j                  |«      }|t        j                  k(  rF| j                  D �cg c]*  }t        j                  |«      t        j
                  k7  r|‘Œ, c}| _        nX|t        j
                  k(  rE| j                  D �cg c]*  }t        j                  |«      t        j                  k7  r|‘Œ, c}| _        | j                  j                  |«       yc c}w c c}w )a†  Append rdataset to the node with special handling for CNAME and
        other data conditions.

        Specifically, if the rdataset being appended has ``NodeKind.CNAME``,
        then all rdatasets other than KEY, NSEC, NSEC3, and their covering
        RRSIGs are deleted.  If the rdataset being appended has
        ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted.
        r   N)r7   r*   r   r   r   r   Úappend)r.   r   Úkindr<   s       r   Ú_append_rdatasetzNode._append_rdataset‰   sÙ   € ô ˆt�~‰~Ó Ò"Ü×-Ñ-¨hÓ7ˆDØ”x—~‘~Ò%ð  $Ÿ~š~ó"á-˜Ü×1Ñ1°#Ó6¼(×:JÑ:JÒJò Ø-ñ"�•ð
 œ×)Ñ)Ò)ð  $Ÿ~š~ó"á-˜Ü×1Ñ1°#Ó6¼(¿.¹.ÒHò Ø-ñ"�”ð 	�‰×Ñ˜hÕ'ùò"ùò"s   Á/C;Â(/D FÚrdclassr   r   Úcreatec                 óÊ   — | j                   D ]  }|j                  |||«      sŒ|c S  |st        ‚t        j                  j                  |||«      }| j                  |«       |S )a*  Find an rdataset matching the specified properties in the
        current node.

        *rdclass*, a ``dns.rdataclass.RdataClass``, the class of the rdataset.

        *rdtype*, a ``dns.rdatatype.RdataType``, the type of the rdataset.

        *covers*, a ``dns.rdatatype.RdataType``, the covered type.
        Usually this value is ``dns.rdatatype.NONE``, but if the
        rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``,
        then the covers value will be the rdata type the SIG/RRSIG
        covers.  The library treats the SIG and RRSIG types as if they
        were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).
        This makes RRSIGs much easier to work with than if RRSIGs
        covering different rdata types were aggregated into a single
        RRSIG rdataset.

        *create*, a ``bool``.  If True, create the rdataset if it is not found.

        Raises ``KeyError`` if an rdataset of the desired type and class does
        not exist and *create* is not ``True``.

        Returns a ``dns.rdataset.Rdataset``.
        )r*   ÚmatchÚKeyErrorr   r   r&   rP   ©r.   rQ   r   r   rR   r<   s         r   Úfind_rdatasetzNode.find_rdataset¥   s]   € ð@ —>”>ˆCØ�y‰y˜ &¨&Õ1Ø’
ð "ñ ÜˆNÜ�l‰l×#Ñ# G¨V°VÓ<ˆØ×Ñ˜cÔ"Øˆ
r   Nc                 óT   — 	 | j                  ||||«      }|S # t        $ r d}Y |S w xY w)aç  Get an rdataset matching the specified properties in the
        current node.

        None is returned if an rdataset of the specified type and
        class does not exist and *create* is not ``True``.

        *rdclass*, an ``int``, the class of the rdataset.

        *rdtype*, an ``int``, the type of the rdataset.

        *covers*, an ``int``, the covered type.  Usually this value is
        dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or
        dns.rdatatype.RRSIG, then the covers value will be the rdata
        type the SIG/RRSIG covers.  The library treats the SIG and RRSIG
        types as if they were a family of
        types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).  This makes RRSIGs much
        easier to work with than if RRSIGs covering different rdata
        types were aggregated into a single RRSIG rdataset.

        *create*, a ``bool``.  If True, create the rdataset if it is not found.

        Returns a ``dns.rdataset.Rdataset`` or ``None``.
        N)rW   rU   rV   s         r   Úget_rdatasetzNode.get_rdatasetÎ   s?   € ð>	Ø×$Ñ$ W¨f°f¸fÓEˆCð ˆ
øô ò 	Ø‰CØˆ
ð	ús   ‚ ˜'¦'c                 óf   — | j                  |||«      }|�| j                  j                  |«       yy)aD  Delete the rdataset matching the specified properties in the
        current node.

        If a matching rdataset does not exist, it is not an error.

        *rdclass*, an ``int``, the class of the rdataset.

        *rdtype*, an ``int``, the type of the rdataset.

        *covers*, an ``int``, the covered type.
        N)rY   r*   Úremove)r.   rQ   r   r   r<   s        r   Údelete_rdatasetzNode.delete_rdatasetó   s4   € ð$ ×Ñ ¨°Ó8ˆØˆ?Ø�N‰N×!Ñ! #Õ&ð r   Úreplacementc                 óN  — t        |t        j                  j                  «      st	        d«      ‚t        |t        j
                  j                  «      r|j                  «       }| j                  |j                  |j                  |j                  «       | j                  |«       y)aÅ  Replace an rdataset.

        It is not an error if there is no rdataset matching *replacement*.

        Ownership of the *replacement* object is transferred to the node;
        in other words, this method does not store a copy of *replacement*
        at the node, it stores *replacement* itself.

        *replacement*, a ``dns.rdataset.Rdataset``.

        Raises ``ValueError`` if *replacement* is not a
        ``dns.rdataset.Rdataset``.
        zreplacement is not an rdatasetN)Ú
isinstancer   r   r&   Ú
ValueErrorÚrrsetÚRRsetÚto_rdatasetr\   rQ   r   r   rP   ©r.   r]   s     r   Úreplace_rdatasetzNode.replace_rdataset	  s}   € ô ˜+¤s§|¡|×'<Ñ'<Ô=ÜÐ=Ó>Ð>Ü�k¤3§9¡9§?¡?Ô3ð &×1Ñ1Ó3ˆKØ×ÑØ×Ñ ×!3Ñ!3°[×5GÑ5Gô	
ð 	×Ñ˜kÕ*r   c                 óÆ   — | j                   D ]C  }t        j                  |j                  |j                  «      }|t        j
                  k7  sŒA|c S  t        j
                  S )aT  Classify a node.

        A node which contains a CNAME or RRSIG(CNAME) is a
        ``NodeKind.CNAME`` node.

        A node which contains only "neutral" types, i.e. types allowed to
        co-exist with a CNAME, is a ``NodeKind.NEUTRAL`` node.  The neutral
        types are NSEC, NSEC3, KEY, and their associated RRSIGS.  An empty node
        is also considered neutral.

        A node which contains some rdataset which is not a CNAME, RRSIG(CNAME),
        or a neutral type is a a ``NodeKind.REGULAR`` node.  Regular nodes are
        also commonly referred to as "other data".
        )r*   r   r   r   r   r   )r.   r   rO   s      r   r   zNode.classify#  sM   € ð ŸœˆHÜ×$Ñ$ X§_¡_°h·o±oÓFˆDØ”x×'Ñ'Ó'Ø’ð 'ô ×ÑÐr   c                  ó   — y)NFr'   r-   s    r   Úis_immutablezNode.is_immutable8  s   € Ør   )"r    r!   r"   r#   Ú	__slots__r/   r   r0   ÚNamer   r?   r   r9   rA   rE   rG   rI   rL   rP   r   ÚNONEÚ
rdataclassÚ
RdataClassr%   Úboolr   r&   rW   rY   r\   re   r   r   rh   r'   r   r   r)   r)   G   sÐ  „ ñð �€Iòð!˜CŸH™HŸM™Mð !°°c¸3°h±ð !ÀCó !ò(2ò
ò&ò#ò$ò(ð@ +.¯-©-×*<Ñ*<Øñ'à—‘×*Ñ*ð'ð —‘×'Ñ'ð'ð —‘×'Ñ'ð	'ð
 ð'ð 
�‰×	Ñ	ó'ðZ +.¯-©-×*<Ñ*<Øñ#à—‘×*Ñ*ð#ð —‘×'Ñ'ð#ð —‘×'Ñ'ð	#ð
 ð#ð 
�‰×	Ñ	 Ñ	%ó#ðR +.¯-©-×*<Ñ*<ñ	'à—‘×*Ñ*ð'ð —‘×'Ñ'ð'ð —‘×'Ñ'ð	'ð
 
ó'ð,+¨C¯L©L×,AÑ,Að +Àdó +ð4 ˜(ó  ð*˜dô r   r)   c                   ó   ‡ — e Zd Zˆ fd„Zej
                  j                  dfdej                  j                  dej
                  j                  dej
                  j                  de
dej                  j                  f
ˆ fd„Zej
                  j                  dfdej                  j                  dej
                  j                  dej
                  j                  de
dej                  j                  d	z  f
ˆ fd
„Zej
                  j                  fdej                  j                  dej
                  j                  dej
                  j                  dd	fd„Zdej                  j                  dd	fd„Zde
fd„Zˆ xZS )ÚImmutableNodec                 ó¶   •— t         ‰| �  «        t        |j                  D �cg c]!  }t        j
                  j                  |«      ‘Œ# c}«      | _        y c c}w r   )Úsuperr/   Útupler*   r   r   ÚImmutableRdataset)r.   Únoder<   Ú	__class__s      €r   r/   zImmutableNode.__init__>  sB   ø€ Ü‰ÑÔÜØ<@¿NºNÓK¹N°SŒS�\‰\×+Ñ+¨CÕ0¸NÑKó
ˆ�ùÚKs   £&AFrQ   r   r   rR   r   c                 óB   •— |rt        d«      ‚t        ‰| �	  |||d«      S ©NÚ	immutableF)Ú	TypeErrorrr   rW   ©r.   rQ   r   r   rR   rv   s        €r   rW   zImmutableNode.find_rdatasetD  s)   ø€ ñ Ü˜KÓ(Ð(Ü‰wÑ$ W¨f°f¸eÓDÐDr   Nc                 óB   •— |rt        d«      ‚t        ‰| �	  |||d«      S rx   )rz   rr   rY   r{   s        €r   rY   zImmutableNode.get_rdatasetO  s)   ø€ ñ Ü˜KÓ(Ð(Ü‰wÑ# G¨V°V¸UÓCÐCr   c                 ó   — t        d«      ‚©Nry   ©rz   )r.   rQ   r   r   s       r   r\   zImmutableNode.delete_rdatasetZ  s   € ô ˜Ó$Ð$r   r]   c                 ó   — t        d«      ‚r~   r   rd   s     r   re   zImmutableNode.replace_rdatasetb  s   € Ü˜Ó$Ð$r   c                  ó   — y)NTr'   r-   s    r   rh   zImmutableNode.is_immutablee  s   € Ør   )r    r!   r"   r/   r   r   rk   rl   rm   r%   rn   r   r&   rW   rY   r\   re   rh   Ú__classcell__)rv   s   @r   rp   rp   <  sx  ø„ ô
ð +.¯-©-×*<Ñ*<Øñ	Eà—‘×*Ñ*ð	Eð —‘×'Ñ'ð	Eð —‘×'Ñ'ð		Eð
 ð	Eð 
�‰×	Ñ	õ	Eð +.¯-©-×*<Ñ*<Øñ	Dà—‘×*Ñ*ð	Dð —‘×'Ñ'ð	Dð —‘×'Ñ'ð		Dð
 ð	Dð 
�‰×	Ñ	 Ñ	%õ	Dð +.¯-©-×*<Ñ*<ñ	%à—‘×*Ñ*ð%ð —‘×'Ñ'ð%ð —‘×'Ñ'ð	%ð
 
ó%ð%¨C¯L©L×,AÑ,Að %Àdó %ð˜d÷ r   rp   )r#   Úenumr5   Útypingr   r   Údns.immutabler   Údns.nameÚdns.rdataclassÚdns.rdatasetÚdns.rdatatypeÚ	dns.rrsetr   r   r   ÚNSECÚNSEC3ÚKEYr   r   ÚuniqueÚEnumr   r)   ry   rp   r'   r   r   Ú<module>r�      sÆ   ðñ$ 0ã Û 	ß ã Û Û Û Û Û ð ‡M�M×Ñð€ð ‡M�M×ÑØ‡M�M×ÑØ‡M�M×Ñð€òVð ‡�ô>ˆt�y‰yó >ó ð>÷.rñ rðj ‡�×Ñô)�Dó )ó ñ)r   