%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dns/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dns/__pycache__/resolver.cpython-312.pyc

�

5��eP��
�UdZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl$ZejJdk(rddl&ZGd�dejNjP�Z)Gd�d	ejNjP�Z*ee
e+e,e-ee.e+fe
ej^j`fZ1d
ee1dee+fd�Z2Gd
�dejNjf�Z4e4Z3Gd�dejNjP�Z5Gd�dejNjP�Z6Gd�dejNjP�Z7Gd�dejNjP�Z8Gd�dejNjP�Z9Gd�dejNjP�Z:Gd�d�Z;Gd�de<�Z=Gd�d e=�Z>Gd!�d"�Z?Gd#�d$�Z@eej�j�ej�j�ej�j�fZGGd%�d&e@�ZHGd'�d(�ZIGd)�d*e@�ZJGd+�d,�ZKGd-�d.�ZLGd/�d0eL�ZMdaNe
eMeOd1<deMfd2�ZPdYd3�ZQej�j�ej�j�d4dd5dddfd6eej�j�e+fd7eej�j�e+fd8eej�j�e+fd9e,d:e
e+d;e,d<e-d=e
eTd>e
e,de;fd?�ZUej�j�ej�j�d4dd5ddfd6eej�j�e+fd7eej�j�e+fd8eej�j�e+fd9e,d:e
e+d;e,d<e-d=e
eTde;fd@�ZVdAe+dBe	dCe	de;fdD�ZWej�fdEeej�j�e+fdFe-dCe	de>fdG�ZYdEeej�j�e+fdej�j�fdH�ZZdZd=eTddfdI�Z[ej�j�d4ddfdEeej�j�e+fd8ej�j�d9e,dJe
eMd=e
eTdej�j�fdK�Z\dLej�dfdMeej�j�e+fdNe-dFe-dJe
eMdeMf
dO�Z]ej�j�ej�j�d4dd5ddddLej�dfdMeej�j�e+fd6eej�j�e+fd7eej�j�e+fd8eej�j�e+fd9e,d:e
e+d;e,d<e-d=e
eTd>e
e,dNe-dFe-dJe
eMde;fdP�Z^ej�ej�gej�ej�giZcdadej�Zfej�Zhej�Zjej�Zlej�Znej�Zpddej�dddfdQ�Zqd[dR�Zrd\dS�ZsdT�ZtdU�ZudV�Zvd\dJe
eMddfdW�ZwdYdX�Zxy)]�DNS stub resolver.�N)�Any�Dict�Iterator�List�Optional�Sequence�Tuple�Union)�urlparse�win32c�n��eZdZdZddhZdZ�fd�Zdd�Zdef�fd�Z	e
d	��Zd
�Zd�Z
d�Zd
�Z�xZS)�NXDOMAINz"The DNS query name does not exist.�qnames�	responsesNc�$��t�|�|i|��y�N��super�__init__��self�args�kwargs�	__class__s   ��./usr/lib/python3/dist-packages/dns/resolver.pyrzNXDOMAIN.__init__>����
���$�)�&�)�c���t|tttf�st	d��t|�dk(rt	d��|�i}nt|t�st	d��t
||��}|S)Nz#qnames must be a list, tuple or setrz(qnames must contain at least one elementz(responses must be a dict(qname=response)�rr)�
isinstance�list�tuple�set�AttributeError�len�dict)rrrrs    r�
_check_kwargszNXDOMAIN._check_kwargsAsi���&�4���"4�5� �!F�G�G��v�;�!�� �!K�L�L����I��I�t�,� �!K�L�L��V�y�9���
r�returnc����d|jvrt�|�	�S|jd}t|�dkDrd}nd}dj	tt|��}dj||�S)Nr�zNone of DNS query names existz!The DNS query name does not existz, z{}: {})rr�__str__r&�join�map�str�format)rr�msgrs   �rr,zNXDOMAIN.__str__Mse����4�;�;�&��7�?�$�$����X�&���v�;��?�1�C�5�C����3�s�F�+�,�����s�F�+�+rc��d|jvrtd��|jdD].}|jd|}	|j�}||k7r|cS�0|jddS#t$rY�NwxYw)z%Return the unresolved canonical name.rzparametrized exception requiredrr)r�	TypeError�canonical_name�	Exception)r�qname�response�cnames    rr4zNXDOMAIN.canonical_nameXs����4�;�;�&��=�>�>��[�[��*�		�E��{�{�;�/��6�H�
� �/�/�1���E�>� �L�"�			��{�{�8�$�Q�'�'��	�
��
�s�A,�,	A8�7A8c�n�t|jjdg��}t|jjdi��}|jjdi�}|jjdg�D]$}||vr|j	|�||vs�||||<�&t||��S)z3Augment by results from another NXDOMAIN exception.rrr )r"r�getr'�appendr)r�e_nx�qnames0�
responses0�
responses1�qname1s      r�__add__zNXDOMAIN.__add__is����t�{�{���x��4�5���$�+�+�/�/�+�r�:�;�
��[�[�_�_�[�"�5�
��k�k�o�o�h��3�	8�F��W�$����v�&���#�%/��%7�
�6�"�		8�
�w�*�=�=rc� �|jdS)zXAll of the names that were tried.

        Returns a list of ``dns.name.Name``.
        r�r�rs rrzNXDOMAIN.qnamesus��
�{�{�8�$�$rc� �|jdS)z�A map from queried names to their NXDOMAIN responses.

        Returns a dict mapping a ``dns.name.Name`` to a
        ``dns.message.Message``.
        rrCrDs rrzNXDOMAIN.responses|s���{�{�;�'�'rc�&�|jd|S)zTThe response for query *qname*.

        Returns a ``dns.message.Message``.
        rrC)rr6s  rr7zNXDOMAIN.response�s��
�{�{�;�'��.�.rr)�__name__�
__module__�__qualname__�__doc__�supp_kwargs�fmtrr(r/r,�propertyr4rArrr7�
__classcell__�rs@rrr4sS���,��[�)�K�
�C�*�
�	,��	,��(��(� 
>�%�(�/rrc��eZdZdZy)�YXDOMAINz8The DNS query name is too long after DNAME substitution.N�rGrHrIrJ�rrrQrQ�s��BrrQ�errorsr)c�f�g}|D])}|jdj|d|d���+|S)z3Turn a resolution errors trace into a list of text.zServer {} answered {}r�)r;r0)rT�texts�errs   r�_errors_to_textrY�s?���E��E��
���,�3�3�C��F�C��F�C�D�E��Lrc�H��eZdZdZdZdeddzZddhZ�fd�Z�fd�Z�xZ	S)	�LifetimeTimeoutz The resolution lifetime expired.z(%s after {timeout:.3f} seconds: {errors}N����timeoutrTc�$��t�|�|i|��yrrrs   �rrzLifetimeTimeout.__init__�rrc�f��t|d�}t�|�	|ddj|���S)NrTr]�; �r]rT)rYr�_fmt_kwargsr-�rr�srv_msgsrs   �rrbzLifetimeTimeout._fmt_kwargs�s<���"�6�(�#3�4���w�"��9�%�d�i�i��.A�#�
�	
r�
rGrHrIrJr1rLrKrrbrNrOs@rr[r[�s4���*�
,�C�
4�s�3�B�x�
?�C��h�'�K�*�
�
rr[c�<��eZdZdZdZdhZ�fd�Z�fd�Zd�Z�xZ	S)�NoAnswerz<The DNS response does not contain an answer to the question.zDThe DNS response does not contain an answer to the question: {query}r7c�$��t�|�|i|��yrrrs   �rrzNoAnswer.__init__�rrc�>��t�|�|dj��S)Nr7)�query)rrb�question)rrrs  �rrbzNoAnswer._fmt_kwargs�s!����w�"��
�);�)D�)D�"�E�Erc� �|jdS)Nr7rCrDs rr7zNoAnswer.response�s���{�{�:�&�&r)
rGrHrIrJrLrKrrbr7rNrOs@rrgrg�s"���F�
P�C��,�K�*�F�'rrgc�H��eZdZdZdZdeddzZddhZ�fd�Z�fd	�Z�xZ	S)
�
NoNameserversz�All nameservers failed to answer the query.

    errors: list of servers and respective errors
    The type of errors is
    [(server IP address, any object convertible to string)].
    Non-empty errors list will add explanatory message ()
    z+All nameservers failed to answer the query.z%s {query}: {errors}Nr\�requestrTc�$��t�|�|i|��yrrrs   �rrzNoNameservers.__init__�rrc�z��t|d�}t�|�	|djdj	|���S)NrTror`)rjrT)rYrrbrkr-rcs   �rrbzNoNameservers._fmt_kwargs�sB���"�6�(�#3�4���w�"���#�,�,�T�Y�Y�x�5H�#�
�	
rrerOs@rrnrn�s8����8�C�
 �3�s��8�
+�C��h�'�K�*�
�
rrnc��eZdZdZy)�NotAbsolutezEAn absolute domain name is required but a relative name was provided.NrRrSrrrsrs����Orrsc��eZdZdZy)�	NoRootSOAzBThere is no SOA RR at the DNS root name. This should never happen!NrRrSrrrvrv�s��Lrrvc��eZdZdZy)�
NoMetaqueriesz DNS metaqueries are not allowed.NrRrSrrrxrx�s��*rrxc��eZdZdZy)�NoResolverConfigurationzEResolver configuration could not be read or specified no nameservers.NrRrSrrrzrz�rtrrzc�
�eZdZdZ		ddej
jdejjdejjdejjde
ede
ed	dfd
�Zd�Zd	efd�Zd
�Zd�Zd�Zy)�Answera&DNS stub resolver answer.

    Instances of this class bundle up the result of a successful DNS
    resolution.

    For convenience, the answer object implements much of the sequence
    protocol, forwarding to its ``rrset`` attribute.  E.g.
    ``for a in answer`` is equivalent to ``for a in answer.rrset``.
    ``answer[i]`` is equivalent to ``answer.rrset[i]``, and
    ``answer[i:j]`` is equivalent to ``answer.rrset[i:j]``.

    Note that CNAMEs or DNAMEs in the response may mean that answer
    RRset's name might not be the query name.
    Nr6�rdtype�rdclassr7�
nameserver�portr)c�N�||_||_||_||_||_||_|j
�|_|jj|_|jj|_
tj�|jjz|_
yr)r6r}r~r7rr��resolve_chaining�chaining_resultr4�answer�rrset�time�minimum_ttl�
expiration)rr6r}r~r7rr�s       rrzAnswer.__init__s�����
������� ��
�$�����	�'�8�8�:���#�2�2�A�A����)�)�0�0��
��)�)�+��(<�(<�(H�(H�H��rc�&�|dk(r|jjS|dk(r|jjS|dk(r|jjS|dk(r|jjS|dk(r|jj
St
|��)N�name�ttl�coversr~r})r�r�r�r�r~r}r%)r�attrs  r�__getattr__zAnswer.__getattr__s���6�>��:�:�?�?�"�
�U�]��:�:�>�>�!�
�X�
��:�:�$�$�$�
�Y�
��:�:�%�%�%�
�X�
��:�:�$�$�$� ��&�&rc�P�|jxrt|j�xsdS�Nr)r�r&rDs r�__len__zAnswer.__len__)s���z�z�-�c�$�*�*�o�2��2rc�r�|jxrt|j�xstt��Sr)r��iterr#rDs r�__iter__zAnswer.__iter__,s%���z�z�.�d�4�:�:�.�?�$�u�w�-�?rc�D�|j�t�|j|Sr�r��
IndexError�r�is  r�__getitem__zAnswer.__getitem__/s ���:�:�����z�z�!�}�rc�B�|j�t�|j|=yrr�r�s  r�__delitem__zAnswer.__delitem__4s���:�:�����J�J�q�Mr�NN)rGrHrIrJ�dnsr��Name�	rdatatype�	RdataType�
rdataclass�
RdataClass�message�QueryMessagerr/�intrr�r�r�r�r�rSrrr|r|�s���
�*%)�"�I��x�x�}�}�I��
�
�'�'�I����*�*�	I�
�+�+�*�*�I��S�M�
I��s�m�I�
�I�,'�3��3�@��
rr|c��eZdZdZy)�Answersz5A dict of DNS stub resolver answers, indexed by type.NrRrSrrr�r�:s��?rr�c
���eZdZdZe			ddeedeededdfd��Ze	jfdedee
eeffd	�Ze	jfdedeefd
�Zdej$j&fd�Zy)
�HostAnswerszTA dict of DNS stub resolver answers to a host name lookup, indexed by
    type.
    N�v6�v4�	add_emptyr)c���t�}|�+|s|jr||tjj<|�+|s|jr||tjj
<|Sr)r�r�r�r��AAAA�A)�clsr�r�r��answerss     r�makezHostAnswers.makeCsP���-��
�>�y�B�H�H�*,�G�C�M�M�&�&�'�
�>�y�B�H�H�')�G�C�M�M�O�O�$��r�familyc#�K�|tjk(rO|jtj�Ed{���|jtj�Ed{���y|tjk(r*|jtjj�}nK|tjk(r*|jtjj�}ntd|����|r|D]}|j|f���yy7��7���w)N�unknown address family )�socket�	AF_UNSPEC�addresses_and_families�AF_INET6�AF_INETr:r�r�r�r��NotImplementedError�address)rr�r��rdatas    rr�z"HostAnswers.addresses_and_familiesSs������V�%�%�%��2�2�6�?�?�C�C�C��2�2�6�>�>�B�B�B��
�v���
&��X�X�c�m�m�0�0�1�F�
�v�~�~�
%��X�X�c�m�m�o�o�.�F�%�(?��x�&H�I�I���
.���}�}�f�-�-�
.��
D��B�s"�6D�D�&D�D
� B)D�
Dc�2�d�|j|�D�S)Nc3�&K�|]	}|d���y�w)rNrS)�.0�pairs  r�	<genexpr>z(HostAnswers.addresses.<locals>.<genexpr>gs����H�D��Q��H�s�)r�)rr�s  r�	addresseszHostAnswers.addressesfs��H�D�$?�$?��$G�H�Hrc��|jtjj|jtjj��}|j
Sr)r:r�r�r�r�r4)rr�s  rr4zHostAnswers.canonical_namejs9�����#�-�-�,�,�d�h�h�s�}�}���.G�H���$�$�$r)NNT)rGrHrIrJ�classmethodrr|�boolr�r�r�r�rr
r/r�r�r�r�r�r4rSrrr�r�>s����� $�#��	��V���
�V����	�

���� #�,�,�.��.�	�%��S��/�	"�.�&'-�&6�&6�I��I�8�C�=�I�%����
�
�%rr�c�6�eZdZdZd	dededdfd�Zd
d�Zdd�Zy)�CacheStatisticszCache Statistics�hits�missesr)Nc� �||_||_yr�r�r�)rr�r�s   rrzCacheStatistics.__init__rs����	���rc� �d|_d|_yr�r�rDs r�resetzCacheStatistics.resetvs����	���rc�B�t|j|j�Sr)r�r�r�rDs r�clonezCacheStatistics.clonezs���t�y�y�$�+�+�6�6r)rr�r)N)r)r�)rGrHrIrJr�rr�r�rSrrr�r�os)����S��c��$���7rr�c�@�eZdZdd�Zdd�Zdefd�Zdefd�Zdefd�Z	y)	�	CacheBaser)Nc�T�tj�|_t�|_yr)�	threading�Lock�lockr��
statisticsrDs rrzCacheBase.__init__s���N�N�$��	�)�+��rc�z�|j5|jj�ddd�y#1swYyxYw)zReset all statistics to zero.N)r�r�r�rDs r�reset_statisticszCacheBase.reset_statistics�s.��
�Y�Y�	$��O�O�!�!�#�	$�	$�	$�s�1�:c�r�|j5|jjcddd�S#1swYyxYw)z How many hits has the cache had?N)r�r�r�rDs rr�zCacheBase.hits�s+��
�Y�Y�	(��?�?�'�'�	(�	(�	(���-�6c�r�|j5|jjcddd�S#1swYyxYw)z"How many misses has the cache had?N)r�r�r�rDs rr�zCacheBase.misses�s+��
�Y�Y�	*��?�?�)�)�	*�	*�	*�r�c�z�|j5|jj�cddd�S#1swYyxYw)z�Return a consistent snapshot of all the statistics.

        If running with multiple threads, it's better to take a
        snapshot than to call statistics methods such as hits() and
        misses() individually.
        N)r�r�r�rDs r�get_statistics_snapshotz!CacheBase.get_statistics_snapshot�s0���Y�Y�	+��?�?�(�(�*�	+�	+�	+�s�1�:r�)
rGrHrIrr�r�r�r�r�r�rSrrr�r�~s0��,�$�
(�c�(�
*��*�
+��+rr�c�x��eZdZdZddeddf�fd�
Zd
d�Zdedee	fd�Z
ded	e	ddfd
�Zddeeddfd�Z�xZ
S)�Cachez$Simple thread-safe DNS answer cache.�cleaning_intervalr)Nc���t�|��i|_||_t	j�|jz|_y)zf*cleaning_interval*, a ``float`` is the number of seconds between
        periodic cleanings.
        N)rr�datar�r��
next_cleaning)rr�rs  �rrzCache.__init__�s8���
	����,.��	�!2���$(�I�I�K�$�2H�2H�$H��rc�N�tj�}|j|kr�g}|jj�D]&\}}|j|ks�|j|��(|D]}|j|=�tj�}||jz|_yy)z&Clean the cache if it's time to do so.N)r�r�r��itemsr�r;r�)r�now�keys_to_delete�k�vs     r�_maybe_cleanzCache._maybe_clean�s����i�i�k������$��N��	�	���)�
-���1��<�<�3�&�"�)�)�!�,�
-�$�
!���I�I�a�L�
!��)�)�+�C�!$�t�'=�'=�!=�D��%r�keyc�v�|j5|j�|jj|�}|�!|jtj
�kr)|jxjdz
c_	ddd�y|jxjdz
c_|cddd�S#1swYyxYw�aKGet the answer associated with *key*.

        Returns None if no answer is cached for the key.

        *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)``
        tuple whose values are the query name, rdtype, and rdclass respectively.

        Returns a ``dns.resolver.Answer`` or ``None``.
        Nr+)	r�r�r�r:r�r�r�r�r�)rr�r�s   rr:z	Cache.get�s����Y�Y�	������	�	�
�
�c�"�A��y�A�L�L�D�I�I�K�7����&�&�!�+�&��	�	�
�O�O� � �A�%� ��	�	�	�s�A/B/� B/�/B8�valuec��|j5|j�||j|<ddd�y#1swYyxYw�aAssociate key and value in the cache.

        *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)``
        tuple whose values are the query name, rdtype, and rdclass respectively.

        *value*, a ``dns.resolver.Answer``, the answer.
        N)r�r�r��rr�r�s   r�putz	Cache.put�s9���Y�Y�	#�����"�D�I�I�c�N�	#�	#�	#�s� 6�?c���|j5|�||jvr;|j|=n-i|_tj�|jz|_ddd�y#1swYyxYw�a2Flush the cache.

        If *key* is not ``None``, only that item is flushed.  Otherwise the entire cache
        is flushed.

        *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)``
        tuple whose values are the query name, rdtype, and rdclass respectively.
        N)r�r�r�r�r�)rr�s  r�flushzCache.flush�s`���Y�Y�	J����$�)�)�#��	�	�#����	�%)�Y�Y�[�4�3I�3I�%I��"�
	J�	J�	J�s�AA"�"A+)g�r@r�r)rGrHrIrJ�floatrr��CacheKeyrr|r:r�r�rNrOs@rr�r��sn���.�I�%�I�D�I�>��x��H�V�$4��(#�x�#��#�4�#�J��(�+�J�t�Jrr�c�&�eZdZdZd�Zdd�Zdd�Zy)�LRUCacheNodezLRUCache node.c�J�||_||_d|_||_||_yr�)r�r�r��prev�nextr�s   rrzLRUCacheNode.__init__�s%�������
���	���	���	rNc�d�||_|j|_||j_||_yr�r�r�)r�nodes  r�
link_afterzLRUCacheNode.link_after�s&����	��I�I��	���	�	����	rc�p�|j|j_|j|j_yrrrDs r�unlinkzLRUCacheNode.unlink�s ������	�	������	�	�r)rr�r)Nr�)rGrHrIrJrrrrSrrr�r��s�����#rr�c���eZdZdZd
deddf�fd�
Zdeddfd�Zdedee	fd�Z
dedefd	�Zded
e	ddfd�Zddeeddfd�Z
�xZS)�LRUCachea`Thread-safe, bounded, least-recently-used DNS answer cache.

    This cache is better than the simple cache (above) if you're
    running a web crawler or other process that does a lot of
    resolutions.  The LRUCache has a maximum number of nodes, and when
    it is full, the least-recently used node is removed to make space
    for a new one.
    �max_sizer)Nc����t�|��i|_|j|�t	dd�|_|j
|j
_|j
|j
_y)zl*max_size*, an ``int``, is the maximum number of nodes to cache;
        it must be greater than 0.
        N)rrr��set_max_sizer��sentinelr�r�)rrrs  �rrzLRUCache.__init__sS���
	����24��	����(�#�&2�4��&>��
�!�]�]��
�
��!�]�]��
�
�rc� �|dkrd}||_y)Nr+)r)rrs  rr
zLRUCache.set_max_sizes���a�<��H� ��
rr�c�~�|j5|jj|�}|�)|jxjdz
c_	ddd�y|j�|jjtj�kr@|j|j=|jxjdz
c_	ddd�y|j|j�|jxjdz
c_|xjdz
c_|jcddd�S#1swYyxYwr�)
r�r�r:r�r�rr�r�r�r�rrr��rr�rs   rr:zLRUCache.gets����Y�Y�	��9�9�=�=��%�D��|����&�&�!�+�&��		�	�
�K�K�M��z�z�$�$��	�	��3��I�I�d�h�h�'����&�&�!�+�&��	�	�
�O�O�D�M�M�*��O�O� � �A�%� ��I�I��N�I��:�:�	�	�	�s�>D3�A2D3�AD3�3D<c��|j5|jj|�}|�+|jjtj
�kr
	ddd�y|jcddd�S#1swYyxYw)zBReturn the number of cache hits associated with the specified key.Nr)r�r�r:r�r�r�r�rs   r�get_hits_for_keyzLRUCache.get_hits_for_key;sb��
�Y�Y�	!��9�9�=�=��%�D��|�t�z�z�4�4��	�	��C��	!�	!�
�y�y�	!�	!�	!�s�A
A5� A5�5A>r�c�>�|j5|jj|�}|�'|j�|j|j=t|j�|jk\r`|jj}|j�|j|j=t|j�|jk\r�`t||�}|j|j�||j|<ddd�y#1swYyxYwr�)r�r�r:rr�r&rrr�r�r)rr�r�r�gnodes     rr�zLRUCache.putDs����Y�Y�	"��9�9�=�=��%�D������
��I�I�d�h�h�'��d�i�i�.�D�M�M�1��
�
�*�*�������I�I�e�i�i�(��d�i�i�.�D�M�M�1� ��U�+�D��O�O�D�M�M�*�!�D�I�I�c�N�	"�	"�	"�s�CD�6D�Dc��|j5|�E|jj|�}|��|j�|j|j=nZ|j
j}||j
k7r.|j}|j�|}||j
k7r�.i|_ddd�y#1swYyxYwr�)r�r�r:rr�rr�)rr�rrr�s     rr�zLRUCache.flushZs����Y�Y�	����y�y�}�}�S�)���#��K�K�M��	�	�$�(�(�+��
�
�*�*���t�}�}�,� �:�:�D��L�L�N� �E��t�}�}�,���	�	�	�	�s�BB8�(B8�8C)i��r)rGrHrIrJr�rr
r�rr|r:rr�r�rNrOs@rrrs�����
+��
+�$�
+�!�S�!�T�!�
�x��H�V�$4��8!�H�!��!�"�x�"��"�4�"�,��(�+��t�rrc��eZdZdZdddeejjefdeejjefdeejjefde
de
d	ee
d
dfd�Zd
eeej"j$eeffd
�Zd
eej*j,e
effd�Zdeej"j2deed
eeee
ffd�Zy)�_ResolutionaHelper class for dns.resolver.Resolver.resolve().

    All of the "business logic" of resolution is encapsulated in this
    class, allowing us to have multiple resolve() implementations
    using different I/O schemes without copying all of the
    complicated logic.

    This class is a "friend" to dns.resolver.Resolver and manipulates
    resolver data structures directly.
    �resolver�BaseResolverr6r}r~�tcp�raise_on_no_answer�searchr)Nc���t|t�r tjj	|d�}tj
jj|�}tj
j|�rt�tjjj|�}tjj|�rt�||_
|j||�|_|jdd|_||_||_||_||_i|_tjj,|_g|_g|_g|_d|_d|_d|_d|_d|_y)NF�) r!r/r�r��	from_textr�r�r��is_metatyperxr�r��is_metaclassr�_get_qnames_to_try�
qnames_to_tryrr}r~rr�nxdomain_responses�emptyr6�nameservers�current_nameserversrTr�tcp_attempt�retry_with_tcpro�backoff)rrr6r}r~rrrs        rrz_Resolution.__init__s&���e�S�!��H�H�&�&�u�d�3�E����(�(�-�-�f�5���=�=�$�$�V�,����.�.�+�+�0�0��9���>�>�&�&�w�/��� ��
�%�8�8���G����(�(��+������������"4���QS����X�X�^�^��
�<>���DF�� �(*���?C��� ���#���;?�����rc�X�t|j�dkD�rq|jjd�|_|jj
�r*|jj
j
|j|j|jf�}|�2|j�"|jrt|j���d|fS|jj
j
|jtjj|jf�}|�Z|jj!�tj j"k(r%|j|j$|j<��ztj&j)|j|j|j�}|jj*�P|j-|jj.|jj*|jj0��|j3|jj4|jj6|jj8|jj:��|jj<�|jj<|_|jj?|jj@|jjB|jjD�|_#|jjHrtKjL|jF�|jFdd|_'g|_(d|_)d|_*d|_+||_,d|_-|dfSt#|j\|j$���)	z�Get the next request to send, and check the cache.

        Returns a (request, answer) tuple.  At most one of request or
        answer will not be None.
        rN�r7)�	algorithm)�optionsFg�������?r )/r&r�popr6r�cacher:r}r~r�rrgr7r�r��ANY�rcoderr"r��
make_query�keyname�use_tsig�keyring�keyalgorithm�use_edns�edns�	ednsflags�payload�ednsoptions�flags�_enrich_nameservers�_nameservers�nameserver_portsr�r$�rotate�random�shuffler%rTrr&r'ror(r!)rr�ros   r�next_requestz_Resolution.next_request�s����$�+�+���"�������+�D�J��}�}�"�"����,�,�0�0��Z�Z����d�l�l�;����%��|�|�+��0G�0G�&����@�@� $�f�~�-����,�,�0�0��Z�Z����!2�!2�D�L�L�A����%�&�/�/�*?�*?�*A�S�Y�Y�EW�EW�*W�;A�/�/�D�+�+�D�J�J�7���k�k�,�,�T�Z�Z����d�l�l�S�G��}�}�$�$�0�� � ��M�M�)�)��M�M�)�)�"�m�m�8�8�!��

����
�
�"�"��
�
�'�'��
�
�%�%��
�
�1�1�	
�
��}�}�"�"�.� $�
�
� 3� 3��
�#�}�}�@�@��
�
�*�*��
�
�.�.��
�
�"�"� �D��
�}�}�#�#����t�/�/�0�'+�'7�'7��':�D�$��D�K�"�D�O�$�D��"'�D��"�D�L��D�L��T�?�"��d�0�0�D�<S�<S�T�Trc�~�|jrG|j�J�|jj�rJ�d|_d|_|jddfSd}|jswt|j�dk(r!t|j|j���|jdd|_|j}t|jdzd�|_
|jjd�|_|jxs|jj�|_|j|j|fS)NTFrr)rorT�)r'r�is_always_max_sizer&r%r&r$rnrorTr(�minr-r)rr(s  r�next_nameserverz_Resolution.next_nameserver�s������?�?�.�.�.����9�9�;�;�;�#�D��"'�D���O�O�T�1�-�-����'�'��4�#�#�$��)�#�D�L�L����M�M�'+�'7�'7��':�D�$��l�l�G��t�|�|�a�/��3�D�L��2�2�6�6�q�9����8�8�K�t���'I�'I�'K�������!1�!1�7�;�;rr7�exc	��|j�J�|�r1|�J�|jjt|j�|j|jj�||f�t
|tjj�s0t
|t�s t
|t�st
|t�r&|jj|j�yt
|tjj �r9|jr&|jj|j�yd|_y|�J�t
|tjj$�sJ�|j'�}|tj&j(k(r�	t+|j,|j.|j0||jj3�|jj��}|j6j8rG|j6j8j;|j,|j.|j0f|�|j<�"|j>rtA|jB���|dfS|tj&jDk(r�	t+|j,tjFjHtjJjL|�}||jN|j,<|j6j8rU|j6j8j;|j,tjFjH|j0f|�y|tj&jPk(ratQ�}|jjt|j�|j|jj�||f�|�|tj&jRk7s|j6jTs%|jj|j�|jjt|j�|j|jj�tj&jW|�|f�y#t4$r�}|jjt|j�|j|jj�||f�|jj|j�Yd}~yd}~wwxYw#t4$r�}|jjt|j�|j|jj�||f�|jj|j�Yd}~yd}~wwxYw)NT)NFr*)NT),rrTr;r/r&�answer_portr!r��	exception�	FormError�EOFError�OSErrorr�r$�remover��	Truncatedr'r�r0�NOERRORr|r6r}r~�answer_nameserverr5rr.r�r�rrgr7rr�r/r��INr"rQ�SERVFAIL�retry_servfail�to_text)rr7rHr0r��e�yexs       r�query_resultz_Resolution.query_resultsg�����*�*�*�
��#�#�#��K�K�������(��$�$��O�O�/�/�1����
��2�s�}�}�6�6�7��b�(�+��b�'�*��b�"5�6�� � �'�'����8�!�
�B���� 5� 5�6��#�#��$�$�+�+�D�O�O�<�!�+/�D�'� ��#�#�#��(�C�K�K�$<�$<�=�=�=���� ���C�I�I�%�%�%�
%���J�J��K�K��L�L���O�O�5�5�7��O�O�/�/�1�
��*�}�}�"�"��
�
�#�#�'�'����T�[�[�$�,�,�(O�QW�X��|�|�#��(?�(?�����8�8��D�>�!�
�c�i�i�(�(�
(�
%���J�J��
�
� 1� 1�3�>�>�3D�3D�h��� 3;�D�#�#�D�J�J�/��}�}�"�"��
�
�#�#�'�'��Z�Z����!2�!2�D�L�L�A�6��
 �
�c�i�i�(�(�
(��*�C��K�K�������(��$�$��O�O�/�/�1����
��I���	�	�*�*�*�$�-�-�2N�2N�� � �'�'����8��K�K�������(��$�$��O�O�/�/�1��I�I�%�%�e�,���
�!��U�
%����"�"��D�O�O�,��(�(����3�3�5�� ���� � �'�'����8�$��
%��2�
%����"�"��D�O�O�,��(�(����3�3�5�� ���� � �'�'����8�$��
%�s4�AR<�&AU�<	U	�A:U�U	�	W�A:W�W)rGrHrIrJrr�r�r�r/r�r�r�r�r�rrr
r�r�r|rBr�
Nameserverr�rG�Messager5rYrSrrrrss/��	�#� �#��S�X�X�]�]�C�'�(�#��c�m�m�-�-�s�2�3�	#�
�s�~�~�0�0�#�5�6�#��
#�!�#����#�
�#�JIU�	�x����0�0�1�8�F�3C�C�	D�IU�V<��s�~�~�'@�'@�$��'M�!N�<�*z!� ����!4�!4�5�z!�;C�I�;N�z!�	�x����%�	&�z!rrc��eZdZUdZej
jed<ee	e
fed<e
ed<eej
jed<eed<e
ed<e
ed<eeed	<eeej
je	fed
<eej
je	fed<e
ed<e
ed
<eeej"j$ed<e
ed<eed<ee
ed<eed<eed<ee
ed<eee	ej(j*fed<	d/de	deddfd�Zd0d�Zdeddfd�Zd0d�Z		d1de
dee
d eeede
fd!�Zd"ej
jdeedeej
jfd#�Zdej:j<fd	ed
eeej
je	fd$eej
je	fddfd%�Zd&d&ej@jBdfdeee
efd
e
de
d'eeej"j$ddf
d(�Z"de
ddfd)�Z#e$d*eee	ej(j*fdee	e
fd+e
deej(j*fd,��Z%e&deee	ej(j*ffd-��Z'e'jPd*eee	ej(j*fddfd.��Z'y)2rr�domainr>r�r�use_search_by_defaultr]�lifetimer4r2r5r7r8r:r9r.r;rUr?�ndotsr=�filename�	configurer)Nc��|j�|r9tjdk(r|j�y|r|j	|�yyy)a�*filename*, a ``str`` or file object, specifying a file
        in standard /etc/resolv.conf format.  This parameter is meaningful
        only when *configure* is true and the platform is POSIX.

        *configure*, a ``bool``.  If True (the default), the resolver
        instance is configured in the normal fashion for the operating
        system the resolver is running on.  (I.e. by reading a
        /etc/resolv.conf file on POSIX systems and from the registry
        on Windows systems.)
        r
N)r��sys�platform�
read_registry�read_resolv_conf)rrarbs   rrzBaseResolver.__init__�sC��	
�
�
����|�|�w�&��"�"�$���%�%�h�/��rc�X�tjjtjjt	j
��dd�|_t|j�dk(rtjj|_g|_	i|_
d|_g|_d|_
d|_d|_d|_d|_tj$j&|_d|_d|_d|_d|_d|_d|_d|_d|_d|_y)	z1Reset all resolver configuration to the defaults.r+Nr�5Fg@�@r\)r�r�r�rr��gethostnamer]r&�rootr=r>r�rr^r]r_r4r2�tsig�default_algorithmr5r7r8r:r9r.r;rUr?r`rDs rr�zBaseResolver.reset�s����h�h�m�m�C�H�H�$6�$6�v�7I�7I�7K�$L�Q�R�$P�Q����t�{�{��q� ��(�(�-�-�D�K���� "�����	����%*��"������
��������H�H�6�6�����	������������
���
�#��������
r�fc�L�g}t|t�r
	t|�}ntj|�}|5}|D�]m}t|�dk(s|ddk(s|ddk(r�#|j�}t|�dkr�B|ddk(r|j|d��_|ddk(r/tjj|d�|_
g|_��|dd	k(rJg|_|dd
D]:}|jjtjj|���<��|ddk(s��|dd
D]u}|dk(rd
|_�|dk(r|j!��&d|vr$	t#|jd�d�|_�Nd|vs�S	t#|jd�d�|_�w��p	d
d
d
�t|�dk(rt	d��||_y
#t$rt	d|����wxYw#t&t(f$rY��wxYw#t&t(f$rY��wxYw#1swY�oxYw)a�Process *f* as a file in the /etc/resolv.conf format.  If f is
        a ``str``, it is used as the name of the file to open; otherwise it
        is treated as the file itself.

        Interprets the following items:

        - nameserver - name server IP address

        - domain - local domain name

        - search - search list for host-name lookup

        - options - supported options are rotate, timeout, edns0, and ndots

        zcannot open r�#�;rDrr+r]rNr,r?T�edns0r]�:r`zno nameservers)r!r/�openrNrz�
contextlib�nullcontextr&�splitr;r�r�rr]rr?r6r�r]�
ValueErrorr�r`r$)rror$�cm�l�tokens�suffix�opts        rrgzBaseResolver.read_resolv_conf�s<��"���a���
B�8<�Q���
�'�'��*�B�
�&	%�1��%
%���q�6�Q�;�!�A�$�#�+��1�����������v�;��?���!�9��,��&�&�v�a�y�1��A�Y�(�*�"%�(�(�"4�"4�V�A�Y�"?�D�K�"$�D�K��A�Y�(�*�"$�D�K�"(���*�G�����*�*�3�8�8�+=�+=�f�+E�F�G��A�Y�)�+�%�a�b�z�%���(�?�*.�D�K� �G�^� �M�M�O�&�#�-�%�/2�3�9�9�S�>�!�3D�/E���%��^�%�-0����3���1B�-C��
�%�/%
%�&	%�N�{��q� �)�*:�;�;�'����a�
B�-��Q�C�.@�A�A�
B��J%/�
�#;�%� $�%��
%/�
�#;�%� $�%��K&	%�&	%�se�G�C3H�+/H�"G0�=H�"H�&H�G-�0H	�?H�H	�H�H	�H�H	�H�H#c���	tjj�}|j�|j|_|j|_|j
|_y#t$rt�wxYw)z9Extract resolver configuration from the Windows registry.N)r��	win32util�get_dns_infor]r$rr%r�)r�infos  rrfzBaseResolver.read_registrys\��	&��=�=�-�-�/�D��{�{�&�"�k�k���#�/�/�D���+�+�D�K���	&�%�%�	&�s�AA � A0�startrTc���|�|jn|}tj�}||z
}|�g}|dkr|dkr
t||���d}||k\r
t||���t||z
|j�S)Nrr\ra)r_r�r[rFr])rr�r_rTr��durations      r�_compute_timeoutzBaseResolver._compute_timeouts��%-�$4�4�=�=�(���i�i�k����;���>��F��a�<��"�}�%�h�v�F�F�
���x��!�(�6�B�B��8�h�&����5�5rr6c��|�|j}g}|j�r|j|�|S|jtj
j�}|r�t|j�dkDr|jdd}nC|jtj
jk7r|j�|jg}ng}|j�d}n|j}|D]}|j||z��t|�|kDr|jd|�|S|j|�|S|j|�|S)Nrr+)r^�is_absoluter;�concatenater�r�rlr&rr]r`�insert)rr6rr!�	abs_qname�search_listr`r}s        rr zBaseResolver._get_qnames_to_try6s2��
�>��/�/�F��
������ � ��'�<��9�)�)�#�(�(�-�-�8�I���t�{�{�#�a�'�"&�+�+�a�.�K��[�[�C�H�H�M�M�1�d�k�k�6M�$(�;�;�-�K�"$�K��:�:�%��E� �J�J�E�)�9�F�!�(�(����8�9��u�:��%�"�(�(��I�6���"�(�(��3����$�$�Y�/��rr+c�.�||_||_||_y)z�Add a TSIG signature to each query.

        The parameters are passed to ``dns.message.Message.use_tsig()``;
        see its documentation for details.
        N)r4r2r5)rr4r2r+s    rr3zBaseResolver.use_tsig_s��������%��rrr,c�Z�|�|durd}n|durd}||_||_||_||_y)a�Configure EDNS behavior.

        *edns*, an ``int``, is the EDNS level to use.  Specifying
        ``None``, ``False``, or ``-1`` means "do not use EDNS", and in this case
        the other parameters are ignored.  Specifying ``True`` is
        equivalent to specifying 0, i.e. "use EDNS0".

        *ednsflags*, an ``int``, the EDNS flag values.

        *payload*, an ``int``, is the EDNS sender's payload field, which is the
        maximum size of UDP datagram the sender can handle.  I.e. how big
        a response to this message can be.

        *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS
        options.
        NFr\Tr)r7r8r9r:)rr7r8r9r,s     rr6zBaseResolver.use_ednsos=��0�<�4�5�=��D�
�T�\��D���	�"������"��rc��||_y)zkOverrides the default flags with your own.

        *flags*, an ``int``, the message flags to use.
        N)r;)rr;s  r�	set_flagszBaseResolver.set_flags�s����
rr$�default_portc�H�g}t|t�r�|D]�}t|tjj�r|}n�tj
j
|�r3|j||�}tjj||�}n?	t|�jdk7rt�	tjj|�}|j|���|Stdj!t#|����#t$rtd|�d���wxYw)N�httpsznameserver z\ is not a dns.nameserver.Nameserver instance or text form, IP address, nor a valid https URLz.nameservers must be a list or tuple (not a {}))r!r"r�rrZ�inet�
is_addressr:�Do53Nameserverr�schemer�r5ry�
DoHNameserverr;r0�type)r�r$r>r��enriched_nameserversr�enriched_nameserverr�s        rr<z BaseResolver._enrich_nameservers�s%�� "���k�4�(�)�
A�
��j�#�.�.�*C�*C�D�*4�'��X�X�(�(��4�+�/�/�
�L�I�D�*-�.�.�*G�*G�"�D�+�'��#�J�/�6�6�'�A�"5�5�B�+.�.�.�*F�*F�z�*R�'�$�+�+�,?�@�)
A�6$�#��@�G�G���%���
��%��(�)�*��6@�@����s�D�D!c��|jSr)r=rDs rr$zBaseResolver.nameservers�s��� � � rc�`�|j||j|j�||_y)a
        *nameservers*, a ``list`` of nameservers, where a nameserver is either
        a string interpretable as a nameserver, or a ``dns.nameserver.Nameserver``
        instance.

        Raises ``ValueError`` if *nameservers* is not a list of nameservers.
        N)r<r>r�r=)rr$s  rr$zBaseResolver.nameservers�s(��	
� � ��d�.C�.C�T�Y�Y�O�'��r)z/etc/resolv.confTr�r�))rGrHrIrJr�r�r��__annotations__rr/r�rr�r�rrrr7�Optionr	rrZrr�rgrf�
ErrorTupler�r rmrnr3r��DEFAULT_EDNS_PAYLOADr6r�r�r<rMr$�setterrSrrrr�s{���
�H�H�M�M���3��8�n�$�

�I�����������
�N��O�
�c�]��
�e�C�H�H�M�M�3�.�/�
0�0�����
�
�s�*�+�+�

�I��N��$�s�x�x���/�0�0�
�L��J��C�=�����L��C�=���5��c�n�n�&?�&?�!?�@�A�A�EI�0��0�=A�0�	
�0�*�4E'�#�E'�$�E'�N	&�%)�-1�	6��6��5�/�6���j�)�*�	6�

�6�0'��X�X�]�]�'�,4�T�N�'�	
�c�h�h�m�m�	�'�X8<�/2�x�x�/I�/I�	&��&��%����
�
�s� 2�3�4�&��������+�,�	&�

�&�$,-���{�{�7�7�37�#��u�S�$�Y�'�(�#��#��	#�
�$�s�x�x���/�0�#�
�
#�B�s��t���#$��e�C����)B�)B�$B�C�D�#$��s�C�x�.�#$��	#$�

�c�n�n�'�'�	(�#$��#$�J�!�	�%��S�^�^�6�6�6�7�	8�!��!�
���(�#�E�#�s�~�~�/H�/H�*H�$I�J�(�	
�(��(rrc�n�eZdZdZej
jejjddddddfde	ejjefde	ej
jefde	ejjefd	ed
eededed
eedeedefd�Zej
jejjdddddfde	ejjefde	ej
jefde	ejjefd	ed
eededed
eedefd�Zdedededefd�Zej2fde	ejjefdededefd�Zde	ejjefdejjfd�Zdd
eddfd�Zy)�ResolverrFNTrr6r}r~r�sourcer�source_portr_rr)c
	���t|||||||	�}
tj�}	|
j�\}}
|
�|
S|�J�d}|s{|
j�\}}}|rtj|�|j|||
j�}	|j|||||��}|
j|d�\}
}|
�|
S|s�{��#t$r}|
jd|�\}}Yd}~��d}~wwxYw)a�Query nameservers to find the answer to the question.

        The *qname*, *rdtype*, and *rdclass* parameters may be objects
        of the appropriate type, or strings that can be converted into objects
        of the appropriate type.

        *qname*, a ``dns.name.Name`` or ``str``, the query name.

        *rdtype*, an ``int`` or ``str``,  the query type.

        *rdclass*, an ``int`` or ``str``,  the query class.

        *tcp*, a ``bool``.  If ``True``, use TCP to make the query.

        *source*, a ``str`` or ``None``.  If not ``None``, bind to this IP
        address when making queries.

        *raise_on_no_answer*, a ``bool``.  If ``True``, raise
        ``dns.resolver.NoAnswer`` if there's no answer to the question.

        *source_port*, an ``int``, the port from which to send the message.

        *lifetime*, a ``float``, how many seconds a query should run
        before timing out.

        *search*, a ``bool`` or ``None``, determines whether the
        search list configured in the system's resolver configuration
        are used for relative names, and whether the resolver's domain
        may be added to relative names.  The default is ``None``,
        which causes the value of the resolver's
        ``use_search_by_default`` attribute to be used.

        Raises ``dns.resolver.LifetimeTimeout`` if no answers could be found
        in the specified lifetime.

        Raises ``dns.resolver.NXDOMAIN`` if the query name does not exist.

        Raises ``dns.resolver.YXDOMAIN`` if the query name is too long after
        DNAME substitution.

        Raises ``dns.resolver.NoAnswer`` if *raise_on_no_answer* is
        ``True`` and the query name exists but has no RRset of the
        desired type and class.

        Raises ``dns.resolver.NoNameservers`` if no non-broken
        nameservers are available to answer the question.

        Returns a ``dns.resolver.Answer`` instance.

        NF)r]r�r�r)
rr�rBrG�sleepr�rTrjr5rY)rr6r}r~rr�rr�r_r�
resolutionr�ror��donerr(r]r7rH�_s                     r�resolvezResolver.resolve�s$��~!��%���#�/A�6�
�
��	�	���� *� 7� 7� 9��W�f�
�!��
��&�&�&��D��-7�-G�-G�-I�*��S�'���J�J�w�'��/�/��x��AR�AR�S��
�)�/�/�� '�%�$/�!$� 0� �H�",�!8�!8��4�!H����
�%�!�M�-���0!�� *� 7� 7��b� A�I�Q�����s�C�	C*�C%�%C*c	�l�tjdtd��|j||||||||d�	S)a$Query nameservers to find the answer to the question.

        This method calls resolve() with ``search=True``, and is
        provided for backwards compatibility with prior versions of
        dnspython.  See the documentation for the resolve() method for
        further details.
        z2please use dns.resolver.Resolver.resolve() insteadrD��
stacklevelT��warnings�warn�DeprecationWarningr�)	rr6r}r~rr�rr�r_s	         rrjzResolver.query=sG��$	�
�
�@���	
�
�|�|����������

�
	
r�ipaddrrrc��i}|j|�tjj|d<tjj
|d<|jtjj|�g|��i|��S)a�Use a resolver to run a reverse query for PTR records.

        This utilizes the resolve() method to perform a PTR lookup on the
        specified IP address.

        *ipaddr*, a ``str``, the IPv4 or IPv6 address you want to get
        the PTR record for.

        All other arguments that can be passed to the resolve() function
        except for rdtype and rdclass are also supported by this
        function.
        r}r~)	�updater�r��PTRr�rSr��reversename�from_address)rr�rr�modified_kwargss     r�resolve_addresszResolver.resolve_address`st�� +-�����v�&�$'�M�M�$5�$5���!�%(�^�^�%6�%6��	�"��t�|�|��O�O�(�(��0�
�37�
�;J�
�	
rr�r�c��i}|j|�|jdd�tjj|d<|t
jk(rB|j|tjjfi|��}tj|��S|t
jk(rB|j|tjjfi|��}tj|��S|t
jk7rtd|����|jdd�}|jd	d�}t!j �}	|j|tjjfd
|j#|	|�d�|��}|j$}|j|tjjfd
|j#|	|�d�|��}tj|||��}
|
st'|j(�
��|
S)aUse a resolver to query for address records.

        This utilizes the resolve() method to perform A and/or AAAA lookups on
        the specified name.

        *qname*, a ``dns.name.Name`` or ``str``, the name to resolve.

        *family*, an ``int``, the address family.  If socket.AF_UNSPEC
        (the default), both A and AAAA records will be retrieved.

        All other arguments that can be passed to the resolve() function
        except for rdtype and rdclass are also supported by this
        function.
        r}Nr~)r�)r�r�rTr_F)rr_)r�r�r�r*)r�r-r�r�rSr�r�r�r�r�r�r�r�r�r�r�r�r�r6rgr7)rr�r�rr�r�r�rr_r�r�s           r�resolve_namezResolver.resolve_namexs���.+-�����v�&����H�d�+�%(�^�^�%6�%6��	�"��V�^�^�#�����d�C�M�M�O�O�G��G�B��#�#�r�#�*�*�
�v���
&�����d�C�M�M�$6�$6�J�/�J�B��#�#�r�#�*�*�
�v�'�'�
'�%�(?��x�&H�I�I�,�0�0�1E�t�L��"�&�&�z�4�8���	�	���
�T�\�\���M�M���
� %��*�*�5�(�;�	
�
�
���x�x��
�T�\�\���M�M�O�O�
� %��*�*�5�(�;�	
�
�
���"�"�b�R�?Q�;Q�"�R����B�K�K�0�0��rc��	|j|d��}|j}|S#tjj$r}|j}Yd}~|Sd}~wwxYw)a�Determine the canonical name of *name*.

        The canonical name is the name the resolver uses for queries
        after all CNAME and DNAME renamings have been applied.

        *name*, a ``dns.name.Name`` or ``str``, the query name.

        This method can raise any exception that ``resolve()`` can
        raise, other than ``dns.resolver.NoAnswer`` and
        ``dns.resolver.NXDOMAIN``.

        Returns a ``dns.name.Name``.
        F)rN)r�r4r�rr)rr�r�r4rWs     rr4zResolver.canonical_name�sY��	.��\�\�$�5�\�A�F�#�2�2�N�����|�|�$�$�	.��-�-�N����	.�s�#�A�A�Ac�T�	tj�|z}|jtjjd|��}tj
j
|�}tjj||�}t|�dkDr||_	yy#t$rYywxYw)a�Try to update the resolver's nameservers using Discovery of Designated
        Resolvers (DDR).  If successful, the resolver will subsequently use
        DNS-over-HTTPS or DNS-over-TLS for future queries.

        *lifetime*, a float, is the maximum time to spend attempting DDR.  The default
        is 5 seconds.

        If the SVCB query is successful and results in a non-empty list of nameservers,
        then the resolver's nameservers are set to the returned servers in priority
        order.

        The current implementation does not use any address hints from the SVCB record,
        nor does it resolve addresses for the SCVB target name, rather it assumes that
        the bootstrap nameserver will always be one of the addresses and uses it.
        A future revision to the code may offer fuller support.  The code verifies that
        the bootstrap nameserver is in the Subject Alternative Name field of the
        TLS certficate.
        �SVCB�r_rN)r�r�r��_ddr�_local_resolver_namerj�
_remaining�_get_nameservers_syncr&r$r5)rr_r�r�r]r$s      r�try_ddrzResolver.try_ddr�s���&
	�����x�/�J��\�\����-�-�v��"��F��i�i�*�*�:�6�G��(�(�8�8���I�K��;��!�#�#.�� �$���	��	�s�BB�	B'�&B'�rj)rGrHrIrJr�r�r�r�rSrr�r�r/r�r�r�rr�r�r|r�rjrr�r�r�r�r�r4r�rSrrr�r��s]���
7:�m�m�o�o�9<���9J�9J�� $�#'��$(�!%�d"��S�X�X�]�]�C�'�(�d"��c�m�m�-�-�s�2�3�d"��s�~�~�0�0�#�5�6�	d"�
�d"���
�
d"�!�d"��d"��5�/�d"����d"�
�d"�R7:�m�m�o�o�9<���9J�9J�� $�#'��$(�!
��S�X�X�]�]�C�'�(�!
��c�m�m�-�-�s�2�3�!
��s�~�~�0�0�#�5�6�	!
�
�!
���
�
!
�!�!
��!
��5�/�!
�
�!
�F
�c�
�#�
��
��
�6�&�&�?��C�H�H�M�M�3�&�'�?��?��	?�

�?�F�5�������);�#<��������.����rr��default_resolverc�>�t�
t�t�J�tS)z7Get the default resolver, initializing it if necessary.)r��reset_default_resolverrSrr�get_default_resolverr��s ����� ��'�'�'��rc��t�ay)z�Re-initialize default resolver.

    Note that the resolver configuration (i.e. /etc/resolv.conf on UNIX
    systems) will be re-read immediately.
    N)r�r�rSrrr�r��s�� �z�rFTr6r}r~rr�rr�r_rc	�D�t�j|||||||||�	S)z�Query nameservers to find the answer to the question.

    This is a convenience function that uses the default resolver
    object to make the query.

    See ``dns.resolver.Resolver.resolve`` for more information on the
    parameters.
    )r�r�)	r6r}r~rr�rr�r_rs	         rr�r�	s5��( �!�)�)�
���������
�
rc�`�tjdtd��t||||||||d�	S)aQuery nameservers to find the answer to the question.

    This method calls resolve() with ``search=True``, and is
    provided for backwards compatibility with prior versions of
    dnspython.  See the documentation for the resolve() method for
    further details.
    z)please use dns.resolver.resolve() insteadrDr�Tr�)r6r}r~rr�rr�r_s        rrjrj*sC��"
�M�M�3�5G�TU���
���������
�
rr�rrc�>�t�j|g|��i|��S)z�Use a resolver to run a reverse query for PTR records.

    See ``dns.resolver.Resolver.resolve_address`` for more information on the
    parameters.
    )r�r�)r�rrs   rr�r�Ks%��2��!�1�1�&�J�4�J�6�J�Jrr�r�c�:�t�j||fi|��S)z�Use a resolver to query for address records.

    See ``dns.resolver.Resolver.resolve_name`` for more information on the
    parameters.
    )r�r�)r�r�rs   rr�r�Us"��/��!�.�.�t�V�F�v�F�Frc�4�t�j|�S)z�Determine the canonical name of *name*.

    See ``dns.resolver.Resolver.canonical_name`` for more information on the
    parameters and possible exceptions.
    )r�r4�r�s rr4r4as�� �!�0�0��6�6rc�4�t�j|�S)aTry to update the default resolver's nameservers using Discovery of Designated
    Resolvers (DDR).  If successful, the resolver will subsequently use
    DNS-over-HTTPS or DNS-over-TLS for future queries.

    See :py:func:`dns.resolver.Resolver.try_ddr` for more information.
    )r�r�r�s rr�r�ks�� �!�)�)�(�3�3rrc���t|t�r8tjj	|tjj
�}|�
t
�}|j�st|��tj�}|�||z}nd}		|�|tj�z
}|dkrd}nd}|j|tjj|||��}|j�J�|jj|k(r|S		|j3�}��#tjjtjj f$r�}	t|	tjj�r |	j#�j%|�}
n|	j'�}
|
r�|
j(D]�}|j*tjjk(s�+|j,|k(s�;|jj/|�\}}
}
|tjj0k(s�x|jccYd}	~	SYd}	~	��=d}	~	wwxYw#tjj4$rt6�wxYw)a�Find the name of the zone which contains the specified name.

    *name*, an absolute ``dns.name.Name`` or ``str``, the query name.

    *rdclass*, an ``int``, the query class.

    *tcp*, a ``bool``.  If ``True``, use TCP to make the query.

    *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use.
    If ``None``, the default, then the default resolver is used.

    *lifetime*, a ``float``, the total time to allow for the queries needed
    to determine the zone.  If ``None``, the default, then only the individual
    query limits of the resolver apply.

    Raises ``dns.resolver.NoRootSOA`` if there is no SOA RR at the DNS
    root.  (This is only likely to happen if you're using non-default
    root servers in your network and they are misconfigured.)

    Raises ``dns.resolver.LifetimeTimeout`` if the answer could not be
    found in the allotted lifetime.

    Returns a ``dns.name.Name``.
    Nrr�)r!r/r�r�rrlr�r�rsr�r�r��SOAr�rrrgrr:r7�	authorityr}r~�fullcompare�NAMERELN_SUPERDOMAIN�parent�NoParentrv)r�r~rrr_r�r��	rlifetimer�rWr7�rrs�nrr�s              r�
zone_for_namer�us���@�$����x�x�!�!�$����
�
�6����'�)�������$����I�I�K�E����X�%�
��
�
�	,��%�&�����4�	���>� !�I� �	��%�%��c�m�m�'�'��#�	�&��F��<�<�+�+�+��|�|� � �D�(���)�,	��;�;�=�D�I�� ���%�%�s�|�|�'<�'<�=�	,��!�S�\�\�2�2�3��;�;�=�,�,�T�2���:�:�<���#�-�-�
,�C��z�z�S�]�]�%6�%6�6�3�;�;�'�;Q�%(�X�X�%9�%9�$�%?�
��Q������!>�!>�>�$'�8�8�O�
,���
	,��*�x�x� � �	��O�	�sD�A9D�I�7I
�BI�!I�1<I�.
I�;I
�I�I
�$I4ri�wherer�c���|�
t�}g}t|t�rOtjj|�r0|j
tjj||��nT|j||�j�D]1}|j
tjj||���3tjjd��}||_
|S)aMake a stub resolver using the specified destination as the full resolver.

    *where*, a ``dns.name.Name`` or ``str`` the domain name or IP address of the
    full resolver.

    *port*, an ``int``, the port to use.  If not specified, the default is 53.

    *family*, an ``int``, the address family to use.  This parameter is used if
    *where* is not an address.  The default is ``socket.AF_UNSPEC`` in which case
    the first address returned by ``resolve_name()`` will be used, otherwise the
    first address of the specified family will be used.

    *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use for
    resolution of hostnames.  If not specified, the default resolver will be used.

    Returns a ``dns.resolver.Resolver`` or raises an exception.
    F)rb)r�r!r/r�r�r�r;rr�r�r�rr�r$)r�r�r�rr$r��ress       r�make_resolver_atr��s���.��'�)��?A�K��%���#�(�(�"5�"5�e�"<����3�>�>�8�8���E�F��,�,�U�F�;�E�E�G�	M�G����s�~�~�<�<�W�d�K�L�	M�

�,�,�
�
�%�
�
0�C�!�C�O��Jrc
�L�t||
||�j|||||||||	�	S)a}Query nameservers to find the answer to the question.

    This is a convenience function that calls ``dns.resolver.make_resolver_at()`` to
    make a resolver, and then uses it to resolve the query.

    See ``dns.resolver.Resolver.resolve`` for more information on the resolution
    parameters, and ``dns.resolver.make_resolver_at`` for information about the resolver
    parameters *where*, *port*, *family*, and *resolver*.

    If making more than one query, it is more efficient to call
    ``dns.resolver.make_resolver_at()`` and then use that resolver for the queries
    instead of calling ``resolve_at()`` multiple times.
    )r�r�)
r�r6r}r~rr�rr�r_rr�r�rs
             r�
resolve_atr��s=��8�E�4���:�B�B�
���������
�
rc
��|tjzdk7rt||||||�S|tjtjzzdk7r$tj
tjd��|�&|�$tj
tjd��g}d}|�t||||||�S	tjj|�t||||||�S#t$rYnwxYw	tj||�}|j�}|j�j!d�}nq#tj"j$$r%tj
tjd��t$r%tj
tj&d��wxYwd}		|�d}	nt)|�}	nK#t$r?|tj*zdk(r&	tj,|�}	n#t$rYnwxYwYnwxYw|	�$tj
tjd��g}
|dk(r!tj.tj0g}n|g}|tj2zdk7r|}nd}|D]R\}
}|D]H}t4|D]:}tjj7|
|	f|�}|
j9|||||f��<�J�Tt;|
�dk(r$tj
tjd��|
S)Nrz*Non-recoverable failure in name resolution�Name or service not knownTz$Temporary failure in name resolution�)r��AI_NUMERICHOST�_original_getaddrinfo�
AI_ADDRCONFIG�AI_V4MAPPED�gaierror�EAI_FAIL�
EAI_NONAMEr�r��af_for_addressr5�	_resolverr�r�r4rVrr�	EAI_AGAINr��AI_NUMERICSERV�
getservbyname�
SOCK_DGRAM�SOCK_STREAM�AI_CANONNAME�_protocols_for_socktype�low_level_address_tupler;r&)�host�servicer��socktype�protor;�addrsr4r�r��tuples�	socktypesr8�addr�af�
addr_tuples                r�_getaddrinfor*s���
�v�$�$�$��)�%�T�7�F�H�e�U�S�S���$�$�v�'9�'9�9�:�a�?��o�o��O�O�I�
�	
��|����o�o�f�/�/�1L�M�M��E��N��|�$�T�7�F�H�e�U�S�S�
�	������%�$�T�7�F�H�e�U�S�S���
��
��
X��(�(��v�6���.�.�0�� �/�/�1�9�9�$�?����<�<� � �N��o�o�f�/�/�1L�M�M��X��o�o�f�.�.�0V�W�W�	X��
�D���?��D��w�<�D�����6�(�(�(�A�-�
��+�+�G�4����
��
��	���|��o�o�f�/�/�1L�M�M�
�F��1�}��&�&��(:�(:�;�	��J�	��v�"�"�"�a�'������H���b�!�	H�H�0��:�
H�� �X�X�=�=�t�T�l�B�O�
��
�
�r�8�U�E�:�F�G�
H�	H�H�
�6�{�a���o�o�f�/�/�1L�M�M��MsV�1.C � 	C,�+C,�0AD6�6A.F$�*F;�;H�G1�0H�1	G=�:H�<G=�=H�Hc��|d}|d}t|�dk(r|d}tj}nd}tj}t	|||tj
tjd�}t|�dkDrtjd��|ddd}|tjzrd}nd}tjj|�}	|tjzdk(r@	tj|	d�}
|
jdj j#d	�}n|}|�|dt1|�zz
}|tj2zrt1|�}||fStj4||�}||fS#tj$j&tj$j(f$rO|tj*zr$tj,tj.d
��|}|�|dt1|�zz
}Y��wxYw)Nrr+�rVz'sockaddr resolved to multiple addresses�udprr�Tr��%)r&r�r�r�rr��SOL_TCP�error�NI_DGRAMr�r�r��NI_NUMERICHOSTr�r�r��targetrVrrrg�NI_NAMEREQDr�r�r/�NI_NUMERICSERV�
getservbyport)
�sockaddrr;r�r��scoper�r�r�pnamer6r��hostnamer�s
             r�_getnameinfor~s����A�;�D��A�;�D�
�8�}�����������������
�$��f�f�.@�.@�&�.�.�RS�
T�F�
�6�{�Q���l�l�D�E�E��!�9�Q�<��?�D��v���������O�O�(�(��.�E��v�$�$�$��)�	-��&�&�u�e�4�F��|�|�A��-�-�5�5�d�;�H�������c�%�j�(�(�H��v�$�$�$��d�)��
�g����&�&�t�U�3���g�������%�%�s�|�|�'<�'<�=�	-��v�)�)�)��o�o�f�&7�&7�9T�U�U��H�� ��C�#�e�*�,�,���	-�s�)>E9�9BG?�>G?c�r�|�tj�}	t|�\}}}|S#t$rY|SwxYwr)r�rk�_gethostbyaddrr5)r�r�s  r�_getfqdnr�sJ���|��!�!�#��
�%�d�+���q�!�
�K���
���K�
�s�)�	6�6c�$�t|�ddS)NrDr)�_gethostbyname_exr�s r�_gethostbynamer�s���T�"�1�%�a�(�(rc���g}g}t|dtjtjtjtj
�}|dd}|D]}|j
|dd��|||fS)NrrVr)rr�r�r�rr�r;)r��aliasesr�r��	canonical�items      rrr�sz���G��I�
��a�����!3�!3�V�^�^�V�EX�EX��F��q�	�!��I��%������a����$�%�
�w�	�*�*rc��	tjj|�|dddf}tj}t|tj�\}}g}g}t|d|tjtjtj�}|dd}tj j#||�}	|D]A}
|
dd}tj j#||�}|	|k(s�1|j%|��C|||fS#t
$rj	tjj|�n1#t
$r%tjtjd��wxYw|df}tj}Y��@wxYw)N�Prr�rVr)r��ipv6�	inet_atonr�r�r5�ipv4r�r�r�rr
rr�rr�r��	inet_ptonr;)
�iprr�r�r�rr�r�r�bin_iprr�bin_addrs
             rrr�sZ��
 ������2����A�q�>�������X�v�'9�'9�:�I�T�1��G��I�
��a���+�+�V�^�^�V�=P�=P��F��q�	�!��I��X�X�
�
���
+�F��#���A�w�q�z���8�8�%�%�f�d�3���X�����T�"�	#�
�w�	�*�*��1� �	R��H�H���r�"���	R��/�/�&�"3�"3�5P�Q�Q�	R����8������
 �s)�5D�	E8�D/�.E8�/.E�E8�7E8c���|�
t�}|att_t
t_tt_tt_
tt_tt_y)a�Override the system resolver routines in the socket module with
    versions which use dnspython's resolver.

    This can be useful in testing situations where you want to control
    the resolution behavior of python code without having to change
    the system's resolver settings (e.g. /etc/resolv.conf).

    The resolver to use may be specified; if it's not, the default
    resolver will be used.

    resolver, a ``dns.resolver.Resolver`` or ``None``, the resolver to use.
    N)r�r�rr��getaddrinfor�getnameinfor�getfqdnr�
gethostbynamer�gethostbyname_exr�
gethostbyaddr)rs r�override_system_resolverr/�sF����'�)���I�%�F��%�F���F�N�)�F��/�F��)�F�rc��datt_tt_tt_tt_	tt_tt_
y)z5Undo the effects of prior override_system_resolver().N)r�r�r�r)�_original_getnameinfor*�_original_getfqdnr+�_original_gethostbynamer,�_original_gethostbyname_exr-�_original_gethostbyaddrr.rSrr�restore_system_resolverr6�s8���I�.�F��.�F��&�F�N�2�F��8�F��2�F�rr�r�)rr)yrJrvr@r�rdr�r�r��typingrrrrrr	r
r�urllib.parser�dns._ddrr��dns.edns�
dns.exception�	dns.flags�dns.inet�dns.ipv4�dns.ipv6�dns.message�dns.name�dns.nameserver�	dns.query�	dns.rcode�dns.rdataclass�
dns.rdatatype�dns.rdtypes.svcbbase�dns.reversename�dns.tsigre�
dns.win32utilrK�DNSExceptionrrQr/r�r�r5r�r[r�rY�Timeoutr[rgrnrsrvrxrzr|r'r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r�r�r�r�r�rSr�r�rjr�r�r�r4r�r�r�r�r��SOL_UDPr�rr�r�r)r�r*r1r+r2r,r3r-r4r.r5rrrrrrr/r6rSrr�<module>rNs���$��
�
�
����N�N�N�!�������������������<�<�7���U/�s�}�}�)�)�U/�pC�s�}�}�)�)�C���S�M���	�)�S�.���S�[�[�
 �
 �!�	#��
��D��,���c���
�c�m�m�+�+�
�,��'�s�}�}�)�)�'�$
�C�M�M�.�.�
�2P�#�-�-�,�,�P�M��
�
�*�*�M�+�C�M�M�.�.�+�P�c�m�m�8�8�P�B�B�J@�d�@�.%�'�.%�b7�7�+�+�>�������
�
� 7� 7����9R�9R�R�S��LJ�I�LJ�^#�#�*l�y�l�^K!�K!�\P(�P(�f
[�|�[�~(,��(�8�$�+��h��"�36�-�-�/�/�58�^�^�5F�5F�� �#�� $�!���������#�$���#�-�-�)�)�3�.�/���3�>�>�,�,�c�1�
2��
�	�

�S�M���
����u�o��
�T�N����F36�-�-�/�/�58�^�^�5F�5F�� �#�� $���������#�$���#�-�-�)�)�3�.�/���3�>�>�,�,�c�1�
2��
�	�

�S�M���
����u�o����BK�C�K��K�s�K�v�K�4:�3C�3C�	G�
����
�
�s�"�
#�	G�-0�	G�OR�	G��	G�7��s�x�x�}�}�c�1�2�7�s�x�x�}�}�7�4�e�4�d�4�*-���):�):��#'� $�R�
����
�
�s�"�
#�R�
�^�^�
&�
&�R�
�R��x� �	R�
�u�o�R�	�X�X�]�]�
R�n��"�"�#'�	!��������#�$�!�

�!�
�!��x� �	!�
�!�N36�-�-�/�/�58�^�^�5F�5F�� �#�� $�!���"�"�#'�&��������#�$�&��������#�$�&�
�#�-�-�)�)�3�.�/�&��3�>�>�,�,�c�1�
2�	&�

�&�
�S�M�
&��&��&��u�o�&�
�T�N�&��&�
�&��x� �&��&�^������'�
������(���

�	��*�*���*�*���N�N�� �.�.��#�4�4�� �.�.��
�t�F�$4�$4�q��QR�Q�h$�N	�)�
+�+�@*�x��'9�*�T�*�4
3r

Zerion Mini Shell 1.0