o
    ¨Ýjöð  ã                #   @   s”	  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zddl"Z"W n e#yˆ   ddl$m%Z" Y nw dd„ Z&dd„ Z'ej( )d¡Z*e*r»ddl+Z,ddl-Z-e,j.Z/e,j0j1j2Z3G d	d
„ d
e/ƒZ4G dd„ de-j5ƒZ6nG dd„ dƒZ6e*Z7dej8e9B dej:de9dejfdd„Z;e;Z<eej8e9B ej:e9gejf e=d< G dd„ dej>j?ƒZ@G dd„ dej>jAƒZBG dd„ dej>j?ƒZCG dd„ dej>j?ƒZDejEjFZFdd„ ZGdd „ ZHd!d"„ ZId#d$„ ZJd%d&„ ZKd'd(„ ZL	)d£d*d+„ZM	d¤dej8e9B d,ej:d-edB dejfd.d/„ZN		d¥dej8e9B d,ej:d0e"jOd1ejPjQeRB dB d-edB de"jSfd2d3„ZTd4d5„ ZUd6ed7 dd7fd8d9„ZVG d:d;„ d;ejWƒZXdd<ddd=d=dd>d)dd)dejYeXjZfd?ej[j\d@eRdAe]dB dBe9d-eRdB dCe9dDe^dEe^dFedB dGeRdHe^dIeRdB dJe^eRB e"jOB d6ed7 dKe9dLeXdej[j\f"dMdN„Z_dOej`jadPebdebfdQdR„ZcdOej`jadSeRdTebddfdUdV„Zd		<			=	=	)	)	d¦d?ej[j\d@eRdWeRdAe]dB dBe9d-eRdB dCe9dDe^dEe^dJe^eRB e"jOB dHe^dXej`jedB dej[j\fdYdZ„Zfd[d\„ Zgd]d^„ Zh	d¤d_ed`ej[j\ebB daedbe]dB dee9e]f f
dcdd„Zi			=	=		e	=	=	=	d§d_edaedB dbe]dB dfe^dDe^dgeejPjQejjjkf dB dhebdB dEe^die^dje^dkej[j\dB defdldm„Zl		n			=	=	=	=		=d¨d?ej[j\d@eRdAe]dB dBe9d-eRdB dCe9dfe^dDe^dEe^die^d_edB dje^dej[j\fdodp„Zm		n			=	=	=			=d©d?ej[j\d@eRdAe]dB dBe9d-eRdB dCe9dfe^dDe^dEe^dqedB dredB dje^deej[j\e^f fdsdt„Zndudv„ Zodwdx„ Zp	d¤d_ed`ej[j\ebB dbe]dB dee9e]f fdydz„Zq		=		e	=dªd_edbe]dB dDe^dgeejPjQejjjkf dB dhebdB dEe^deej[j\e]f fd{d|„Zrd}d~„ Zs		n			=	=	d«d?ej[j\d@eRdAe]dB dBe9d-eRdB dCe9dDe^dEe^d_edB dej[j\fdd€„Ztd�d‚„ Zu	)	)	d¬dJe^eRB dƒe^d„eveR dB de"jOfd…d†„Zwd1eRdB dJe^eRB de"jOfd‡dˆ„Zx		‰			=	=				)d­d?ej[j\d@eRdAe]dB dBe9d-eRdB dCe9dDe^dEe^d_e"jSdB d0e"jOdB d1eRdB dJe^eRB dej[j\fdŠd‹„Zy		‰			=	=		)		d®d?ej[j\d@eRdAe]dB dBe9d-eRdB dCe9dDe^dEe^dXej`jedB dJe^eRB dŒeRdB d1eRdB dej[j\fd�dŽ„Z`G d�d�„ d�ejWƒZzd‘ej{j|d’eje"jSB dkej[j\d“e9dB dAe]dB dbe]dB defd”d•„Z}ej~jej€j�ddnddd)ddddd=ejjj‚fd@eRd–ejPjQeRB d—ej~jƒeRB d˜ej€j„eRB dAe]dB dBe9dgeejPjQejjjkf dB d™ejPjQeRB dB dše^d›e]dB d-eRdB dCe9d“e9dœe^d�ejPjQeRB def dždŸ„ZEddnddddezj…fd@eRd‘ej{j|dkej[j\dB dBe9dAe]dB d›e]dB d-eRdB dCe9d ezddfd¡d¢„Z†dS )¯zTalk to a DNS server.é    N)ÚAnyÚCallableÚDictÚOptionalÚTupleÚcastc                 C   s,   | d u rd S | t   ¡  }|dkrtjj‚|S )Nç        )ÚtimeÚdnsÚ	exceptionÚTimeout)Ú
expirationÚtimeout© r   úD/var/www/html/chatgpt/venv/lib/python3.10/site-packages/dns/query.pyÚ
_remaining5   s   r   c                 C   s   |d u rd S t t ¡ |  |ƒS ©N)Úminr	   )r   r   r   r   r   Ú_expiration_for_this_attempt>   s   r   Zdohc                       s4   e Zd Z‡ fdd„Z	ddd„Z	d	dd„Z‡  ZS )
Ú_NetworkBackendc                    s&   t ƒ  ¡  || _|| _|| _|| _d S r   )ÚsuperÚ__init__Ú_local_portÚ	_resolverÚ_bootstrap_addressÚ_family)ÚselfÚresolverÚ
local_portÚbootstrap_addressÚfamily©Ú	__class__r   r   r   M   s
   

z_NetworkBackend.__init__Nc              	   C   s  g }t |ƒ\}}tj |¡r| |¡ n(| jd ur | | j¡ nt|ƒ}| j}	|r/tj |¡}	| j	j
||	|d�}
|
 ¡ }|D ]M}tj |¡}|d usO| jdkr`|d u rUd}tj || jf|¡}nd }z t|tj|ƒ}td|ƒ}t|tj ||f|¡|ƒ t|ƒW   S  ty‹   Y q>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ÚhttpcoreZConnectError)r   ÚhostÚportr   Úlocal_addressÚsocket_optionsr*   Ú_r   r    ÚanswersÚaddressÚafÚsourceÚsockZattempt_expirationr   r   r   Úconnect_tcpT   sH   
ÿ
ÿ
ýÿz_NetworkBackend.connect_tcpc                 C   ó   t ‚r   ©ÚNotImplementedError)r   Úpathr   r6   r   r   r   Úconnect_unix_socket}   s   z#_NetworkBackend.connect_unix_socket)NNN©NN)Ú__name__Ú
__module__Ú__qualname__r   r=   rB   Ú__classcell__r   r   r!   r   r   L   s    
ÿ*ÿr   c                       s*   e Zd Zdddejdœ‡ fdd„
Z‡  ZS )Ú_HTTPTransportr   N©r   r   r   r    c                   sJ   |d u r|d u rdd l }|j ¡ }tƒ j|i |¤Ž t||||ƒ| j_d S ©Nr   )Údns.resolverr   ÚResolverr   r   r   Ú_poolZ_network_backend)r   r   r   r   r    ÚargsÚkwargsr
   r!   r   r   r   ƒ   s   	
ÿú_HTTPTransport.__init__)rD   rE   rF   r-   Ú	AF_UNSPECr   rG   r   r   r!   r   rH   ‚   s    úrH   c                   @   s*   e Zd Zdddejdœdd„Zdd„ ZdS )rH   r   NrI   c                O   ó   d S r   r   )r   r   r   r   r    rN   rO   r   r   r   r   ™   s   	rP   c                 C   r>   r   r?   )r   r3   r4   r   r5   r   r   r   r=   ¤   ó   z_HTTPTransport.connect_tcp)rD   rE   rF   r-   rQ   r   r=   r   r   r   r   rH   ˜   s    úr:   ÚkindÚprotoÚreturnc                 C   s   t   | ||¡S r   )r-   )r:   rT   rU   r   r   r   Údefault_socket_factory«   s   rW   Úsocket_factoryc                   @   ó   e Zd ZdZdS )ÚUnexpectedSourcez=A DNS query response came from an unexpected address or port.N©rD   rE   rF   Ú__doc__r   r   r   r   rZ   º   ó    rZ   c                   @   rY   )ÚBadResponsez<A DNS query response does not respond to the question asked.Nr[   r   r   r   r   r^   ¾   r]   r^   c                   @   rY   )ÚNoDOHzMDNS over HTTPS (DOH) was requested but the httpx module is not
    available.Nr[   r   r   r   r   r_   Â   r]   r_   c                   @   rY   )ÚNoDOQzNDNS over QUIC (DOQ) was requested but the aioquic module is not
    available.Nr[   r   r   r   r   r`   Ç   r]   r`   c                 C   s$   t   ¡ }| d u r|d fS |||  fS r   )r	   )r   Únowr   r   r   r$   Ð   s   r$   c                 C   sº   |rt | tjƒr|  ¡ dkrdS t ¡ �?}d}|r|tjO }|r%|tjO }|r-| | |¡ |d u r4d }n|t	 	¡  }|dkrBt
jj‚| |¡sKt
jj‚W d   ƒ d S 1 sVw   Y  d S )Nr   Tr   )Ú
isinstanceÚsslÚ	SSLSocketÚpendingÚ	selectorsÚDefaultSelectorÚ
EVENT_READÚEVENT_WRITEÚregisterr	   r
   r   r   Úselect)ÚfdÚreadableÚwritabler7   r   ÚselÚeventsr   r   r   r   Ú	_wait_forØ   s&   



ÿ"òrq   c                 C   s   t | ddd|ƒ d S )NTF©rq   ©Úsr   r   r   r   Ú_wait_for_readableô   ó   ru   c                 C   s   t | ddd|ƒ d S )NFTrr   rs   r   r   r   Ú_wait_for_writableø   rv   rw   c                 C   sb   zt j | |d ¡}t j | |d ¡}W n t jjy    Y dS w ||ko0|dd … |dd … kS )Nr   Fé   )r
   r%   Ú	inet_ptonr   ÚSyntaxError)r:   Za1Za2Zn1Zn2r   r   r   Ú_addresses_equalü   s   ÿ r{   c                 C   s\   |sdS t | ||ƒstj |d ¡r |dd … |dd … kr dS |r$dS td|› d|› �ƒ‚)NTr   rx   Fzgot a response from z instead of )r{   r
   r%   Úis_multicastrZ   )r:   Úfrom_addressÚdestinationÚignore_unexpectedr   r   r   Ú_matches_destination  s   ÿÿr€   Tc                 C   sÆ   d }d }z
t j | ¡}| }W n ty   |r‚ Y nw |r0t j |¡}|r.||kr-tdƒ‚n|}|rH|sHzt j |¡}W n tyG   tdƒ‚w |rSt 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(   r1   Ú
ValueErrorZ
any_for_afr+   )Úwherer4   r;   Úsource_portZwhere_must_be_addressr:   r~   Zsafr   r   r   Ú_destination_and_source  s<   ÿÿÿÿþ
r„   Útyper;   c                 C   sH   t | |dƒ}z| d¡ |dur| |¡ |W S  t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   FN)rX   ÚsetblockingÚbindr1   Úclose)r:   r…   r;   rt   r   r   r   r,   D  s   

þr,   Ússl_contextÚserver_hostnamec                 C   s2   t | ||ƒ}t|tjjƒr| ¡ }|j|d|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Š   )r,   rb   r
   ÚnameÚNameZto_textÚwrap_socket)r:   r…   r‰   rŠ   r;   r<   r   r   r   Úmake_ssl_sockete  s   ýr�   c                 C   s$   |d urt | ||||ƒS t| ||ƒS r   )r�   r,   )r:   r…   r;   r‰   rŠ   r   r   r   Ú_make_socket�  s   r�   r   zdns.resolver.Resolverc                 C   s   | d u rdd l }|j ¡ } | S rJ   )rK   r   rL   )r   r
   r   r   r   Ú_maybe_get_resolver�  s   
r‘   c                   @   s,   e Zd ZdZdZdZdZdZdZdZ	dZ
dS )ÚHTTPVersionz†Which version of HTTP should be used?

    DEFAULT will select the first version from the list [2, 1.1, 3] that
    is available.
    r   rx   é   é   N)rD   rE   rF   r\   ÚDEFAULTZHTTP_1ÚH1ZHTTP_2ÚH2ZHTTP_3ÚH3r   r   r   r   r’   «  s    r’   é»  Fz
/dns-queryÚqr‚   r   r4   rƒ   Úone_rr_per_rrsetÚignore_trailingÚsessionrA   Úpostr   Úverifyr    Úhttp_versionc           "      C   s  t ||||dƒ\}}}|}|dur6tj |¡r6|tjkr'd|› d|› |	› �}n|tjkr6d|› d|› |	› �}i }|du rbtj 	|¡}|j
du rKtdƒ‚tj |j
¡rZ|j
}|j
|d< |jdurb|j}|tjksn|tjkrªtsª|du r�t|ƒ}|j
dus}J ‚| |j
|¡}t t| ¡ ƒ¡}|ršt|tjjƒsštd	ƒ‚t| ||||||||||
|d
�S ts®t‚|rºt|tjƒsºtdƒ‚|  ¡ }ddi}|tjtjfv }|tj tjfv }|du rÛd}d}n|d }|d }|rët! "|¡}nt#||||||||d�}tj||||d�}|�A}|du�s
J ‚|
�r$| $dt%t&|ƒƒdœ¡ |j'|||||d�}nt( )|¡ *d¡}| +¡ } |j,|||d| i|d�}W d  ƒ n	1 �sGw   Y  |j-dk �sX|j-dk�rft|› d|j-› d|j.› �ƒ‚tj/j0|j.| j1| j2||d�}!|j3 4¡ |!_5|  6|!¡�s‚t7‚|!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 URLZsni_hostnamez8session parameter must be a dns.quic.SyncQuicConnection.)rŸ   rž   Ú
connectionz)session parameter must be an httpx.ClientÚacceptzapplication/dns-messager   rx   )r5   Ú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&   r-   ÚAF_INETÚAF_INET6ÚurllibÚparseÚurlparseÚhostnamer�   r4   r’   r˜   r•   Úhave_dohr‘   r)   ÚrandomÚchoiceÚlistr*   rb   ÚquicÚSyncQuicConnectionÚ_http3r_   ÚhttpxZClientÚto_wirer–   r—   Ú
contextlibÚnullcontextrH   ÚupdateÚstrÚlenrž   Úbase64Úurlsafe_b64encodeÚrstripÚdecodeÚgetÚstatus_coder¨   ÚmessageÚ	from_wirer°   r±   ÚelapsedÚtotal_secondsr	   Úis_responser^   )"rš   r‚   r   r4   r;   rƒ   r›   rœ   r�   rA   rž   r   rŸ   r   r    r    r:   r7   Z
the_sourceÚurlr©   Úparsedr8   Úwirer§   Zh1Úh2r5   r   Úcmr¦   ÚresponseZtwireÚrr   r   r   Úhttps»  sæ   G

ÿ





ÿôøÿ
þÿûû€ëÿÿûrØ   r§   rŒ   c                 C   s.   | d u rt ‚| D ]\}}||kr|  S qt ‚r   )ÚKeyError)r§   rŒ   ÚheaderÚvaluer   r   r   Ú_find_headerŠ  s   ÿrÜ   ÚpeerrÓ   c                 C   s�   t | dƒ}|d u rtdƒ‚t|ƒ}|dk rtdƒ‚|dk s!|dkrFd}t|ƒdkr;zd| ¡  }W n	 ty:   Y nw t|› d	|› |› �ƒ‚d S )
Ns   :statuszno :status header in responser   zstatus is negativer¬   r­   Ú z: r®   )rÜ   rz   ÚintrÅ   rÉ   r1   r�   )r§   rÝ   rÓ   rÛ   ÚstatusÚerrorr   r   r   Ú_check_status“  s    
ÿùrâ   rÑ   r¢   c              	   C   sV  t jjstdƒ‚tj |¡}|j}|d usJ ‚|jd ur|j}d| _	|  
¡ }|r.t d ¡}nt jj|	|dd�}|}|�J |rA|}n| ||||¡}t|ƒ\}}| |¡�}| |||
¡ | t|ƒ¡}t| ¡ ||ƒ W d   ƒ n1 suw   Y  t ¡ }W d   ƒ n1 sˆw   Y  t jj|| j| j||d�}t|| dƒ|_|  |¡s©t‚|S )Nz DNS-over-HTTP3 is not available.r   T)Úverify_modeÚserver_nameZh3r¯   r   )r
   r¼   Ú	have_quicr_   r´   rµ   r¶   r·   r4   ÚidrÀ   rÁ   rÂ   ÚSyncQuicManagerÚconnectr$   Úmake_streamZsend_h3Úreceiver   râ   r§   r	   rÌ   rÍ   r°   r±   ÚmaxrÐ   r^   )rš   r‚   rÑ   r   r4   r;   rƒ   r›   rœ   rŸ   rž   r¢   Z	url_partsr·   rÓ   ÚmanagerÚthe_managerÚthe_connectionÚstartr   ÚstreamÚfinishr×   r   r   r   r¾   ¤  sP   
ÿÿý
ôû
r¾   c                 C   s.   	 z|   |¡W S  ty   t| |ƒ Y nw q)z‹Reads a datagram from the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    )ÚrecvfromÚBlockingIOErrorru   )r<   Úmax_sizer   r   r   r   Ú	_udp_recvá  s   ÿýrõ   c                 C   s@   	 z|r|   ||¡W S |  |¡W S  ty   t| |ƒ Y nw q)z¦Sends 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ó   rw   )r<   Údatar~   r   r   r   r   Ú	_udp_sendí  s   ÿúrù   r<   Úwhatr~   r   c                 C   s4   t |tjjƒr| ¡ }t ¡ }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.
    )rb   r
   rÌ   ÚMessagerÀ   r	   rù   )r<   rú   r~   r   Ú	sent_timeÚnr   r   r   Úsend_udpü  s
   rþ   ó    r   r°   r±   Úraise_on_truncationÚignore_errorsÚqueryc              
   C   sÖ   d}	 t | d|ƒ\}}t| j|||ƒsqt ¡ }ztjj||||||d�}W n- tjjyH } z|	rC|
durC|
 | ¡ ¡sCW Y d}~q‚ d}~w t	yS   |	rRY q‚ w |	r`|
dur`|
 |¡s`q|rf||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œ   r   N)
rõ   r€   r    r	   r
   rÌ   rÍ   Ú	TruncatedrÐ   r1   )r<   r~   r   r   r›   r°   r±   rœ   r   r  r  rÓ   r}   Úreceived_timer×   Úer   r   r   Úreceive_udp  sH   >
ÿ
úÿÿ€ü
r  é5   c                 C   sÐ   |   ¡ }t||||dƒ\}}}t|ƒ\}}|
rt |
¡}n|dus#J ‚t|tj|ƒ}|�1}t||||ƒ t	|||||| j
| j||	|| ƒ\}}|| |_|sT|  |¡sTt‚|W  d  ƒ S 1 s`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Â   r,   r-   Ú
SOCK_DGRAMrþ   r  r°   Úmacr	   rÐ   r^   )rš   r‚   r   r4   r;   rƒ   r   r›   rœ   r   r<   r  rÓ   r:   r~   Ú
begin_timer   rÕ   rt   r×   r  r   r   r   Úudpƒ  s>   8

ÿõ
 ìÿr  Úudp_sockÚtcp_sockc                 C   s`   zt | ||||||||d|	|ƒ}|dfW S  tjjy/   t| ||||||||
ƒ	}|df Y S 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)r  r
   rÌ   r  Útcp)rš   r‚   r   r4   r;   rƒ   r   r›   rœ   r  r  r  rÖ   r   r   r   Úudp_with_fallbackß  s<   9ô
÷ôr  c              	   C   sŠ   d}|dkrCz|   |¡}|dkrtdƒ‚|t|ƒ8 }||7 }W n ttjfy0   t| |ƒ Y n tjy>   t| |ƒ Y nw |dks|S )zßRead 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   ZEOF)	ÚrecvÚEOFErrorrÅ   ró   rc   ÚSSLWantReadErrorru   ÚSSLWantWriteErrorrw   )r<   Úcountr   rt   rý   r   r   r   Ú	_net_read7  s   
ÿ÷r  c              	   C   s~   d}t |ƒ}||k r=z||  ||d… ¡7 }W n ttjfy(   t| |ƒ Y n tjy6   t| |ƒ Y nw ||k s
dS dS )z‘Write 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ó   rc   r  rw   r  ru   )r<   rø   r   ÚcurrentÚlr   r   r   Ú
_net_writeL  s   ÿûr  c                 C   sP   t |tjjƒr|jdd�}n
t|ƒ dd¡| }t ¡ }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)Zprepend_lengthr“   Úbig)	rb   r
   rÌ   rû   rÀ   rÅ   Úto_bytesr	   r  )r<   rú   r   Útcpmsgrü   r   r   r   Úsend_tcp\  s   r  c                 C   sL   t | d|ƒ}t d|¡\}t | ||ƒ}t ¡ }	tjj|||||d�}
|
|	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¯   )r  ÚstructÚunpackr	   r
   rÌ   rÍ   )r<   r   r›   r°   r±   rœ   Úldatar  rÓ   r  r×   r   r   r   Úreceive_tcpz  s   !ûr"  c                 C   s`   |   |¡}|dkrd S |tjtjtjfv r"t| |ƒ |  tjtj	¡}|dkr.t
|t |¡ƒ‚d S rJ   )Ú
connect_exÚerrnoZEINPROGRESSÚEWOULDBLOCKZEALREADYrw   Ú
getsockoptr-   Ú
SOL_SOCKETÚSO_ERRORÚOSErrorÚosÚstrerror)rt   r9   r   Úerrr   r   r   r/   ©  s   

ÿr/   c	                 C   sÐ   |   ¡ }	t|ƒ\}
}|rt |¡}nt||||dƒ\}}}|dus#J ‚t|tj|ƒ}|�1}|s5t|||ƒ t	||	|ƒ t
|||| j| j|ƒ\}}||
 |_|  |¡sTt‚|W  d  ƒ S 1 s`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„   r,   r-   r.   r/   r  r"  r°   r
  r	   rÐ   r^   )rš   r‚   r   r4   r;   rƒ   r›   rœ   r<   rÓ   r  r   rÕ   r:   r~   rt   r×   r  r   r   r   r  ´  s.   +

ÿÿ

 õÿr  c                 C   sN   	 z|   ¡  W d S  tjy   t| |ƒ Y n tjy%   t| |ƒ Y nw qr   )Údo_handshakerc   r  ru   r  rw   rs   r   r   r   Ú_tls_handshakeú  s   ÿúr.  Úcheck_hostnameÚalpnsc                 C   sT   t j | ¡\}}tj||d�}tjj|_||_| du rtj	|_
|dur(| |¡ |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ÚcapathFN)r
   Z	_tls_utilZ#convert_verify_to_cafile_and_capathrc   Úcreate_default_contextÚ
TLSVersionÚTLSv1_2Úminimum_versionr/  Ú	CERT_NONErã   Úset_alpn_protocols)rŸ   r/  r0  r1  r2  r‰   r   r   r   Úmake_ssl_context  s   

r9  c                 C   s   t || d udgƒS )NÚdot)r9  )rŠ   rŸ   r   r   r   Ú_make_dot_ssl_context'  s   r;  éU  c              
   C   sþ   |rt | ||||||||ƒ	S |  ¡ }t|ƒ\}}t||||dƒ\}}}|dus)J ‚|	du r6t||
dudgƒ}	t|tj|	|
|d��4}t|||ƒ t	||ƒ t
|||ƒ t|||| j| j|ƒ\}}|| |_|  |¡skt‚|W  d  ƒ S 1 sww   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Š   r;   )r  rÀ   r$   r„   r9  r�   r-   r.   r/   r.  r  r"  r°   r
  r	   rÐ   r^   )rš   r‚   r   r4   r;   rƒ   r›   rœ   r<   r‰   rŠ   rŸ   rÓ   r  r   r:   r~   rt   r×   r  r   r   r   Útls-  sR   =÷

ÿû
ÿ

 ðÿr=  r·   c              	   C   s&  t jjstdƒ‚|dur|
du r|}
d| _|  ¡ }|r#t d¡}|}n
t jj|	|
d�}|}|�> |s:| 	||||¡}t
|ƒ\}}| |¡�}| |d¡ | t|ƒ¡}W d  ƒ n1 s]w   Y  t ¡ }W d  ƒ n1 spw   Y  t jj|| j| j||d�}t|| 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å   r`   ræ   rÀ   rÁ   rÂ   rç   rè   r$   ré   r÷   rê   r   r	   rÌ   rÍ   r°   r±   rë   rÐ   r^   )rš   r‚   r   r4   r;   rƒ   r›   rœ   r¢   rŸ   r·   rŠ   rÓ   rì   rî   rí   rï   r   rð   rñ   r×   r   r   r   r¼   ™  sH   7
ÿÿþ
÷
û
r¼   c                   @   s   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   rx   r“   N)rD   rE   rF   r\   ÚNEVERZ	TRY_FIRSTÚONLYr   r   r   r   r>  ú  s
    r>  Útxn_managerrt   Úserialc                 c   sž  � |j d j}|tjjk}|  ¡ }| ¡ }	t|tjƒo |j	tj
k}
|
r+t||	d|ƒ nt dt|	ƒ¡|	 }t|||ƒ tj | |||
¡��}d}d}d}|s�t|ƒ\}}|du s_|dura||kra|}|
rlt|d|ƒ\}}nt|d|ƒ}t d|¡\}t|||ƒ}tjj||j|jd|||
 |d�}| |¡}|V  |j}|rM|jr­|durµ|js½tj d	¡‚W d  ƒ dS W d  ƒ dS W d  ƒ dS 1 sÈ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ÚIXFRZfrom_wire_originrÀ   rb   r-   r…   r	  rù   r  ÚpackrÅ   r  rC  ZInboundr$   rõ   r  r   rÌ   rÍ   r°   r
  Zprocess_messagerE  Zhad_tsigr   Ú	FormError)rA  rt   r  rB  r   r   rH  Zis_ixfrrD  rÓ   Zis_udpr  ZinboundÚdonerE  r×   r7   ZmexpirationZrwirer!  r  r   r   r   Ú_inbound_xfr  s\   €	ø

èÿãã"ãrN  ÚzonerH  ÚrdclassÚkeynameÚ
relativizer#   Úuse_udpÚkeyalgorithmc                 c   sf  � G dd„ dt jjƒ}t|tƒrt j |¡}t jj 	|¡}t j
 |||¡}|t jjkrL|j|j|t jjt jjdd�}t j ddd|› d�¡}| |d	¡ |d
urX|j|||d� t| ||
|dƒ\}}}
|d
usiJ ‚t|	ƒ\}}|||ƒ}|r€|t jjkr€tdƒ‚|r…tjntj}t|||
ƒ�}t|||ƒ t||||||ƒE d
H  W d
  ƒ d
S 1 s¬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                   @   sN   e Zd Zdd„ Zdd„ Zdejjfdd„Zdd	„ Z	dde
dejjfdd„ZdS )z$xfr.<locals>.DummyTransactionManagerc                 S   s   |||rt jjn|f| _d S r   )r
   rŒ   ÚemptyÚinfo)r   rD  rR  r   r   r   r   �  s   z-xfr.<locals>.DummyTransactionManager.__init__c                 S   ó   | j S r   )rV  ©r   r   r   r   Úorigin_information„  ó   z7xfr.<locals>.DummyTransactionManager.origin_informationrV   c                 S   r>   r   r?   rX  r   r   r   Ú	get_class‡  rS   z.xfr.<locals>.DummyTransactionManager.get_classc                 S   r>   r   r?   rX  r   r   r   ÚreaderŠ  rS   z+xfr.<locals>.DummyTransactionManager.readerFÚreplacementc                 S   s   G dd„ dƒ}t tjj|ƒ ƒS )Nc                   @   s   e Zd Zdd„ Zdd„ ZdS )zExfr.<locals>.DummyTransactionManager.writer.<locals>.DummyTransactionc                 _   rR   r   r   )r   rN   Úkwr   r   r   Únop�  rS   zIxfr.<locals>.DummyTransactionManager.writer.<locals>.DummyTransaction.nopc                 S   rW  r   )r_  )r   r7   r   r   r   Ú__getattr__’  rZ  zQxfr.<locals>.DummyTransactionManager.writer.<locals>.DummyTransaction.__getattr__N)rD   rE   rF   r_  r`  r   r   r   r   ÚDummyTransactionŽ  s    ra  )r   r
   ÚtransactionÚTransaction)r   r]  ra  r   r   r   Úwriter�  s   z+xfr.<locals>.DummyTransactionManager.writerN)F)rD   rE   rF   r   rY  r
   Ú
rdataclassÚ
RdataClassr[  r\  Úboolrb  rc  rd  r   r   r   r   ÚDummyTransactionManager€  s    rh  T)ÚcreateÚINÚSOAz. . z 0 0 0 0r   N)Ú	algorithmzcannot do a UDP AXFR)r
   rb  ÚTransactionManagerrb   rÄ   rŒ   Z	from_textrI  Ú	RdataTypeÚmakerÌ   Ú
make_queryrJ  Z
find_rrsetÚ	authorityre  rj  rk  ZrdataÚaddZuse_tsigr„   r$   r�   r-   r	  r.   r,   r/   rN  )r‚   rO  rH  rP  r   r4   r°   rQ  rR  r#   r;   rƒ   rB  rS  rT  rh  rš   ZrrsetZsoar:   r~   r7   r   ÚtmZ	sock_typert   r   r   r   rC  ;  s6   €E
ÿ

ÿ
"þrC  Úudp_modec	              	   C   sR  |du rt j |¡\}}	nt j |¡}	t| |||dƒ\}
}}|
dus$J ‚t|ƒ\}}|jd jt jj	kr}|t
jkr}t|
tj|ƒ�5}t|||ƒ zt||||	||ƒD ]}qQW W d  ƒ dS  t jjym   |t
jkrk‚ Y nw W d  ƒ n1 sxw   Y  t|
tj|ƒ�}t|||ƒ t||||	||ƒD ]}q”W d  ƒ dS 1 s¢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
   rC  rp  Zextract_serial_from_queryr„   r$   rG  rH  rI  rJ  r>  r?  r,   r-   r	  r/   rN  ZUseTCPr@  r.   )r‚   rA  r  r4   r   r#   r;   rƒ   rt  rB  r:   r~   r7   r   rt   r   r   r   Úinbound_xfr±  s>   /

ÿÿù
ÿÿ÷ÿ"þru  )Tr   rC   )	Nr™   Nr   FFTTN)
NNFFNrÿ   FFFN)
Nr  Nr   FFFFNF)
Nr  Nr   FFFNNF)NFNrÿ   F)Nr  Nr   FFN)TTN)
Nr<  Nr   FFNNNT)
Nr<  Nr   FFNTNN)‡r\   rÆ   rÁ   Úenumr$  r*  r¹   rf   r-   r  r	   Úurllib.parser´   Útypingr   r   r   r   r   r   Zdns._featuresr
   Zdns._tls_utilZdns.exceptionZdns.inetZdns.messageZdns.nameZdns.quicZ	dns.rdataZdns.rdataclassZdns.rdatatypeZdns.transactionZdns.tsigZdns.xfrrc   ÚImportErrorZdns._no_sslZ_no_sslr   r   Z	_featuresZhaveZ_have_httpxZhttpcore._backends.syncr2   r¿   ZNetworkBackendZ_CoreNetworkBackendZ	_backendsÚsyncZ
SyncStreamr0   r   ZHTTPTransportrH   r¸   ÚAddressFamilyrß   Ú
SocketKindrW   rX   Ú__annotations__r   ZDNSExceptionrZ   rL  r^   r_   r`   rC  ZTransferErrorr$   rq   ru   rw   r{   r€   r„   r,   Ú
SSLContextrŒ   r�   rÄ   rd   r�   r�   r‘   ÚIntEnumr’   rQ   r•   rÌ   rû   Úfloatrg  rØ   r¼   ZHeadersÚbytesrÜ   râ   r½   r¾   rõ   rù   rþ   ZtsigÚKeyr  r  r  r  r  r  r"  r/   r  r.  r»   r9  r;  r=  r>  rb  rm  rN  rI  ZAXFRre  rj  Zdefault_algorithmrn  rf  r?  ru  r   r   r   r   Ú<module>   sZ   ÿ	
6ÿþý
üþÿ
ÿ/ýÿþý
ü%ûÿþýüû
ú+ÿ
þðÿþýüûúùø	÷
öõôóòñð
ï P	ôÿþýüûúùø	÷
öõ
ô
ó=üÿ
þýü

ûõÿþýüûúùø	÷
ö
õ
ômôÿþýüûúùø	÷
öõô
ó_ôÿþýüûúùø	÷
öõô
óXýÿ
þý

ü úÿþýüûú
ù/÷ÿþýüûúùø	÷

öFýÿþ
ý
ü"ÿÿ
þ	ôÿþýüûúùø	÷
öõô
óoôÿþýüûúùø
	÷
öõô
óaÿ
þýüûú
ù7ñÿ
þ
ý
üûúùø	÷
öõôóò
ñ
ðy÷ÿþ
ýüûúùø	÷
ö