
    i              #          U d 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ddlZddlZddl	Z	ddl
Z
ddlZddlmZmZmZmZ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ddl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	 ddl"Z"n# e#$ r	 ddl$m%Z" Y nw xY wd Z&d Z'ej(        )                    d          Z*e*rBddl+Z,ddl-Z-e,j.        Z/e,j0        j1        j2        Z3 G d de/          Z4 G d	 d
e-j5                  Z6n G d d
          Z6e*Z7dej8        e9z  dej:        de9dej        fdZ;e;Z<eej8        e9z  ej:        e9gej        f         e=d<    G d dej>        j?                  Z@ G d dej>        jA                  ZB G d dej>        j?                  ZC G d dej>        j?                  ZDejE        jF        ZFd ZGd ZHd ZId ZJd ZKd ZL	 d}d!ZM	 d~dej8        e9z  d"ej:        d#edz  dej        fd$ZN	 	 ddej8        e9z  d"ej:        d%e"jO        d&ejP        jQ        eRz  dz  d#edz  de"jS        fd'ZTd( ZUd)ed*         dd*fd+ZV G d, d-ejW                  ZXdd.ddd/d/dd0d dd dejY        eXjZ        fd1ej[        j\        d2eRd3e]dz  d4e9d#eRdz  d5e9d6e^d7e^d8edz  d9eRd:e^d;eRdz  d<e^eRz  e"jO        z  d)ed*         d=e9d>eXdej[        j\        f"d?Z_d@ej`        ja        dAebdebfdBZcd@ej`        ja        dCeRdDebddfdEZd	 	 	 	 	 	 	 	 	 dd1ej[        j\        d2eRdFeRd3e]dz  d4e9d#eRdz  d5e9d6e^d7e^d<e^eRz  e"jO        z  d:e^dGej`        je        dz  dej[        j\        fdHZfdI ZgdJ Zh	 d~dKedLej[        j\        ebz  dMedNe]dz  dee9e]f         f
dOZi	 	 	 	 	 	 	 	 	 	 ddKedMedz  dNe]dz  dQe^d6e^dReejP        jQ        ejj        jk        f         dz  dSebdz  d7e^dTe^dUe^dVej[        j\        dz  defdWZl	 	 	 	 	 	 	 	 	 	 dd1ej[        j\        d2eRd3e]dz  d4e9d#eRdz  d5e9dQe^d6e^d7e^dTe^dKedz  dUe^dej[        j\        fdYZm	 	 	 	 	 	 	 	 	 	 dd1ej[        j\        d2eRd3e]dz  d4e9d#eRdz  d5e9dQe^d6e^d7e^dZedz  d[edz  dUe^deej[        j\        e^f         fd\Znd] Zod^ Zp	 d~dKedLej[        j\        ebz  dNe]dz  dee9e]f         fd_Zq	 	 	 	 	 ddKedNe]dz  d6e^dReejP        jQ        ejj        jk        f         dz  dSebdz  d7e^deej[        j\        e]f         fd`Zrda Zs	 	 	 	 	 	 	 dd1ej[        j\        d2eRd3e]dz  d4e9d#eRdz  d5e9d6e^d7e^dKedz  dej[        j\        fdbZtdc Zu	 	 	 dd<e^eRz  dde^deeveR         dz  de"jO        fdfZwd&eRdz  d<e^eRz  de"jO        fdgZx	 	 	 	 	 	 	 	 	 	 dd1ej[        j\        d2eRd3e]dz  d4e9d#eRdz  d5e9d6e^d7e^dKe"jS        dz  d%e"jO        dz  d&eRdz  d<e^eRz  dej[        j\        fdiZy	 	 	 	 	 	 	 	 	 	 dd1ej[        j\        d2eRd3e]dz  d4e9d#eRdz  d5e9d6e^d7e^dGej`        je        dz  d<e^eRz  djeRdz  d&eRdz  dej[        j\        fdkZ` G dl dmejW                  Zzdnej{        j|        doej        e"jS        z  dVej[        j\        dpe9dz  d3e]dz  dNe]dz  defdqZ}ej~        j        ej        j        ddXddd ddddd/ejj        j        fd2eRdrejP        jQ        eRz  dsej~        j        eRz  dtej        j        eRz  d3e]dz  d4e9dReejP        jQ        ejj        jk        f         dz  duejP        jQ        eRz  dz  dve^dwe]dz  d#eRdz  d5e9dpe9dxe^dyejP        jQ        eRz  def dzZEddXddddezj        fd2eRdnej{        j|        dVej[        j\        dz  d4e9d3e]dz  dwe]dz  d#eRdz  d5e9d{ezddfd|ZdS )zTalk to a DNS server.    N)AnyCallableDictOptionalTuplecastc                 h    | d S | t          j                     z
  }|dk    rt          j        j        |S )N        )timedns	exceptionTimeout)
expirationtimeouts     Y/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/dns/query.py
_remainingr   5   s6    t49;;&G#~~m##N    c                 R    |d S t          t          j                    | z   |          S N)minr   )r   r   s     r   _expiration_for_this_attemptr   >   s(    tty{{W$j111r   dohc                   2     e Zd Z fdZ	 ddZ	 ddZ xZS )_NetworkBackendc                     t                                                       || _        || _        || _        || _        d S r   )super__init___local_port	_resolver_bootstrap_address_family)selfresolver
local_portbootstrap_addressfamily	__class__s        r   r   z_NetworkBackend.__init__M   s;    GG)D%DN&7D#!DLLLr   Nc                 x   g }t          |          \  }}t          j                            |          r|                    |           n| j        |                    | j                   nht          |          }| j        }	|rt          j                            |          }	| j	        
                    ||	|          }
|
                                }|D ]}t          j                            |          }|| j        dk    r,|d}t          j                            || j        f|          }nd }	 t          |t          j        |          }t#          d|          }t%          |t          j                            ||f|          |           t'          |          c S # t(          $ r Y w xY wt*          j        )N)r&   lifetimer   z0.0.0.0g       @)_compute_timesr   inet
is_addressappendr    r   r!   af_for_addressr   resolve_name	addressesr   low_level_address_tuplemake_socketsocketSOCK_STREAMr   _connect_CoreSyncStream	ExceptionhttpcoreConnectError)r"   hostportr   local_addresssocket_optionsr0   _r   r&   answersaddressafsourcesockattempt_expirations                   r   connect_tcpz_NetworkBackend.connect_tcpT   s    I*733MAzx""4(( 0  &&&&(4  !89999$Z00  D X44]CCF.55' 6   $--//	$  X,,W55 ,0@A0E0E$,(1 X==&(892 FF "F
&r6+=vFFD)Ec:)V)V&88'4"MM*  
 +400000    D''s   3A*F  
F-,F-c                     t           r   NotImplementedError)r"   pathr   r=   s       r   connect_unix_socketz#_NetworkBackend.connect_unix_socket}   s
     &%r   )NNNNN)__name__
__module____qualname__r   rE   rJ   __classcell__r'   s   @r   r   r   L   sm        	" 	" 	" 	" 	" PT'	( '	( '	( '	(T 6:	& 	& 	& 	& 	& 	& 	& 	&r   r   c                   4     e Zd Zdddej        d fd
Z xZS )_HTTPTransportr   Nr$   r%   r#   r&   c                    ||dd l }|j                                        } t                      j        |i | t          ||||          | j        _        d S Nr   )dns.resolverr#   Resolverr   r   r   _pool_network_backend)	r"   r$   r%   r#   r&   argskwargsr   r'   s	           r   r   z_HTTPTransport.__init__   sp     $5$=####<0022EGGd-f---*9*&7+ +DJ'''r   )rL   rM   rN   r3   	AF_UNSPECr   rO   rP   s   @r   rR   rR      sS         "#	 	 	 	 	 	 	 	 	 	 	r   rR   c                   0    e Zd Zdddej        ddZd ZdS )rR   r   NrS   c                    d S r    )r"   r$   r%   r#   r&   rZ   r[   s          r   r   z_HTTPTransport.__init__   s	     Dr   c                     t           r   rG   )r"   r:   r;   r   r<   s        r   rE   z_HTTPTransport.connect_tcp       %%r   )rL   rM   rN   r3   r\   r   rE   r_   r   r   rR   rR      sM         "#		 		 		 		 			& 	& 	& 	& 	&r   rA   kindprotoreturnc                 .    t          j         | ||          S r   )r3   )rA   rb   rc   s      r   default_socket_factoryrf      s    
 =T5)))r   socket_factoryc                       e Zd ZdZdS )UnexpectedSourcez=A DNS query response came from an unexpected address or port.NrL   rM   rN   __doc__r_   r   r   ri   ri      s        GGGGr   ri   c                       e Zd ZdZdS )BadResponsez<A DNS query response does not respond to the question asked.Nrj   r_   r   r   rm   rm      s        FFFFr   rm   c                       e Zd ZdZdS )NoDOHzMDNS over HTTPS (DOH) was requested but the httpx module is not
    available.Nrj   r_   r   r   ro   ro                 r   ro   c                       e Zd ZdZdS )NoDOQzNDNS over QUIC (DOQ) was requested but the aioquic module is not
    available.Nrj   r_   r   r   rr   rr      rp   r   rr   c                 B    t          j                     }| |d fS ||| z   fS r   )r   )r   nows     r   r*   r*      s+    
)++CT{S7]##r   c                    |r4t          | t          j                  r|                                 dk    rdS t	          j                    5 }d}|r|t          j        z  }|r|t          j        z  }|r|                    | |           |d }n-|t          j	                    z
  }|dk    rt          j        j        |                    |          st          j        j        	 d d d            d S # 1 swxY w Y   d S )Nr   Tr
   )
isinstancessl	SSLSocketpending	selectorsDefaultSelector
EVENT_READEVENT_WRITEregisterr   r   r   r   select)fdreadablewritabler>   r   seleventsr   s           r   	_wait_forr      sF     Jr3=11 bjjllQ6F6Ft		"	$	$ ( 	+i**F 	,i++F 	%LLV$$$GG 49;;.G#~~m++zz'"" 	(-''	(( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s   
BC--C14C1c                 ,    t          | ddd|           d S )NTFr   sr   s     r   _wait_for_readabler      s    audJ/////r   c                 ,    t          | ddd|           d S )NFTr   r   s     r   _wait_for_writabler      s    adJ/////r   c                    	 t           j                            | |d                   }t           j                            | |d                   }n# t           j        j        $ r Y dS w xY w||k    o|dd          |dd          k    S )Nr   F   )r   r+   	inet_ptonr   SyntaxError)rA   a1a2n1n2s        r   _addresses_equalr      s    XBqE**XBqE**=$   uu8(122"QRR&((s   AA A'&A'c                     |sdS t          | ||          s;t          j                            |d                   r|dd          |dd          k    rdS |rdS t	          d| d|           )NTr   r   Fzgot a response from z instead of )r   r   r+   is_multicastri   )rA   from_addressdestinationignore_unexpecteds       r   _matches_destinationr     s      tL+66 k!n--2>qrr2BkRSRTRTo2U2Ut	 u
J|JJ[JJ  r   Tc                 
   d }d }	 t           j                            |           }| }n# t          $ r |r Y nw xY w|r9t           j                            |          }|r||k    rt	          d          n|}|r@|s>	 t           j                            |          }n# t          $ r t	          d          w xY w|r"t           j                            ||f|          }|r"t           j                            ||f|          }|||fS )Nz5different address families for source and destinationz3source_port specified but address family is unknown)r   r+   r.   r7   
ValueError
any_for_afr1   )wherer;   rB   source_portwhere_must_be_addressrA   r   safs           r   _destination_and_sourcer     se   
 
BKX$$U++     		 	  h%%f-- 		byy K    B T6 T	TX((,,FF 	T 	T 	TRSSS	T
  Ph66T7JBOO M116;2GLLV$$s   !( 88;B B5typerB   c                     t          | |d          }	 |                    d           ||                    |           |S # t          $ r |                                  w xY w)aQ  Make a socket.

    This function uses the module's ``socket_factory`` to make a socket of the
    specified address family and type.

    *af*, a ``socket.AddressFamily`` or ``int`` is the address family, either
    ``socket.AF_INET`` or ``socket.AF_INET6``.

    *type*, a ``socket.SocketKind`` is the type of socket, e.g. ``socket.SOCK_DGRAM``,
    a datagram socket, or ``socket.SOCK_STREAM``, a stream socket.  Note that the
    ``proto`` attribute of a socket is always zero with this API, so a datagram socket
    will always be a UDP socket, and a stream socket will always be a TCP socket.

    *source* is the source address and port to bind to, if any.  The default is
    ``None`` which will bind to the wildcard address and a randomly chosen port.
    If not ``None``, it should be a (low-level) address tuple appropriate for *af*.
    r   F)rg   setblockingbindr7   close)rA   r   rB   r   s       r   r2   r2   D  sq    , 	r4##A	eFF6NNN   				s   -A  A!ssl_contextserver_hostnamec                     t          | ||          }t          |t          j        j                  r|                                }|                    |d|          S )a  Make a socket.

    This function uses the module's ``socket_factory`` to make a socket of the
    specified address family and type.

    *af*, a ``socket.AddressFamily`` or ``int`` is the address family, either
    ``socket.AF_INET`` or ``socket.AF_INET6``.

    *type*, a ``socket.SocketKind`` is the type of socket, e.g. ``socket.SOCK_DGRAM``,
    a datagram socket, or ``socket.SOCK_STREAM``, a stream socket.  Note that the
    ``proto`` attribute of a socket is always zero with this API, so a datagram socket
    will always be a UDP socket, and a stream socket will always be a TCP socket.

    If *ssl_context* is not ``None``, then it specifies the SSL context to use,
    typically created with ``make_ssl_context()``.

    If *server_hostname* is not ``None``, then it is the hostname to use for server
    certificate validation.  A valid hostname must be supplied if *ssl_context*
    requires hostname checking.

    *source* is the source address and port to bind to, if any.  The default is
    ``None`` which will bind to the wildcard address and a randomly chosen port.
    If not ``None``, it should be a (low-level) address tuple appropriate for *af*.
    F)do_handshake_on_connectr   )r2   rv   r   nameNameto_textwrap_socket)rA   r   r   r   rB   rC   s         r   make_ssl_socketr   e  sb    > r4((D/38=11 4)1133"" %' #   r   c                 N    |t          | ||||          S t          | ||          S r   )r   r2   )rA   r   rB   r   r   s        r   _make_socketr     s2     r4ovNNN2tV,,,r   r#   zdns.resolver.Resolverc                 D    | dd l }|j                                        } | S rU   )rV   r#   rW   )r#   r   s     r   _maybe_get_resolverr     s.     <((**Or   c                   .    e Zd ZdZdZdZdZdZdZdZ	dZ
dS )HTTPVersionzWhich version of HTTP should be used?

    DEFAULT will select the first version from the list [2, 1.1, 3] that
    is available.
    r   r         N)rL   rM   rN   rk   DEFAULTHTTP_1H1HTTP_2H2HTTP_3H3r_   r   r   r   r     s=          GF	
BF	
BF	
BBBr   r     Fz
/dns-queryqr   r   r;   r   one_rr_per_rrsetignore_trailingsessionrI   postr%   verifyr&   http_versionc                 $   t          ||||d          \  }}}|}|Tt          j                            |          r5|t          j        k    rd| d| |	 }n|t          j        k    r
d| d| |	 }i }|xt          j        	                    |          }|j
        t          d          t          j                            |j
                  r|j
        }|j
        |d<   |j        |j        }|t          j        k    s|t          j        k    rt           s|ft#          |          }|j
        J |                    |j
        |          }t'          j        t+          |                                                    }|r.t/          |t          j        j                  st          d	          t5          | ||||||||||
|
          S t           st6          |r)t/          |t8          j                  st          d          |                                 }ddi}|t          j        t          j        fv }|t          j         t          j        fv }|d}d}n|d         }|d         }|rtC          j"        |          }n/tG          ||||||||          }t9          j        ||||          }|5 }|J |
rM|$                    dtK          tM          |                    d           |'                    |||||          }nWtQ          j)        |          *                    d          }|+                                } |,                    |||d| i|          }ddd           n# 1 swxY w Y   |j-        dk     s|j-        dk    r!t          | d|j-         d|j.                   t          j/        0                    |j.        | j1        | j2        ||          }!|j3        4                                |!_5        | 6                    |!          stn          |!S )a	  Return the response obtained after sending a query via DNS-over-HTTPS.

    *q*, a ``dns.message.Message``, the query to send.

    *where*, a ``str``, the nameserver IP address or the full URL. If an IP address is
    given, the URL will be constructed using the following schema:
    https://<IP-address>:<port>/<path>.

    *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query
    times out. If ``None``, the default, wait forever.

    *port*, a ``int``, the port to send the query to. The default is 443.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source
    address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message. The default is
    0.

    *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset.

    *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the
    received message.

    *session*, an ``httpx.Client``.  If provided, the client session to use to send the
    queries.

    *path*, a ``str``. If *where* is an IP address, then *path* will be used to
    construct the URL to send the DNS query to.

    *post*, a ``bool``. If ``True``, the default, POST method will be used.

    *bootstrap_address*, a ``str``, the IP address to use to bypass resolution.

    *verify*, a ``bool`` or ``str``.  If a ``True``, then TLS certificate verification
    of the server is done using the default CA bundle; if ``False``, then no
    verification is done; if a `str` then it specifies the path to a certificate file or
    directory which will be used for verification.

    *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use for
    resolution of hostnames in URLs.  If not specified, a new resolver with a default
    configuration will be used; note this is *not* the default resolver as that resolver
    might have been configured to use DoH causing a chicken-and-egg problem.  This
    parameter only has an effect if the HTTP library is httpx.

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

    *http_version*, a ``dns.query.HTTPVersion``, indicating which HTTP version to use.

    Returns a ``dns.message.Message``.
    FNzhttps://:z	https://[z]:zno hostname in URLsni_hostnamez8session parameter must be a dns.quic.SyncQuicConnection.)r   r   
connectionz)session parameter must be an httpx.Clientacceptzapplication/dns-messager   r   )r<   http1http2r   r$   r%   r#   r&   )r   r   r   	transport)zcontent-typezcontent-length)headerscontentr   
extensions   =r   )r   r   paramsr      +   responded with status code z
Response body: keyringrequest_macr   r   )8r   r   r+   r,   r3   AF_INETAF_INET6urllibparseurlparsehostnamer   r;   r   r   r   have_dohr   r/   randomchoicelistr0   rv   quicSyncQuicConnection_http3ro   httpxClientto_wirer   r   
contextlibnullcontextrR   updatestrlenr   base64urlsafe_b64encoderstripdecodegetstatus_coder   message	from_wirer   r   elapsedtotal_secondsr   is_responserm   )"r   r   r   r;   rB   r   r   r   r   rI   r   r%   r   r#   r&   r   rA   r>   
the_sourceurlr   parsedr?   wirer   h1h2r<   r$   cmr   responsetwirers"                                     r   httpsr    s   N 2tV[% RJ C	~#(--e44~1U11T1411CC6?""3e33t3T33CJ &&s++?"12228v// 	9 &)/J~&;";D{~%%+++H+$*844H?...++FOVDDG &d73D3D3F3F.G.G H H 	Y:SX0
 
 	Y WXXX
 
 
 	
   Fz'5<88 FDEEE99;;D23G	+.+*=>	>B	+.+*=>	>B 

"1]
 
0:0Fw0O0O"'!/	
 	
 	
	 \Bv
 
 
 
 w """ 	NN$=&)#d))nn    ||% $  HH +D1188>>DKKMME{{u~% #  H+              > c!!X%9C%?%? 3 3(2F 3 3 ( 03 3
 
 	
 		M)' 	 	 	A ++--AF== Hs   *B+M!!M%(M%r   r   c                 F    | t           | D ]\  }}||k    r|c S t           r   )KeyError)r   r   headervalues       r   _find_headerr    s;       T>>LLL 
Nr   peerr   c                 P   t          | d          }|t          d          t          |          }|dk     rt          d          |dk     s|dk    rTd}t          |          dk    r)	 d|                                z   }n# t
          $ r Y nw xY wt          | d	| |           d S )
Ns   :statuszno :status header in responser   zstatus is negativer   r    z: r   )r  r   intr   r   r7   r   )r   r  r   r
  statuserrors         r   _check_statusr    s    *--E}9:::ZZFzz.///||v||t99q==t{{}},   DMMfMeMMNNN $|s   (B   
BBr   r   c                    t           j        j        st          d          t          j                            |          }|j        }|J |j        |j        }d| _	        | 
                                }|rt          j        d           }n$t           j                            |	|d          }|}|5  |r|}n|                    ||||          }t          |          \  }}|                    |          5 }|                    |||
           |                    t'          |                    }t)          |                                ||           d d d            n# 1 swxY w Y   t-          j                    }d d d            n# 1 swxY w Y   t           j                            || j        | j        ||          }t7          ||z
  d          |_        |                     |          st:          |S )Nz DNS-over-HTTP3 is not available.r   T)verify_modeserver_nameh3r   r
   )r   r   	have_quicro   r   r   r   r   r;   idr   r   r   SyncQuicManagerconnectr*   make_streamsend_h3receiver   r  r   r   r   r   r   r   maxr   rm   )r   r   r   r   r;   rB   r   r   r   r   r   r   	url_partsr   r   managerthe_managerthe_connectionstartr   streamfinishr  s                          r   r   r     ss    8 86777%%c**I!H~!~AD99;;D  5?5KD5Q5Q(**H + 
 
 	   	'NN(00tV[ N -W55
''00 	9FNN3d+++>>*Z"8"899D&..**E4888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9                		M)' 	 	 	A %%%AF== Hs8   1AF	6AEF	E#	#F	&E#	'F		FFc                 r    	 	 |                      |          S # t          $ r t          | |           Y nw xY w7)zReads a datagram from the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    )recvfromBlockingIOErrorr   )rC   max_sizer   s      r   	_udp_recvr*    sT    
1	1==*** 	1 	1 	1tZ00000	11s    55c                     	 	 |r|                      ||          S |                     |          S # t          $ r t          | |           Y nw xY wO)zSends the specified datagram to destination over the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    )sendtosendr(  r   )rC   datar   r   s       r   	_udp_sendr/    sn    
1	1 '{{4555yy& 	1 	1 	1tZ00000	11s   0 0 AArC   whatr   r   c                     t          |t          j        j                  r|                                }t          j                    }t          | |||          }||fS )a  Send a DNS message to the specified UDP socket.

    *sock*, a ``socket``.

    *what*, a ``bytes`` or ``dns.message.Message``, the message to send.

    *destination*, a destination tuple appropriate for the address family
    of the socket, specifying where to send the query.

    *expiration*, a ``float`` or ``None``, the absolute time at which
    a timeout exception should be raised.  If ``None``, no timeout will
    occur.

    Returns an ``(int, float)`` tuple of bytes sent and the sent time.
    )rv   r   r   Messager   r   r/  )rC   r0  r   r   	sent_timens         r   send_udpr5    sP    , $+,, ||~~	I$k:66Ay>r   r   r   r   r   raise_on_truncationignore_errorsqueryc                    d}	 t          | d|          \  }}t          | j        |||          s-t          j                    }	 t          j                            ||||||          }n[# t          j        j        $ r6}|	r.|
,|
                    |                                          sY d}~ d}~wt          $ r |	rY  w xY w|	r|
|
                    |          s|r||fS |||fS )a  Read a DNS message from a UDP socket.

    *sock*, a ``socket``.

    *destination*, a destination tuple appropriate for the address family
    of the socket, specifying where the message is expected to arrive from.
    When receiving a response, this would be where the associated query was
    sent.

    *expiration*, a ``float`` or ``None``, the absolute time at which
    a timeout exception should be raised.  If ``None``, no timeout will
    occur.

    *ignore_unexpected*, a ``bool``.  If ``True``, ignore responses from
    unexpected sources.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own
    RRset.

    *keyring*, a ``dict``, the keyring to use for TSIG.

    *request_mac*, a ``bytes`` or ``None``, the MAC of the request (for TSIG).

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing
    junk at end of the received message.

    *raise_on_truncation*, a ``bool``.  If ``True``, raise an exception if
    the TC bit is set.

    Raises if the message is malformed, if network errors occur, of if
    there is a timeout.

    If *destination* is not ``None``, returns a ``(dns.message.Message, float)``
    tuple of the received message and the received time.

    If *destination* is ``None``, returns a
    ``(dns.message.Message, float, tuple)``
    tuple of the received message, the received time, and the address where
    the message arrived from.

    *ignore_errors*, a ``bool``.  If various format errors or response
    mismatches occur, ignore them and keep listening for a valid response.
    The default is ``False``.

    *query*, a ``dns.message.Message`` or ``None``.  If not ``None`` and
    *ignore_errors* is ``True``, check that the received message is a response
    to this query, and if not keep listening for a valid response.
    r   T  )r   r   r   r   r6  N)
r*  r   r&   r   r   r   r   	Truncatedr   r7   )rC   r   r   r   r   r   r   r   r6  r7  r8  r   r   received_timer  es                   r   receive_udpr>    sS   | D(4(ujAA|#K{4E
 
 	 		%%'!1 /$7 &  AA {$ 	 	 	 %))!))++66 &  	 	 	 		
  	U.u7H7H7K7K. 	4}%%}l33s$   %A* *C>+B/.B//C C5   c                    |                                  }t          ||||d          \  }}}t          |          \  }}|
rt          j        |
          }n|J t          |t          j        |          }|5 }t          ||||           t          |||||| j
        | j        ||	||           \  }}||z
  |_        |s|                     |          st          |cddd           S # 1 swxY w Y   	 J )a  Return the response obtained after sending a query via UDP.

    *q*, a ``dns.message.Message``, the query to send

    *where*, a ``str`` containing an IPv4 or IPv6 address,  where
    to send the message.

    *timeout*, a ``float`` or ``None``, the number of seconds to wait before the
    query times out.  If ``None``, the default, wait forever.

    *port*, an ``int``, the port send the message to.  The default is 53.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying
    the source address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message.
    The default is 0.

    *ignore_unexpected*, a ``bool``.  If ``True``, ignore responses from
    unexpected sources.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own
    RRset.

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing
    junk at end of the received message.

    *raise_on_truncation*, a ``bool``.  If ``True``, raise an exception if
    the TC bit is set.

    *sock*, a ``socket.socket``, or ``None``, the socket to use for the
    query.  If ``None``, the default, a socket is created.  Note that
    if a socket is provided, it must be a nonblocking datagram socket,
    and the *source* and *source_port* are ignored.

    *ignore_errors*, a ``bool``.  If various format errors or response
    mismatches occur, ignore them and keep listening for a valid response.
    The default is ``False``.

    Returns a ``dns.message.Message``.
    TN)r   r   r*   r   r   r2   r3   
SOCK_DGRAMr5  r>  r   macr   r   rm   )r   r   r   r;   rB   r   r   r   r   r6  rC   r7  r   rA   r   
begin_timer   r  r   r  r<  s                        r   udprD    sk   p 99;;D 7tV[$! !Rf  .g66Z 80:0Ft0L0L~~~V.77	 qD+z222(IE
 
M +  	q!1!1 	)               , 	 s   6A"C%%C),C)udp_socktcp_sockc                     	 t          | ||||||||d|	|          }|dfS # t          j        j        $ r t	          | ||||||||
	  	        }|dfcY S w xY w)a|  Return the response to the query, trying UDP first and falling back
    to TCP if UDP results in a truncated response.

    *q*, a ``dns.message.Message``, the query to send

    *where*, a ``str`` containing an IPv4 or IPv6 address,  where to send the message.

    *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query
    times out.  If ``None``, the default, wait forever.

    *port*, an ``int``, the port send the message to.  The default is 53.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source
    address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message. The default is
    0.

    *ignore_unexpected*, a ``bool``.  If ``True``, ignore responses from unexpected
    sources.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own RRset.

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing junk at end of the
    received message.

    *udp_sock*, a ``socket.socket``, or ``None``, the socket to use for the UDP query.
    If ``None``, the default, a socket is created.  Note that if a socket is provided,
    it must be a nonblocking datagram socket, and the *source* and *source_port* are
    ignored for the UDP query.

    *tcp_sock*, a ``socket.socket``, or ``None``, the connected socket to use for the
    TCP query.  If ``None``, the default, a socket is created.  Note that if a socket is
    provided, it must be a nonblocking connected stream socket, and *where*, *source*
    and *source_port* are ignored for the TCP query.

    *ignore_errors*, a ``bool``.  If various format errors or response mismatches occur
    while listening for UDP, ignore them and keep listening for a valid response. The
    default is ``False``.

    Returns a (``dns.message.Message``, tcp) tuple where tcp is ``True`` if and only if
    TCP was used.
    TF)rD  r   r   r;  tcp)r   r   r   r;   rB   r   r   r   r   rE  rF  r7  r  s                r   udp_with_fallbackrI    s    r 
 
 %  ;       

 

 $ s     /AAc                 @   d}|dk    r	 |                      |          }|dk    rt          d          |t          |          z  }||z  }nL# t          t          j        f$ r t          | |           Y n$t          j        $ r t          | |           Y nw xY w|dk    |S )zRead the specified number of bytes from sock.  Keep trying until we
    either get the desired amount, or we hit EOF.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    r   r   EOF)	recvEOFErrorr   r(  rw   SSLWantReadErrorr   SSLWantWriteErrorr   )rC   countr   r   r4  s        r   	_net_readrQ  7  s     	A
!))		1		%  ACxxuoo%SVVOEFAA!56 	1 	1 	1tZ00000$ 	1 	1 	1tZ00000	1 !)) Hs   AA &B4BBc                     d}t          |          }||k     rv	 ||                     ||d                   z  }nL# t          t          j        f$ r t          | |           Y n$t          j        $ r t          | |           Y nw xY w||k     tdS dS )zWrite the specified data to the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    r   N)r   r-  r(  rw   rO  r   rN  r   )rC   r.  r   currentls        r   
_net_writerU  L  s    
 GD		A
A++	1tyyghh000GG!67 	1 	1 	1tZ00000# 	1 	1 	1tZ00000	1 A++++++s    : &B"BBc                 $   t          |t          j        j                  r|                    d          }n&t          |                              dd          |z   }t          j                    }t          | ||           t          |          |fS )a{  Send a DNS message to the specified TCP socket.

    *sock*, a ``socket``.

    *what*, a ``bytes`` or ``dns.message.Message``, the message to send.

    *expiration*, a ``float`` or ``None``, the absolute time at which
    a timeout exception should be raised.  If ``None``, no timeout will
    occur.

    Returns an ``(int, float)`` tuple of bytes sent and the sent time.
    T)prepend_lengthr   big)	rv   r   r   r2  r   r   to_bytesr   rU  )rC   r0  r   tcpmsgr3  s        r   send_tcpr[  \  s    $ $+,, 5T22
 T##Au--4	ItVZ(((KK##r   c                     t          | d|          }t          j        d|          \  }t          | ||          }t          j                    }	t          j                            |||||          }
|
|	fS )a  Read a DNS message from a TCP socket.

    *sock*, a ``socket``.

    *expiration*, a ``float`` or ``None``, the absolute time at which
    a timeout exception should be raised.  If ``None``, no timeout will
    occur.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own
    RRset.

    *keyring*, a ``dict``, the keyring to use for TSIG.

    *request_mac*, a ``bytes`` or ``None``, the MAC of the request (for TSIG).

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing
    junk at end of the received message.

    Raises if the message is malformed, if network errors occur, of if
    there is a timeout.

    Returns a ``(dns.message.Message, float)`` tuple of the received message
    and the received time.
    r   !Hr   )rQ  structunpackr   r   r   r   )rC   r   r   r   r   r   ldatarT  r   r<  r  s              r   receive_tcpra  z  s}    B dAz**E=u%%DQT1j))DIKKM)' 	 	 	A }r   c                 N   |                      |          }|dk    rd S |t          j        t          j        t          j        fv r:t          | |           |                     t          j        t          j	                  }|dk    r"t          |t          j        |                    d S rU   )
connect_exerrnoEINPROGRESSEWOULDBLOCKEALREADYr   
getsockoptr3   
SOL_SOCKETSO_ERROROSErrorosstrerror)r   r@   r   errs       r   r5   r5     s    
,,w

C
axx
u %"3U^DDD1j)))ll6,fo>>
axxc2;s++,,, xr   c	           	         |                                  }	t          |          \  }
}|rt          j        |          }n6t	          ||||d          \  }}}|J t          |t          j        |          }|5 }|st          |||           t          ||	|           t          |||| j        | j        |          \  }}||
z
  |_        |                     |          st          |cddd           S # 1 swxY w Y   	 J )a  Return the response obtained after sending a query via TCP.

    *q*, a ``dns.message.Message``, the query to send

    *where*, a ``str`` containing an IPv4 or IPv6 address, where
    to send the message.

    *timeout*, a ``float`` or ``None``, the number of seconds to wait before the
    query times out.  If ``None``, the default, wait forever.

    *port*, an ``int``, the port send the message to.  The default is 53.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying
    the source address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message.
    The default is 0.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own
    RRset.

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing
    junk at end of the received message.

    *sock*, a ``socket.socket``, or ``None``, the connected socket to use for the
    query.  If ``None``, the default, a socket is created.  Note that
    if a socket is provided, it must be a nonblocking connected stream
    socket, and *where*, *port*, *source* and *source_port* are ignored.

    Returns a ``dns.message.Message``.
    TN)r   r*   r   r   r   r2   r3   r4   r5   r[  ra  r   rB  r   r   rm   )r   r   r   r;   rB   r   r   r   rC   r   rC  r   r  rA   r   r   r  r<  s                     r   rH  rH    sg   V 99;;D-g66Z 90:0Ft0L0L$;4d%
 %
![& ~~~V/88	 q 	1QZ000D*%%%(z+QY
 
M +}}Q 	                	 s   6A-C00C47C4c                     	 	 |                                   d S # t          j        $ r t          | |           Y n$t          j        $ r t          | |           Y nw xY w]r   )do_handshakerw   rN  r   rO  r   r   s     r   _tls_handshakerr    s    .	.NNF# 	. 	. 	.q*-----$ 	. 	. 	.q*-----	..s    AAAcheck_hostnamealpnsc                    t           j                            |           \  }}t          j        ||          }t          j        j        |_        ||_        | du rt          j	        |_
        ||                    |           |S )aQ  Make an SSL context

    If *verify* is ``True``, the default, then certificate verification will occur using
    the standard CA roots.  If *verify* is ``False``, then certificate verification will
    be disabled.  If *verify* is a string which is a valid pathname, then if the
    pathname is a regular file, the CA roots will be taken from the file, otherwise if
    the pathname is a directory roots will be taken from the directory.

    If *check_hostname* is ``True``, the default, then the hostname of the server must
    be specified when connecting and the server's certificate must authorize the
    hostname.  If ``False``, then hostname checking is disabled.

    *aplns* is ``None`` or a list of TLS ALPN (Application Layer Protocol Negotiation)
    strings to use in negotiation.  For DNS-over-TLS, the right value is `["dot"]`.
    )cafilecapathF)r   	_tls_util#convert_verify_to_cafile_and_capathrw   create_default_context
TLSVersionTLSv1_2minimum_versionrs  	CERT_NONEr  set_alpn_protocols)r   rs  rt  rv  rw  r   s         r   make_ssl_contextr    s|    ( ]FFvNNNFF,F6JJJK #&."8K!/K"%-&&u---r   c                 *    t          || d udg          S )Ndot)r  )r   r   s     r   _make_dot_ssl_contextr  '  s     FO4$?%IIIr   U  c                 J   |rt          | ||||||||	  	        S |                                 }t          |          \  }}t          ||||d          \  }}}|J |	t	          ||
dudg          }	t          |t          j        |	|
|          5 }t          |||           t          ||           t          |||           t          |||| j        | j        |          \  }}||z
  |_        |                     |          st           |cddd           S # 1 swxY w Y   	 J )ak  Return the response obtained after sending a query via TLS.

    *q*, a ``dns.message.Message``, the query to send

    *where*, a ``str`` containing an IPv4 or IPv6 address,  where
    to send the message.

    *timeout*, a ``float`` or ``None``, the number of seconds to wait before the
    query times out.  If ``None``, the default, wait forever.

    *port*, an ``int``, the port send the message to.  The default is 853.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying
    the source address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message.
    The default is 0.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own
    RRset.

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing
    junk at end of the received message.

    *sock*, an ``ssl.SSLSocket``, or ``None``, the socket to use for
    the query.  If ``None``, the default, a socket is created.  Note
    that if a socket is provided, it must be a nonblocking connected
    SSL stream socket, and *where*, *port*, *source*, *source_port*,
    and *ssl_context* are ignored.

    *ssl_context*, an ``ssl.SSLContext``, the context to use when establishing
    a TLS connection. If ``None``, the default, creates one with the default
    configuration.

    *server_hostname*, a ``str`` containing the server's hostname.  The
    default is ``None``, which means that no hostname is known, and if an
    SSL context is created, hostname checking will be disabled.

    *verify*, a ``bool`` or ``str``.  If a ``True``, then TLS certificate verification
    of the server is done using the default CA bundle; if ``False``, then no
    verification is done; if a `str` then it specifies the path to a certificate file or
    directory which will be used for verification.

    Returns a ``dns.message.Message``.

    TNr  )r   r   rB   )rH  r   r*   r   r  r   r3   r4   r5   rr  r[  ra  r   rB  r   r   rm   )r   r   r   r;   rB   r   r   r   rC   r   r   r   r   rC  r   rA   r   r   r  r<  s                       r   tlsr  -  s   z  
 

 

 
	
 99;;D-g66Z 7tV[$! !Rf >>>&vd/JUGTT	
'
 
 
  
K,,,q*%%%D*%%%(z+QY
 
M +}}Q 	!               $ 	 s   A;DDDr   c                 @   t           j        j        st          d          ||
|}
d| _        |                                 }|rt          j        d          }|}n#t           j                            |	|
          }|}|5  |s|	                    ||||          }t          |          \  }}|                    |          5 }|                    |d           |                    t          |                    }ddd           n# 1 swxY w Y   t          j                    }ddd           n# 1 swxY w Y   t           j                            || j        | j        ||          }t)          ||z
  d          |_        |                     |          st,          |S )a  Return the response obtained after sending a query via DNS-over-QUIC.

    *q*, a ``dns.message.Message``, the query to send.

    *where*, a ``str``, the nameserver IP address.

    *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query
    times out. If ``None``, the default, wait forever.

    *port*, a ``int``, the port to send the query to. The default is 853.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source
    address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message. The default is
    0.

    *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset.

    *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the
    received message.

    *connection*, a ``dns.quic.SyncQuicConnection``.  If provided, the connection to use
    to send the query.

    *verify*, a ``bool`` or ``str``.  If a ``True``, then TLS certificate verification
    of the server is done using the default CA bundle; if ``False``, then no
    verification is done; if a `str` then it specifies the path to a certificate file or
    directory which will be used for verification.

    *hostname*, a ``str`` containing the server's hostname or ``None``.  The default is
    ``None``, which means that no hostname is known, and if an SSL context is created,
    hostname checking will be disabled.  This value is ignored if *url* is not
    ``None``.

    *server_hostname*, a ``str`` or ``None``.  This item is for backwards compatibility
    only, and has the same meaning as *hostname*.

    Returns a ``dns.message.Message``.
    zDNS-over-QUIC is not available.Nr   )r  r  Tr   r
   )r   r   r  rr   r  r   r   r   r  r  r*   r  r-  r  r   r   r   r   r   r   r  r   rm   )r   r   r   r;   rB   r   r   r   r   r   r   r   r   r   r"  r!  r#  r   r$  r%  r  s                        r   r   r     s*   n 8 75666"x'7"AD99;;D  5?5KD5Q5Q#(**H + 
 
 	 	 	 	(00tV[ N -W55
''00 	:FKKd###>>*Z"8"899D	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 		M)' 	 	 	A %%%AF== Hs7    AD19D;D1D	D1D	D11D58D5c                       e Zd ZdZdZdZdZdS )UDPModea  How should UDP be used in an IXFR from :py:func:`inbound_xfr()`?

    NEVER means "never use UDP; always use TCP"
    TRY_FIRST means "try to use UDP but fall back to TCP if needed"
    ONLY means "raise ``dns.xfr.UseTCP`` if trying UDP does not succeed"
    r   r   r   N)rL   rM   rN   rk   NEVER	TRY_FIRSTONLYr_   r   r   r  r    s)          EIDDDr   r  txn_managerr   serialc              #     K   |j         d         j        }|t          j        j        k    }|                                 }|                                }	t          |t          j                  o|j	        t          j
        k    }
|
rt          ||	d|           n6t          j        dt          |	                    |	z   }t          |||           t          j                            | |||
          5 }d}d}d}|st%          |          \  }}||||k    r|}|
rt'          |d|          \  }}n9t)          |d|          }t          j        d|          \  }t)          |||          }t          j                            ||j        |j        d|||
 |          }|                    |          }|V  |j        }||j        r(|&|j        st          j                            d	          ddd           dS # 1 swxY w Y   dS )
z'Given a socket, does the zone transfer.r   Nr]  Fr:  r   T)r   r   xfrorigintsig_ctxmultir   zmissing TSIG)questionrdtyper   	rdatatypeIXFRfrom_wire_originr   rv   r3   r   rA  r/  r^  packr   rU  r  Inboundr*   r*  rQ  r_  r   r   r   rB  process_messager  had_tsigr   	FormError)r  r   r8  r  r   r   r  is_ixfrr  r   is_udprZ  inbounddoner  r  r>   mexpirationrwirer`  rT  s                        r   _inbound_xfrr    sY      ^A%F**G))++F==??D6=))Iaf8I.IF *!T4,,,,T3t99--41fj)))	fff	=	= :(, 	"-g66Q"&;+C+C( 5&q%==
!!Q44}T511!!Q44%%!I!!z!( & 	 	A **1--DGGGzH1  	"2 = 	:Q]1:]-)).999=: : : : : : : : : : : : : : : : : :s   .C:G55G9<G9zoner  rdclasskeyname
relativizer)   use_udpkeyalgorithmc           	   #      K    G d dt           j        j                  }t          |t                    rt           j                            |          }t           j        j        	                    |          }t           j
                            |||          }|t           j        j        k    rx|                    |j        |t           j        j        t           j        j        d          }t           j                            ddd| d          }|                    |d	           ||                    |||           t+          | ||
|d          \  }}}
|J t-          |	          \  }} |||          }|r$|t           j        j        k    rt/          d          |rt0          j        nt0          j        }t7          |||
          5 }t9          |||           t;          ||||||          E d
{V  d
d
d
           d
S # 1 swxY w Y   d
S )a  Return a generator for the responses to a zone transfer.

    *where*, a ``str`` containing an IPv4 or IPv6 address,  where
    to send the message.

    *zone*, a ``dns.name.Name`` or ``str``, the name of the zone to transfer.

    *rdtype*, an ``int`` or ``str``, the type of zone transfer.  The
    default is ``dns.rdatatype.AXFR``.  ``dns.rdatatype.IXFR`` can be
    used to do an incremental transfer instead.

    *rdclass*, an ``int`` or ``str``, the class of the zone transfer.
    The default is ``dns.rdataclass.IN``.

    *timeout*, a ``float``, the number of seconds to wait for each
    response message.  If None, the default, wait forever.

    *port*, an ``int``, the port send the message to.  The default is 53.

    *keyring*, a ``dict``, the keyring to use for TSIG.

    *keyname*, a ``dns.name.Name`` or ``str``, the name of the TSIG
    key to use.

    *relativize*, a ``bool``.  If ``True``, all names in the zone will be
    relativized to the zone origin.  It is essential that the
    relativize setting matches the one specified to
    ``dns.zone.from_xfr()`` if using this generator to make a zone.

    *lifetime*, a ``float``, the total number of seconds to spend
    doing the transfer.  If ``None``, the default, then there is no
    limit on the time the transfer may take.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying
    the source address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message.
    The default is 0.

    *serial*, an ``int``, the SOA serial number to use as the base for
    an IXFR diff sequence (only meaningful if *rdtype* is
    ``dns.rdatatype.IXFR``).

    *use_udp*, a ``bool``.  If ``True``, use UDP (only meaningful for IXFR).

    *keyalgorithm*, a ``dns.name.Name`` or ``str``, the TSIG algorithm to use.

    Raises on errors, and so does the generator.

    Returns a generator of ``dns.message.Message`` objects.
    c                   f    e Zd Zd Zd Zdej        j        fdZd Z	d
de
dej        j        fdZd	S )$xfr.<locals>.DummyTransactionManagerc                 @    |||rt           j        j        n|f| _        d S r   )r   r   emptyinfo)r"   r  r  s      r   r   z-xfr.<locals>.DummyTransactionManager.__init__  s!    z-USX^^vVDIIIr   c                     | j         S r   )r  r"   s    r   origin_informationz7xfr.<locals>.DummyTransactionManager.origin_information  s
    9r   rd   c                     t           r   rG   r  s    r   	get_classz.xfr.<locals>.DummyTransactionManager.get_class  ra   r   c                     t           r   rG   r  s    r   readerz+xfr.<locals>.DummyTransactionManager.reader  ra   r   Freplacementc                 j     G d d          }t          t          j        j         |                      S )Nc                       e Zd Zd Zd ZdS )Exfr.<locals>.DummyTransactionManager.writer.<locals>.DummyTransactionc                     d S r   r_   )r"   rZ   kws      r   nopzIxfr.<locals>.DummyTransactionManager.writer.<locals>.DummyTransaction.nop  s    Dr   c                     | j         S r   )r  )r"   r>   s     r   __getattr__zQxfr.<locals>.DummyTransactionManager.writer.<locals>.DummyTransaction.__getattr__  s	    8Or   N)rL   rM   rN   r  r  r_   r   r   DummyTransactionr    s2          $ $ $ $ $r   r  )r   r   transactionTransaction)r"   r  r  s      r   writerz+xfr.<locals>.DummyTransactionManager.writer  sK    $ $ $ $ $ $ $ $ 35E5E5G5GHHHr   N)F)rL   rM   rN   r   r  r   
rdataclass
RdataClassr  r  boolr  r  r  r_   r   r   DummyTransactionManagerr    s        	W 	W 	W	 	 		&s~8 	& 	& 	& 	&	& 	& 	&	I 	Id 	Is7R 	I 	I 	I 	I 	I 	Ir   r  T)createINSOAz. . z 0 0 0 0r   N)	algorithmzcannot do a UDP AXFR)r   r  TransactionManagerrv   r   r   	from_textr  	RdataTypemaker   
make_queryr  
find_rrset	authorityr  r  r  rdataadduse_tsigr   r*   r   r3   rA  r4   r2   r5   r  )r   r  r  r  r   r;   r   r  r  r)   rB   r   r  r  r  r  r   rrsetsoarA   r   r>   r   tm	sock_typer   s                             r   r  r  ;  s|     JI I I I I#/"D I I I. $ (x!!$'']$))&11FtVW55A###Ks~0#-2CD  
 
 i!!$/Ff/F/F/FGG		#q	

7G|
<<< 7tV[$! !Rf >>>$X..OQ
	 	 z	2	2B 16S]////000%,D!!&2DI	RF	+	+ GqK,,,Aq&':FFFFFFFFFG G G G G G G G G G G G G G G G G Gs   
,HH
Hudp_modec	           	      8   |#t           j                            |          \  }}	nt           j                            |          }	t	          | |||d          \  }
}}|
J t          |          \  }}|j        d         j        t           j        j	        k    r|t          j        k    rt          |
t          j        |          5 }t          |||           	 t!          ||||	||          D ]}	 ddd           dS # t           j        j        $ r |t          j        k    r Y nw xY w	 ddd           n# 1 swxY w Y   t          |
t          j        |          5 }t          |||           t!          ||||	||          D ]}	 ddd           dS # 1 swxY w Y   dS )a  Conduct an inbound transfer and apply it via a transaction from the
    txn_manager.

    *where*, a ``str`` containing an IPv4 or IPv6 address,  where
    to send the message.

    *txn_manager*, a ``dns.transaction.TransactionManager``, the txn_manager
    for this transfer (typically a ``dns.zone.Zone``).

    *query*, the query to send.  If not supplied, a default query is
    constructed using information from the *txn_manager*.

    *port*, an ``int``, the port send the message to.  The default is 53.

    *timeout*, a ``float``, the number of seconds to wait for each
    response message.  If None, the default, wait forever.

    *lifetime*, a ``float``, the total number of seconds to spend
    doing the transfer.  If ``None``, the default, then there is no
    limit on the time the transfer may take.

    *source*, a ``str`` containing an IPv4 or IPv6 address, specifying
    the source address.  The default is the wildcard address.

    *source_port*, an ``int``, the port from which to send the message.
    The default is 0.

    *udp_mode*, a ``dns.query.UDPMode``, determines how UDP is used
    for IXFRs.  The default is ``dns.query.UDPMode.NEVER``, i.e. only use
    TCP.  Other possibilities are ``dns.query.UDPMode.TRY_FIRST``, which
    means "try UDP but fallback to TCP if needed", and
    ``dns.query.UDPMode.ONLY``, which means "try UDP and raise
    ``dns.xfr.UseTCP`` if it does not succeed.

    Raises on errors.
    NTr   )r   r  r  extract_serial_from_queryr   r*   r  r  r  r  r  r  r2   r3   rA  r5   r  UseTCPr  r4   )r   r  r8  r;   r   r)   rB   r   r  r  rA   r   r>   r   r   s                  r   inbound_xfrr    s`   ^ }',,[9922599 7tV[$! !Rf >>>$X..OQ
~a3=#555(gm:S:SV.77 
	1QZ000%E67J   A 
	 
	 
	 
	 
	 
	 
	 
	 7>   w|++ ,++
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
R+V	4	4 K,,,k1eVWjQQ 	 	A	                 sB   D2C::%D"D2!D""D22D69D6)FFF)Tr   rK   )	Nr   Nr   FFTTN)
NNFFNr   FFFN)
Nr?  Nr   FFFFNF)
Nr?  Nr   FFFNNF)NFNr   F)Nr?  Nr   FFN)TTN)
Nr  Nr   FFNNNT)
Nr  Nr   FFNTNN)rk   r   r   enumrd  rl  r   rz   r3   r^  r   urllib.parser   typingr   r   r   r   r   r   dns._featuresr   dns._tls_utildns.exceptiondns.inetdns.messagedns.namedns.quic	dns.rdatadns.rdataclassdns.rdatatypedns.transactiondns.tsigdns.xfrrw   ImportErrordns._no_ssl_no_sslr   r   	_featureshave_have_httpxhttpcore._backends.syncr8   r   NetworkBackend_CoreNetworkBackend	_backendssync
SyncStreamr6   r   HTTPTransportrR   r   AddressFamilyr  
SocketKindrf   rg   __annotations__r   DNSExceptionri   r  rm   ro   rr   r  TransferErrorr*   r   r   r   r   r   r   r2   
SSLContextr   r   r   rx   r   r   r   IntEnumr   r\   r   r   r2  floatr  r  r   Headersbytesr  r  r   r   r*  r/  r5  tsigKeyr>  rD  rI  rQ  rU  r[  ra  r5   rH  rr  r   r  r  r  r  r  r  r  r  AXFRr  r  default_algorithmr  r  r  r  r_   r   r   <module>r     sc  $           				             = = = = = = = = = = = = = = = =                                     JJJJ     2 2 2 m  '' `&""""LLL"1(-8O4& 4& 4& 4& 4&- 4& 4& 4&l    ,    ,& & & & & & & &  *s"*

* * ]	* * * *  C!2C8&-G   
H H H H Hs}1 H H HG G G G G#-) G G G    CM&   
    CM&    %$ $ $( ( (80 0 00 0 0	) 	) 	)  " =A)% )% )% )%^  s"

 $J ]	   J 37' 's"'

' ' X]S(4/	'
 $J' 	]' ' ' 'V
- 
- 
-./       $,   & !"!$(*.26" + 3!L L
{LL T\L 	L
 $JL L L L 4ZL L L TzL 3J'L ./L L  !L" 	[#L L L L^#(* % E    O38+ O3 Oe O O O O O* !"!*.59: :
{:: 
: T\	:
 : $J: : : : 3J': : +d2: 	[: : : :z	1 	1 	11 1 1&  $	 

+

%  	
 3:   > ###"8< #! %(,g4 g4
g4tg4 g4 	g4
 g4 #(--.5g4 g4 g4 g4 g4 ;%g4 	g4 g4 g4 g4Z !#"! %Y Y
{YY T\Y 	Y
 $JY Y Y Y Y Y *Y Y 	[Y Y Y Y~ !#"!U  U 
{U U  T\U  	U 
 $JU  U  U  U  U  DjU  DjU  U  3;$%U  U  U  U p  *1 1 1&  $$ $
$
+

%$ $ 3:	$ $ $ $@  $"8< #!, ,
,, , #(--.5	,
 , , 3;%&, , , ,^- - - !"!C C
{CC T\C 	C
 $JC C C C *C 	[C C C CL. . . " 3J 9t 	^	   DJ4ZJ)-J^J J J J !"!!%)-"&i i
{ii T\i 	i
 $Ji i i i -$
i $&i 4Zi 3Ji 	[i i i i^ !"!59"&^ ^
{^^ T\^ 	^
 $J^ ^ ^ ^ +d2^ 3J^ Dj^ 4Z^ 	[^ ^ ^ ^B
 
 
 
 
dl 
 
 
1:31:}s}$1: ;1: $J	1:
 T\1: 1: 	1: 1: 1: 1:n -0M,>/2~/@ 8<*.!(+(BsG sGsG
(-#
sG M#c)sG ^&,	sG
 T\sG sG #(--.5sG X]S 4'sG sG dlsG $JsG sG sG sG (-#%sG  	!sG sG sG sGr )- !I II3I ;%I 	I
 T\I dlI $JI I I 
I I I I I Is   5A: :BB