Ë
    RPf0Ö  ã            !       óÊ  — 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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„ Zd„ Z ejB                  jE                  d«      Z#e#rUddl$Z%ddl&Z&e%jN                  Z(e%jR                  jT                  jV                  Z, G d„ de(«      Z- G d	„ d
e&j\                  «      Z/n
 G d„ d
«      Z/e#Z0	 ddl1Z1ej                  Z3 G d„ dejh                  jj                  «      Z6 G d„ dejh                  jn                  «      Z8 G d„ dejh                  jj                  «      Z9 G d„ dejh                  jj                  «      Z:ejv                  jx                  Z<d„ Z=d„ Z>d„ Z? e@ed«      rej‚                  aBnej†                  aBd„ ZDd„ ZEd„ ZFd„ ZG	 ded„ZHdfd „ZIdd!ddd"d"dd#ddddej”                  fd$ej–                  j˜                  d%eMd&eeN   d'eOd(eeM   d)eOd*ePd+ePd,ee   d-eMd.ePd/eeM   d0eePeMf   d1ed2   d3eeO   d4ej–                  j˜                  f d5„ZQd6„ ZRd7„ ZS	 dgd8ed9eej–                  j˜                  eTf   d:ed;eeN   d4eeOeNf   f
d<„ZU	 	 	 	 	 	 	 	 	 	 dhd8ed:ee   d;eeN   d=ePd*ePd>eeej¬                  j®                  ej°                  j²                  f      d?eeT   d+ePd@ePdAePdBeej–                  j˜                     d4efdC„ZZ	 	 	 	 	 	 	 	 	 	 did$ej–                  j˜                  d%eMd&eeN   d'eOd(eeM   d)eOd=ePd*ePd+ePd@ePd8ee   dAePd4ej–                  j˜                  fdE„Z[	 	 	 	 	 	 	 	 	 	 djd$ej–                  j˜                  d%eMd&eeN   d'eOd(eeM   d)eOd=ePd*ePd+ePdFee   dGee   dAePd4eej–                  j˜                  ePf   fdH„Z\dI„ Z]dJ„ Z^	 dgd8ed9eej–                  j˜                  eTf   d;eeN   d4eeOeNf   fdK„Z_	 	 	 	 	 dkd8ed;eeN   d*ePd>eeej¬                  j®                  ej°                  j²                  f      d?eeT   d+ePd4eej–                  j˜                  eNf   fdL„Z`dM„ Za	 	 	 	 	 	 	 dld$ej–                  j˜                  d%eMd&eeN   d'eOd(eeM   d)eOd*ePd+ePd8ee   d4ej–                  j˜                  fdN„ZbdO„ ZcdPeeM   d0eePeMf   d4e1jÈ                  fdQ„Ze	 	 	 	 	 	 	 	 	 	 dmd$ej–                  j˜                  d%eMd&eeN   d'eOd(eeM   d)eOd*ePd+ePd8ee1jÌ                     dRee1jÈ                     dPeeM   d0eePeMf   d4ej–                  j˜                  fdS„Zg	 	 	 	 	 	 	 	 	 dnd$ej–                  j˜                  d%eMd&eeN   d'eOd(eeM   d)eOd*ePd+ePdTeejÐ                  jÒ                     d0eePeMf   dPeeM   d4ej–                  j˜                  fdU„ZhejÔ                  jÖ                  ejØ                  jÚ                  ddDdddddddd"ej°                  jÜ                  fd%eMdVeej¬                  j®                  eMf   dWeejÔ                  jÞ                  eMf   dXeejØ                  jà                  eMf   d&eeN   d'eOd>eeej¬                  j®                  ej°                  j²                  f      dYeeej¬                  j®                  eMf      dZePd[eeN   d(eeM   d)eOd\eOd]ePd^eej¬                  j®                  eMf   d4ef d_„Z; G d`„ daejâ                  «      ZrddDdddderjæ                  fd%eMdbejè                  jê                  dBeej–                  j˜                     d'eOd&eeN   d[eeN   d(eeM   d)eOdcerd4dfdd„Zvy# e2$ r  G d„ d«      Z1Y �Œkw xY w)ozTalk to a DNS server.é    N)ÚAnyÚDictÚOptionalÚTupleÚUnionc                 óx   — | €y | t        j                   «       z
  }|dk  rt        j                  j                  ‚|S )Nç        )ÚtimeÚdnsÚ	exceptionÚTimeout)Ú
expirationÚtimeouts     úC/var/www/fastapitest/venv/lib/python3.12/site-packages/dns/query.pyÚ
_remainingr   /   s7   € ØÐØØœ4Ÿ9™9›;Ñ&€GØ�#‚~Ü�m‰m×#Ñ#Ð#Ø€Nó    c                 óJ   — |€y t        t        j                  «       | z   |«      S ©N)Úminr
   )r   r   s     r   Ú_expiration_for_this_attemptr   8   s#   € ØÐØÜŒt�y‰y‹{˜WÑ$ jÓ1Ð1r   Údohc                   ó2   ‡ — e Zd Zˆ fd„Z	 dd„Z	 dd„Zˆ xZS )Ú_NetworkBackendc                 óZ   •— t         ‰| �  «        || _        || _        || _        || _        y r   )ÚsuperÚ__init__Ú_local_portÚ	_resolverÚ_bootstrap_addressÚ_family)ÚselfÚresolverÚ
local_portÚbootstrap_addressÚfamilyÚ	__class__s        €r   r   z_NetworkBackend.__init__G   s,   ø€ Ü‰GÑÔØ)ˆDÔØ%ˆDŒNØ&7ˆDÔ#Ø!ˆD�Lr   c                 ól  — g }t        |«      \  }}t        j                  j                  |«      r|j	                  |«       nŽ| j
                  �|j	                  | j
                  «       nft        |«      }| j                  }	|rt        j                  j                  |«      }	| j                  j                  ||	|¬«      }
|
j                  «       }|D ]Â  }t        j                  j                  |«      }|€| j                  dk7  r-t        j                  j                  || j                  f|«      }nd }t        |t        j                   |«      }t#        d|«      }	 t%        |t        j                  j                  ||f|«      |«       t'        |«      c S  t*        j,                  ‚# t(        $ r Y Œàw xY w)N)r%   Úlifetimer   g       @)Ú_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_optionsr/   Ú_r   r%   ÚanswersÚaddressÚafÚsourceÚsockÚattempt_expirations                   r   Úconnect_tcpz_NetworkBackend.connect_tcpN   s�  € ð ˆIÜ*¨7Ó3‰MˆAˆzÜ�x‰x×"Ñ" 4Ô(Ø× Ñ  Õ&Ø×(Ñ(Ð4Ø× Ñ  ×!8Ñ!8Õ9ä$ ZÓ0�ØŸ™�Ù Ü ŸX™X×4Ñ4°]ÓC�FØŸ.™.×5Ñ5Ø °'ð 6ó �ð $×-Ñ-Ó/�	Ø$ò �Ü—X‘X×,Ñ,¨WÓ5�Ø Ð,°×0@Ñ0@ÀAÒ0EÜ ŸX™X×=Ñ=Ø&¨×(8Ñ(8Ð9¸2ó‘Fð "�FÜ# B¬×(:Ñ(:¸FÓC�Ü%AÀ#ÀzÓ%RÐ"ðÜØÜŸ™×8Ñ8¸'À4¸È"ÓMØ*ôô
 +¨4Ó0Ò0ð!ô& ×'Ñ'Ð'øô !ò Ùðús   Å7F'Æ'	F3Æ2F3c                 ó   — t         ‚r   ©ÚNotImplementedError)r!   Úpathr   r<   s       r   Úconnect_unix_socketz#_NetworkBackend.connect_unix_socketu   s
   € ô &Ð%r   r   )Ú__name__Ú
__module__Ú__qualname__r   rD   rI   Ú__classcell__©r&   s   @r   r   r   F   s   ø„ ô	"ð FJó%	(ðP 15÷	&r   r   c                   ó>   ‡ — 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                  j                  «       }t        ‰| �  |i |¤Ž t        ||||«      | j                  _        y ©Nr   )Údns.resolverr"   ÚResolverr   r   r   Ú_poolÚ_network_backend)	r!   r#   r$   r"   r%   ÚargsÚkwargsr   r&   s	           €r   r   z_HTTPTransport.__init__{   sM   ø€ ð Ðã#àŸ<™<×0Ñ0Ó2�Ü‰GÑ˜dÐ- fÒ-Ü*9Ø˜*Ð&7¸ó+ˆD�J‰JÕ'r   )rJ   rK   rL   r2   Ú	AF_UNSPECr   rM   rN   s   @r   rP   rP   z   s!   ø„ ð Ø"ØØ×#Ñ#÷	ò 	r   rP   c                   ó   — e Zd Zd„ Zy)rP   c                 ó   — t         ‚r   rF   )r!   r9   r:   r   r;   s        r   rD   z_HTTPTransport.connect_tcp‘   s   € Ü%Ð%r   N)rJ   rK   rL   rD   © r   r   rP   rP   �   s   „ ó	&r   c                   ót   — e Zd ZdZ G d„ de«      Z G d„ de«      Z G d„ d«      Z G d„ d	«      Ze	d
„ «       Z
y)Ússlr   c                   ó   — e Zd Zy)ússl.WantReadExceptionN©rJ   rK   rL   r\   r   r   ÚWantReadExceptionr`   ž   ó   „ Ør   rb   c                   ó   — e Zd Zy)ússl.WantWriteExceptionNra   r\   r   r   ÚWantWriteExceptionre   ¡   rc   r   rf   c                   ó   — e Zd Zy)ússl.SSLContextNra   r\   r   r   Ú
SSLContextrh   ¤   rc   r   ri   c                   ó   — e Zd Zy)ússl.SSLSocketNra   r\   r   r   Ú	SSLSocketrk   §   rc   r   rl   c                 ó   — t        d«      ‚)Nzno ssl support)r6   )ÚclsrW   rX   s      r   Úcreate_default_contextzssl.create_default_contextª   s   € äÐ,Ó-Ð-r   N)rJ   rK   rL   Ú	CERT_NONEr6   rb   rf   ri   rl   Úclassmethodro   r\   r   r   r^   r^   ›   sG   „ Øˆ	ô	 	ô 	ô	 ô 	÷	ñ 	÷	ñ 	ð 
ñ	.ó 
ñ	.r   r^   c                   ó   — e Zd ZdZy)ÚUnexpectedSourcez=A DNS query response came from an unexpected address or port.N©rJ   rK   rL   Ú__doc__r\   r   r   rs   rs   ´   s   „ ÚGr   rs   c                   ó   — e Zd ZdZy)ÚBadResponsez<A DNS query response does not respond to the question asked.Nrt   r\   r   r   rw   rw   ¸   s   „ ÚFr   rw   c                   ó   — e Zd ZdZy)ÚNoDOHzMDNS over HTTPS (DOH) was requested but the httpx module is not
    available.Nrt   r\   r   r   ry   ry   ¼   ó   „ òr   ry   c                   ó   — e Zd ZdZy)ÚNoDOQzNDNS over QUIC (DOQ) was requested but the aioquic module is not
    available.Nrt   r\   r   r   r|   r|   Á   rz   r   r|   c                 óD   — t        j                   «       }| €|d fS ||| z   fS r   )r
   )r   Únows     r   r)   r)   Ê   s+   € Ü
�)‰)‹+€CØ€Ø�Tˆ{Ðà�S˜7‘]Ð#Ð#r   c                 óÄ  — |r.t        | t        j                  «      r| j                  «       dkD  ryt	        «       }d}|r|t
        j                  z  }|r|t
        j                  z  }|r|j                  | |«       |€d }n6|t        j                  «       z
  }|dk  rt        j                  j                  ‚|j                  |«      st        j                  j                  ‚y )Nr   Tr	   )Ú
isinstancer^   rl   ÚpendingÚ_selector_classÚ	selectorsÚ
EVENT_READÚEVENT_WRITEÚregisterr
   r   r   r   Úselect)ÚfdÚreadableÚwritabler=   r   ÚselÚeventsr   s           r   Ú	_wait_forr�   Ò   s»   € ñ ”J˜r¤3§=¡=Ô1°b·j±j³lÀQÒ6FØÜ
Ó
€CØ€FÙØ”)×&Ñ&Ñ&ˆÙØ”)×'Ñ'Ñ'ˆÙØ�‰�R˜Ô ØÐØ‰àœtŸy™y›{Ñ*ˆØ�cŠ>Ü—-‘-×'Ñ'Ð'Ø�:‰:�gÔÜ�m‰m×#Ñ#Ð#ð r   c                 ó   — | a y r   )r‚   )Úselector_classs    r   Ú_set_selector_classr�   î   s	   € ð
 %�Or   ÚPollSelectorc                 ó"   — t        | ddd|«       y )NTF©r�   ©Úsr   s     r   Ú_wait_for_readabler–     s   € Üˆa��u˜d JÕ/r   c                 ó"   — t        | ddd|«       y )NFTr“   r”   s     r   Ú_wait_for_writabler˜     s   € Üˆa�˜˜d JÕ/r   c                 óú   — 	 t         j                  j                  | |d   «      }t         j                  j                  | |d   «      }||k(  xr |dd  |dd  k(  S # t         j                  j                  $ r Y yw xY w)Nr   Fé   )r   r*   Ú	inet_ptonr   ÚSyntaxError)r@   Úa1Úa2Ún1Ún2s        r   Ú_addresses_equalr¡   
  s{   € ðÜ�X‰X×Ñ  B q¡EÓ*ˆÜ�X‰X×Ñ  B q¡EÓ*ˆð �‰8Ò(˜˜1˜2˜ " Q R &Ñ(Ð(øô �=‰=×$Ñ$ò Ùðús   ‚AA ÁA:Á9A:c                 ó¦   — |syt        | ||«      s-t        j                  j                  |d   «      r|dd  |dd  k(  ry|ryt	        d|› d|› �«      ‚)NTr   rš   Fzgot a response from z instead of )r¡   r   r*   Úis_multicastrs   )r@   Úfrom_addressÚdestinationÚignore_unexpecteds       r   Ú_matches_destinationr§     sh   € ñ ØÜ˜˜L¨+Ô6Ü�‰×Ñ˜k¨!™nÔ-°,¸q¸rÐ2BÀkÐRSÐRTÀoÒ2UàÙ	ØÜ
Ø
˜|˜n¨L¸[¸MÐJóð r   Tc                 óî  — d }d }	 t         j                  j                  | «      }| }|r3t         j                  j                  |«      }|r||k7  rt	        d«      ‚|}|r"|s 	 t         j                  j                  |«      }|r"t         j                  j                  ||f|«      }|r"t         j                  j                  ||f|«      }|||fS # t        $ r |r‚ Y Œ´w xY w# t        $ r t	        d«      ‚w xY w)Nz5different address families for source and destinationz3source_port specified but address family is unknown)r   r*   r-   r6   Ú
ValueErrorÚ
any_for_afr0   )Úwherer:   rA   Úsource_portÚwhere_must_be_addressr@   r¥   Úsafs           r   Ú_destination_and_sourcer¯   &  s
  € ð
 
€BØ€KðÜ�X‰X×$Ñ$ UÓ+ˆØˆñ
 Ü�h‰h×%Ñ% fÓ-ˆÙà�bŠyÜ ØKóð ð ˆBÙ™6ð	TÜ—X‘X×(Ñ(¨Ó,ˆFñ Ü—h‘h×6Ñ6¸ÀTÐ7JÈBÓOˆÙÜ—‘×1Ñ1°6¸;Ð2GÈÓLˆØ�˜VÐ$Ð$øô? ò Ù Øñ !ðûô, ò 	TäÐRÓSÐSð	Tús   †!C Á!C ÃCÃCÃC4c                 óÐ   — t        | |«      }	 |j                  d«       |�|j                  |«       |r|j                  |d|¬«      S |S # t        $ r |j                  «        ‚ w xY w)NF)Údo_handshake_on_connectÚserver_hostname)Úsocket_factoryÚsetblockingÚbindÚwrap_socketr6   Úclose)r@   ÚtyperA   Ússl_contextr²   r•   s         r   r1   r1   R  sv   € Ü�r˜4Ó €AðØ	�‰�eÔØÐØ�F‰F�6ŒNÙà×*Ñ*ØØ(-Ø /ð +ó ð ð ˆHøÜò Ø	�‰Œ	Øðús   Ž9A
 ÁA
 Á
A%i»  Fz
/dns-queryÚqr«   r   r:   rA   r¬   Úone_rr_per_rrsetÚignore_trailingÚsessionrH   Úpostr$   Úverifyr"   zdns.resolver.Resolverr%   Úreturnc           
      ó  — t         st        ‚|r%t        |t        j                  «      st        d«      ‚| j                  «       }t        ||||d«      \  }}}d}ddi}|�mt        j                  j                  |«      rN|t        j                  k(  rdj                  |||	«      }n)|t        j                  k(  rdj                  |||	«      }n|}|€d}d}n
|d   }|d	   }t        |d
d
|||||¬«      }|rt!        j"                  |«      }nt        j                  d
d
||¬«      }|5 }|
r<|j%                  dt'        t)        |«      «      dœ«       |j+                  |||¬«      }nKt-        j.                  |«      j1                  d«      }|j3                  «       }|j5                  ||d|i¬«      }ddd«       j6                  dk  s|j6                  dkD  r0t        dj                  ||j6                  |j8                  «      «      ‚t        j:                  j=                  |j8                  | j>                  | j@                  ||¬«      }|jB                  jE                  «       |_#        | jI                  |«      stJ        ‚|S # 1 sw Y   ŒÑxY w)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.

    Returns a ``dns.message.Message``.
    z)session parameter must be an httpx.ClientFNÚacceptzapplication/dns-messagezhttps://{}:{}{}zhttps://[{}]:{}{}r   rš   T)r;   Úhttp1Úhttp2r¿   r#   r$   r"   r%   )rÃ   rÄ   r¿   Ú	transport)zcontent-typezcontent-length)ÚheadersÚcontentr   ó   =r   )rÆ   r   ÚparamséÈ   i+  z2{} responded with status code {}
Response body: {}©ÚkeyringÚrequest_macr»   r¼   )&Úhave_dohry   r€   ÚhttpxÚClientr©   Úto_wirer¯   r   r*   r+   r2   ÚAF_INETÚformatÚAF_INET6rP   Ú
contextlibÚnullcontextÚupdateÚstrÚlenr¾   Úbase64Úurlsafe_b64encodeÚrstripÚdecodeÚgetÚstatus_coderÇ   ÚmessageÚ	from_wirerÌ   rÍ   ÚelapsedÚtotal_secondsr
   Úis_responserw   )rº   r«   r   r:   rA   r¬   r»   r¼   r½   rH   r¾   r$   r¿   r"   r%   Úwirer@   r=   Ú
the_sourcerÅ   rÆ   Úurlr;   r#   ÚcmÚresponseÚtwireÚrs                               r   Úhttpsrì   f  sz  € õH ÜˆÙ”z '¬5¯<©<Ô8ÜÐDÓEÐEà�9‰9‹;€DÜ1Øˆt�V˜[¨%óÑ€RˆˆJð €IØÐ2Ð3€GØ	€~œ#Ÿ(™(×-Ñ-¨eÔ4Ø”—‘ÒØ#×*Ñ*¨5°$¸Ó=‰CØ”6—?‘?Ò"Ø%×,Ñ,¨U°D¸$Ó?‰Càˆð ÐØˆØ‰
à" 1™ˆØ ‘]ˆ
ÜØ#ØØØØØ+ØØô	€Iñ Ü0:×0FÑ0FÀwÓ0O‰ä�\‰\ ¨D¸È9ÔUˆØ	ð ˆwñ Ø�N‰Nà$=Ü&)¬#¨d«)£nñôð —|‘| C°À$ÐPW�|ÓX‰Hä×+Ñ+¨DÓ1×8Ñ8¸Ó>ˆDØ—K‘K“MˆEØ—{‘{Ø˜W¨g¸uÀe¸nð #ó ˆH÷ð( ×Ñ˜cÒ! X×%9Ñ%9¸CÒ%?Üð"ß"(¡&¨°×0DÑ0DÀh×FVÑFVÓ"Wó
ð 	
ô 	�‰×ÑØ×ÑØ—	‘	Ø—M‘MØ)Ø'ð 	ó 	€Að ×Ñ×+Ñ+Ó-€A„FØ�=‰=˜ÔÜÐØ€H÷Gð ús   Ä%B
I?É?Jc                 ó`   — 	 	 | j                  |«      S # t        $ r t        | |«       Y nw xY wŒ.)z‹Reads a datagram from the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    )ÚrecvfromÚBlockingIOErrorr–   )rB   Úmax_sizer   s      r   Ú	_udp_recvrñ   ú  s9   € ð
 ð	1Ø—=‘= Ó*Ð*øÜò 	1Ü˜t ZÖ0ð	1úð s   ƒ ”,«,c                 óˆ   — 	 	 |r| j                  ||«      S | j                  |«      S # t        $ r t        | |«       Y nw xY wŒB)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ï   r˜   )rB   Údatar¥   r   s       r   Ú	_udp_sendrö     sL   € ð
 ð	1ÙØ—{‘{ 4¨Ó5Ð5à—y‘y “Ð&øÜò 	1Ü˜t ZÖ0ð	1úð s   ƒ( —( ¨A ¿A rB   Úwhatr¥   r   c                 ó¶   — t        |t        j                  j                  «      r|j	                  «       }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.
    )r€   r   rà   ÚMessagerÑ   r
   rö   )rB   r÷   r¥   r   Ú	sent_timeÚns         r   Úsend_udprü     sH   € ô, �$œŸ™×+Ñ+Ô,Ø�|‰|‹~ˆÜ—	‘	“€IÜ�$˜˜k¨:Ó6€AØˆyˆ>Ðr   r¦   rÌ   rÍ   Úraise_on_truncationÚignore_errorsÚqueryc                 óÆ  — d}	 t        | d|«      \  }}t        | j                  |||«      sŒ*t        j                  «       }	 t        j
                  j                  ||||||¬«      }|	r|
�|
j                  |«      sŒz|r||fS |||fS # t        j
                  j                  $ r.}|	r&|
�$|
j                  |j                  «       «      sY d}~ŒÊ‚ d}~wt        $ r |	rY ŒÛ‚ w xY w)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   éÿÿ  )rÌ   rÍ   r»   r¼   rý   N)
rñ   r§   r%   r
   r   rà   rá   Ú	Truncatedrä   r6   )rB   r¥   r   r¦   r»   rÌ   rÍ   r¼   rý   rþ   rÿ   rå   r¤   Úreceived_timerë   Úes                   r   Úreceive_udpr  2  sý   € ð| €DØ
Ü(¨¨u°jÓAÑˆˆ|Ü#Ø�K‰K˜ {Ð4Eô
ð ÜŸ	™	›ˆð	Ü—‘×%Ñ%ØØØ'Ø!1Ø /Ø$7ð &ó ˆAñ6 ˜UÐ.°u×7HÑ7HÈÔ7KØÙØ�}Ð%Ð%à�} lÐ3Ð3øô1 �{‰{×$Ñ$ò 	ñ ØÐ%Ø×)Ñ)¨!¯)©)«+Ô6äàûÜò 	ÙÙàð		ús$   Á%B ÂC Â%#CÃCÃC ÃC é5   c                 ó¼  — | j                  «       }t        ||||«      \  }}}t        |«      \  }}|
rt        j                  |
«      }nt        |t        j                  |«      }|5 }t        ||||«       t        |||||| j                  | j                  ||	|| «      \  }}||z
  |_        |s| j                  |«      st        ‚|cddd«       S # 1 sw Y   nxY w	 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``.
    N)rÑ   r¯   r)   rÕ   rÖ   r1   r2   Ú
SOCK_DGRAMrü   r  rÌ   Úmacr
   rä   rw   )rº   r«   r   r:   rA   r¬   r¦   r»   r¼   rý   rB   rþ   rå   r@   r¥   Ú
begin_timer   rè   r•   rë   r  s                        r   Úudpr  œ  sö   € ðp �9‰9‹;€DÜ 7Øˆt�V˜[ó!Ñ€Rˆ�fô  .¨gÓ6Ñ€Z�ÙÜ0:×0FÑ0FÀtÓ0L‰ä˜"œf×/Ñ/°Ó8ˆØ	ð ˆqÜ��D˜+ zÔ2Ü(ØØØØØØ�I‰IØ�E‰EØØØØó
ÑˆˆMð  Ñ+ˆŒñ  §¡¨qÔ!1ÜÐØ÷)÷ ò úð, 	ðØs   Á&A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)r  r   rà   r  Útcp)rº   r«   r   r:   rA   r¬   r¦   r»   r¼   r  r  rþ   ré   s                r   Úudp_with_fallbackr  ÷  sŽ   € ðr ÜØØØØØØØØØØØØó
ˆð ˜%Ð Ð øÜ�;‰;× Ñ ò  ÜØØØØØØØØØó

ˆð ˜$ÐÒð ús   ‚ œ4AÁAc                 ó  — d}|dkD  r6	 | j                  |«      }|dk(  rt        ‚|t        |«      z  }||z  }|dkD  rŒ6|S # t        t        j
                  f$ r t        | |«       Y Œ/t        j                  $ r t        | |«       Y ŒOw xY w)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   )	ÚrecvÚEOFErrorrÙ   rï   r^   ÚSSLWantReadErrorr–   ÚSSLWantWriteErrorr˜   )rB   Úcountr   r•   rû   s        r   Ú	_net_readr  O  s“   € ð 	€AØ
�!Š)ð		1Ø—	‘	˜%Ó ˆAØ�CŠxÜ�Ø”S˜“V‰OˆEØ�‰FˆAð �!‹)ð €Høô	  ¤×!5Ñ!5Ð6ò 	1Ü˜t ZÖ0Ü×$Ñ$ò 	1Ü˜t ZÖ0ð	1ús   ‰/A  Á %BÁ'BÂBc                 óü   — d}t        |«      }||k  r	 || j                  ||d «      z  }||k  rŒyy# t        t        j                  f$ r t        | |«       Y Œ/t        j                  $ r t        | |«       Y ŒOw xY w)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ï   r^   r  r˜   r  r–   )rB   rõ   r   ÚcurrentÚls        r   Ú
_net_writer  d  s~   € ð
 €GÜˆD‹	€AØ
�AŠ+ð	1Ø�t—y‘y  g h Ó0Ñ0ˆGð �A�+øô  ¤×!6Ñ!6Ð7ò 	1Ü˜t ZÖ0Ü×#Ñ#ò 	1Ü˜t ZÖ0ð	1ús   ”3 ³%A;ÁA;Á:A;c                 ó  — t        |t        j                  j                  «      r|j	                  d¬«      }nt        |«      j                  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_lengthé   Úbig)	r€   r   rà   rù   rÑ   rÙ   Úto_bytesr
   r  )rB   r÷   r   Útcpmsgrú   s        r   Úsend_tcpr"  t  sk   € ô$ �$œŸ™×+Ñ+Ô,Ø—‘¨T�Ó2‰ô
 �T“×#Ñ# A uÓ-°Ñ4ˆÜ—	‘	“€IÜˆt�V˜ZÔ(Ü�‹K˜Ð#Ð#r   c                 óÞ   — t        | d|«      }t        j                  d|«      \  }t        | ||«      }t        j                  «       }	t        j
                  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Ë   )r  ÚstructÚunpackr
   r   rà   rá   )rB   r   r»   rÌ   rÍ   r¼   Úldatar  rå   r  rë   s              r   Úreceive_tcpr(  ’  ss   € ôB �d˜A˜zÓ*€EÜ�=‰=˜˜uÓ%�D€QÜ�T˜1˜jÓ)€DÜ—I‘I“K€MÜ�‰×ÑØØØØ)Ø'ð 	ó 	€Að ˆ}ÐÐr   c                 óP  — | j                  |«      }|dk(  ry |t        j                  t        j                  t        j                  fv r:t        | |«       | j                  t        j                  t        j                  «      }|dk7  rt        |t        j                  |«      «      ‚y rR   )Ú
connect_exÚerrnoÚEINPROGRESSÚEWOULDBLOCKÚEALREADYr˜   Ú
getsockoptr2   Ú
SOL_SOCKETÚSO_ERRORÚOSErrorÚosÚstrerror)r•   r?   r   Úerrs       r   r4   r4   Á  s   € Ø
�,‰,�wÓ
€CØ
ˆa‚xØØ
Œu× Ñ ¤%×"3Ñ"3´U·^±^ÐDÑDÜ˜1˜jÔ)Ø�l‰lœ6×,Ñ,¬f¯o©oÓ>ˆØ
ˆa‚xÜ�cœ2Ÿ;™; sÓ+Ó,Ð,ð r   c	           	      óÊ  — | j                  «       }	t        |«      \  }
}|rt        j                  |«      }n-t	        ||||«      \  }}}t        |t        j                  |«      }|5 }|st        ||«       t        ||	|«       t        |||| j                  | j                  |«      \  }}||
z
  |_        | j                  |«      st        ‚|cddd«       S # 1 sw Y   nxY w	 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``.
    N)rÑ   r)   rÕ   rÖ   r¯   r1   r2   r3   r4   r"  r(  rÌ   r	  r
   rä   rw   )rº   r«   r   r:   rA   r¬   r»   r¼   rB   rå   r
  r   rè   r@   r¥   r•   rë   r  s                     r   r  r  Ì  sì   € ðV �9‰9‹;€DÜ-¨gÓ6Ñ€Z�ÙÜ0:×0FÑ0FÀtÓ0L‰ä$;Ø�4˜ ó%
Ñ!ˆˆ[˜&ô ˜"œf×0Ñ0°&Ó9ˆØ	ð 
ˆqÙÜ�Q˜ ZÔ0Ü��D˜*Ô%Ü(ØˆzÐ+¨Q¯Y©Y¸¿¹¸ó
ÑˆˆMð  Ñ+ˆŒØ�}‰}˜QÔÜÐØ÷
÷ 
ò 
úð 	ðØs   Á&A&CÃCc                 ó´   — 	 	 | j                  «        y # t        j                  $ r t        | |«       Y n$t        j                  $ r t        | |«       Y nw xY wŒXr   )Údo_handshaker^   r  r–   r  r˜   r”   s     r   Ú_tls_handshaker9    sS   € Ø
ð	.Ø�N‰NÔØøÜ×#Ñ#ò 	.Ü˜q *Ö-Ü×$Ñ$ò 	.Ü˜q *Ö-ð	.úð s   ƒ ”AµAÁAr²   c                 ó   — d }d }t        |t        «      rOt        j                  j	                  |«      r|}n-t        j                  j                  |«      r|}nt        d«      ‚t        j                  ||¬«      }t        j                  j                  |_        | €d|_        |j                  dg«       |du rt        j                  |_        |S )Nzinvalid verify string)ÚcafileÚcapathFÚdot)r€   rØ   r3  rH   ÚisfileÚisdirr©   r^   ro   Ú
TLSVersionÚTLSv1_2Úminimum_versionÚcheck_hostnameÚset_alpn_protocolsrp   Úverify_mode)r²   r¿   r;  r<  r¹   s        r   Ú_make_dot_ssl_contextrF    s©   € ð !€FØ €FÜ�&œ#ÔÜ�7‰7�>‰>˜&Ô!Ø‰FÜ�W‰W�]‰]˜6Ô"Ø‰FäÐ4Ó5Ð5Ü×,Ñ,°FÀ6ÔJ€KÜ"%§.¡.×"8Ñ"8€KÔØÐØ%*ˆÔ"Ø×"Ñ" E 7Ô+Ø��Ü"%§-¡-ˆÔØÐr   r¹   c                 óú  — |rt        | ||||||||«	      S | j                  «       }t        |«      \  }}t        ||||«      \  }}}|	€|st	        |
|«      }	t        |t        j                  ||	|
¬«      5 }t        |||«       t        ||«       t        |||«       t        |||| j                  | j                  |«      \  }}||z
  |_        | j                  |«      st         ‚|cddd«       S # 1 sw Y   nxY w	 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``.

    N)r¹   r²   )r  rÑ   r)   r¯   rF  r1   r2   r3   r4   r9  r"  r(  rÌ   r	  r
   rä   rw   )rº   r«   r   r:   rA   r¬   r»   r¼   rB   r¹   r²   r¿   rå   r
  r   r@   r¥   r•   rë   r  s                       r   ÚtlsrH  1  s,  € ñz ô ØØØØØØØØØó

ð 
	
ð �9‰9‹;€DÜ-¨gÓ6Ñ€Z�Ü 7Øˆt�V˜[ó!Ñ€Rˆ�fð Ð¡4Ü+¨O¸VÓDˆä	Ø
Ü×ÑØØØ'ô
ð ð 
Ü��K Ô,Ü�q˜*Ô%Ü��D˜*Ô%Ü(ØˆzÐ+¨Q¯Y©Y¸¿¹¸ó
ÑˆˆMð  Ñ+ˆŒØ�}‰}˜QÔÜÐØ÷!÷ ò úð$ 	ðØs   Á4A0C.Ã.C7Ú
connectionc                 ó   — t         j                  j                  st        d«      ‚d| _        | j                  «       }|rt        j                  d«      }|}n#t         j                  j                  |	|
¬«      }|}|5  |sj                  ||||«      }t        |«      \  }}j                  |«      5 }|j                  |d«       |j                  t        |«      «      }ddd«       t        j                  «       }ddd«       t         j                   j#                  || j$                  | j&                  ||¬«      }t)        z
  d«      |_        | j+                  |«      st,        ‚|S # 1 sw Y   ŒŠxY w# 1 sw Y   ŒzxY w)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.

    *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.

    Returns a ``dns.message.Message``.
    zDNS-over-QUIC is not available.r   N)rE  Úserver_nameTrË   r	   )r   ÚquicÚ	have_quicr|   ÚidrÑ   rÕ   rÖ   ÚSyncQuicManagerÚconnectr)   Úmake_streamrô   Úreceiver   r
   rà   rá   rÌ   rÍ   Úmaxrä   rw   )rº   r«   r   r:   rA   r¬   r»   r¼   rI  r¿   r²   rå   ÚmanagerÚthe_connectionÚthe_managerÚstartr   ÚstreamÚfinishrë   s                       r   rL  rL  œ  s_  € ôd �8‰8×ÒÜÐ5Ó6Ð6à€A„DØ�9‰9‹;€Dñ Ü5?×5KÑ5KÈDÓ5QˆØ#‰ä—(‘(×*Ñ*Ø¨Oð +ó 
ˆð ˆà	ñ ÙØ(×0Ñ0°¸¸fÀkÓRˆNÜ,¨WÓ5Ñˆ�
Ø×'Ñ'¨Ó0ð 	:°FØ�K‰K˜˜dÔ#Ø—>‘>¤*¨ZÓ"8Ó9ˆD÷	:ô —‘“ˆ÷ô 	�‰×ÑØØ—	‘	Ø—M‘MØ)Ø'ð 	ó 	€Aô �˜%‘ Ó%€A„FØ�=‰=˜ÔÜÐØ€H÷	:ð 	:ú÷	ð ús$   Á<6E4Â2-E(ÃE4Å(E1	Å-E4Å4E=ÚzoneÚrdtypeÚrdclassÚkeynameÚ
relativizer(   ÚserialÚuse_udpÚkeyalgorithmc              #   óî
  K  — t        |t        «      rt        j                  j	                  |«      }t        j
                  j                  j                  |«      }t        j                  j                  |||«      }|t        j
                  j                  k(  rAt        j                  j	                  |dddd|z  «      }|j                  j                  |«       |�|j                  |||¬«       |j                  «       }t!        | ||
|«      \  }}}
|r(|t        j
                  j                  k7  rt#        d«      ‚|rt$        j&                  nt$        j(                  }t+        |||
«      5 }t-        |	«      \  }}t/        |||«       t1        |«      }|rt3        ||d|«       n&t5        j6                  d|«      |z   }t9        |||«       d	}d
}d	}d}|r|}t        j                  j:                  }nd}|}d} |�sgt-        |«      \  }}!|!�|�|!|kD  r|}!|rt=        |d|!«      \  }}n2t?        |d|!«      }"t5        j@                  d|"«      \  }t?        |||!«      }|t        j
                  j                  k(  }#t        j                  jC                  ||jD                  |jF                  d
|| d
|#¬«      }$|$jI                  «       }%|%t        jH                  jJ                  k7  rtM        |%«      ‚|$jN                  } d}&|€ÿ|$jP                  r|$jP                  d   j                  |k7  rt        jR                  jU                  d«      ‚|$jP                  d   }|jV                  t        j
                  jX                  k7  rt        jR                  jU                  d«      ‚d}&|j[                  «       }|t        j
                  j                  k(  r4t        j\                  j_                  |d   j\                  «      |k  rd
}nd
}|$jP                  |&d D �]  }|rt        jR                  jU                  d«      ‚|jV                  t        j
                  jX                  k(  r¬|j                  |k(  r�|r4|d   j\                  |k7  rt        jR                  jU                  d«      ‚d	}n |t        j
                  j                  k(  r| }||k(  sŒ·|t        j
                  j`                  k(  s!|t        j
                  j                  k(  sŒò|sŒõd
}Œø|sŒût        j
                  j`                  }d	}�Œ |r7|jD                  r+|$jb                  st        jR                  jU                  d«      ‚|$–— |s�Œgddd«       y# 1 sw Y   yxY w­w)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.
    r   ÚINÚSOAz. . %u 0 0 0 0N)Ú	algorithmzcannot do a UDP AXFRr$  FTr  r  ©rÌ   rÍ   ÚxfrÚoriginÚtsig_ctxÚmultir»   z No answer or RRset not for qnamezfirst RRset is not an SOArš   zanswers after final SOAzIXFR base serial mismatchúmissing TSIG)2r€   rØ   r   ÚnameÚ	from_textÚ	rdatatypeÚ	RdataTypeÚmakerà   Ú
make_queryÚIXFRÚrrsetÚ	authorityr,   Úuse_tsigrÑ   r¯   r©   r2   r  r3   r1   r)   r4   rÙ   rö   r%  Úpackr  Úemptyrñ   r  r&  rá   rÌ   r	  ÚrcodeÚNOERRORÚTransferErrorri  Úanswerr   Ú	FormErrorr[  rd  Úcopyr_  ÚSerialÚAXFRÚhad_tsig)'r«   rZ  r[  r\  r   r:   rÌ   r]  r^  r(   rA   r¬   r_  r`  ra  rº   rs  rå   r@   r¥   Ú	sock_typer•   r=   r   r  r!  ÚdoneÚdelete_modeÚexpecting_SOAÚ	soa_rrsetrh  Úonameri  Úmexpirationr'  Úis_ixfrrë   rx  Úanswer_indexs'                                          r   rg  rg  ó  s”  è ø€ ôJ �$œÔÜ�x‰x×!Ñ! $Ó'ˆÜ�]‰]×$Ñ$×)Ñ)¨&Ó1€FÜ�‰×Ñ˜t V¨WÓ5€AØ”—‘×#Ñ#Ò#Ü—	‘	×#Ñ# D¨!¨T°5Ð:JÈVÑ:SÓTˆØ	�‰×Ñ˜5Ô!ØÐØ	�
‰
�7˜G¨|ˆ
Ô<Ø�9‰9‹;€DÜ 7Øˆt�V˜[ó!Ñ€Rˆ�fñ �6œSŸ]™]×/Ñ/Ò/ÜÐ/Ó0Ð0Ù%,”×!Ò!´&×2DÑ2D€IÜ	�b˜) VÓ	,ð b°Ü(¨Ó2‰ˆˆJÜ��K Ô,Ü�‹IˆÙÜ�a˜˜t ZÕ0ä—[‘[  qÓ)¨DÑ0ˆFÜ�q˜& *Ô-ØˆØˆØˆØˆ	ÙØˆFÜ—H‘H—N‘N‰EàˆFØˆEØˆÚÜ-¨gÓ6ÑˆQ�ØÐ"ØÐ&¨;¸Ò+Cà(�ÙÜ% a¨°Ó<‘	�‘qä! ! Q¨Ó4�Ü—}‘} T¨5Ó1‘�Ü   A {Ó3�Ø¤§¡× 2Ñ 2Ñ2ˆGÜ—‘×%Ñ%ØØŸ	™	ØŸE™EØØØ!ØØ!(ð &ó 	ˆAð —G‘G“IˆEØœŸ	™	×)Ñ)Ò)Ü# EÓ*Ð*Ø—z‘zˆHØˆLØÐ Ø—x’x 1§8¡8¨A¡;×#3Ñ#3°uÒ#<ÜŸ-™-×1Ñ1Ð2TÓUÐUØŸ™ ™�Ø—<‘<¤3§=¡=×#4Ñ#4Ò4ÜŸ-™-×1Ñ1Ð2MÓNÐNØ �Ø!ŸJ™J›L�	ØœSŸ]™]×/Ñ/Ò/Ü—z‘z×(Ñ(¨°1©×)<Ñ)<Ó=ÀÒGð  $™à(,˜ð
 Ÿ™ , -Ð0ó *�ÙÜŸ-™-×1Ñ1Ð2KÓLÐLØ—<‘<¤3§=¡=×#4Ñ#4Ò4¸¿¹ÀuÒ9LÙ$Ø  ™8Ÿ?™?¨fÒ4Ü"%§-¡-×"9Ñ"9Ð:UÓ"VÐVØ(-™Ø¤3§=¡=×#5Ñ#5Ò5Ø*5 o˜ð  	Ó)Ø¤#§-¡-×"4Ñ"4Ò4Ø"¤c§m¡m×&8Ñ&8Ó8º[à#™Ú"ô !Ÿ]™]×/Ñ/�FØ$)’Mð7*ñ8 ˜Ÿ	š	¨!¯*ª*Ü—m‘m×-Ñ-¨nÓ=Ð=ØŠGó] ÷)b÷ bñ büs8   ‚E)U5Å+MU)Ò<:U)Ó7U)Ó:U)Ô AU)Õ 	U5Õ)U2Õ.U5c                   ó   — e Zd ZdZdZdZdZy)Ú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)rJ   rK   rL   ru   ÚNEVERÚ	TRY_FIRSTÚONLYr\   r   r   r‹  r‹  ­  s   „ ñð €EØ€IØ�Dr   r‹  Útxn_managerÚudp_modec	                 óä  — |€#t         j                  j                  |«      \  }}	nt         j                  j                  |«      }	|j                  d   j
                  }
|
t         j                  j                  k(  }|j                  «       }|j                  «       }t        | |||«      \  }}}t        |«      \  }}d}|�rÉd}|r&|t        j                  k7  rt        j                  }d}nt        j                   }d}t#        |||«      5 }t%        |||«       |rt'        ||d|«       n/t)        j*                  dt-        |«      «      |z   }t/        |||«       t         j                  j1                  ||
|	|«      5 }d}d}|s»t        |«      \  }}|�|�||kD  r|}|rt3        |d|«      \  }}n2t5        |d|«      }t)        j6                  d|«      \  }t5        |||«      }t         j8                  j;                  ||j<                  |j>                  d||| |¬«      }	 |jA                  |«      }|jF                  }|sŒ»|s7|j<                  r+jH                  st         jJ                  jM                  d	«      ‚ddd«       ddd«       |r�ŒÈyy# t         j                  jB                  $ r0 |sJ ‚|t        jD                  k(  r‚ d}d}t        j                  }Y �ŒXw xY w# 1 sw Y   ŒgxY w# 1 sw Y   ŒkxY w)
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.UDPMode.NEVER``, i.e. only use
    TCP.  Other possibilities are ``dns.UDPMode.TRY_FIRST``, which
    means "try UDP but fallback to TCP if needed", and
    ``dns.UDPMode.ONLY``, which means "try UDP and raise
    ``dns.xfr.UseTCP`` if it does not succeed.

    Raises on errors.
    Nr   TFr$  r  r  rf  rk  )'r   rg  rq  Úextract_serial_from_queryÚquestionr[  rn  rr  Úfrom_wire_originrÑ   r¯   r)   r‹  rŒ  r2   r  r3   r1   r4   rö   r%  rv  rÙ   r  ÚInboundrñ   r  r&  rà   rá   rÌ   r	  Úprocess_messageÚUseTCPrŽ  ri  r€  r   r|  )r«   r�  rÿ   r:   r   r(   rA   r¬   r�  r_  r[  rˆ  rh  rå   r@   r¥   r=   r   Úretryr�  Úis_udpr•   r!  Úinboundr‚  ri  r‡  Úrwirer'  r  rë   s                                  r   Úinbound_xfrrœ  º  sÁ  € ð^ €}ÜŸ'™'×,Ñ,¨[Ó9‰ˆ‘ä—‘×2Ñ2°5Ó9ˆØ�^‰^˜AÑ×%Ñ%€FØœŸ™×*Ñ*Ñ*€GØ×)Ñ)Ó+€FØ�=‰=‹?€DÜ 7Øˆt�V˜[ó!Ñ€Rˆ�fô % XÓ.�O€Qˆ
Ø€EÚ
ØˆÙ�x¤7§=¡=Ò0Ü×)Ñ)ˆIØ‰Fä×*Ñ*ˆIØˆFÜ˜"˜i¨Ó0ð ,	B°AÜ�Q˜ ZÔ0ÙÜ˜!˜T 4¨Õ4äŸ™ T¬3¨t«9Ó5¸Ñ<�Ü˜1˜f jÔ1Ü—‘—‘ ¨f°f¸fÓEð %BÈØ�Ø�ÙÜ'5°gÓ'>Ñ$�Q˜Ø"Ð*Ø"Ð.°;ÀÒ3Kà&0˜ÙÜ%.¨q°%¸Ó%E™
˜¡ä )¨!¨Q°Ó <˜Ü%Ÿ}™}¨T°5Ó9™˜Ü )¨!¨Q°Ó <˜ÜŸ™×-Ñ-ØØ %§¡Ø$)§I¡IØ Ø%Ø!)Ø#)˜zØ)0ð .ó 	�Að	!Ø&×6Ñ6°qÓ9˜ð  !Ÿz™z�HòA ñB  §¢°q·z²zÜŸ-™-×1Ñ1°.ÓAÐA÷K%B÷,	Bõ øôT Ÿ7™7Ÿ>™>ò !Ù%˜˜vØ#¤w§|¡|Ò3Ø!Ø#˜Ø $˜Ü#*§=¡=˜Ú ð!ú÷7%Bð %Bú÷,	Bð ,	BúsQ   Ä	A0K&Å9B!KÈJ
È,KÈ;9KÉ4K&Ê
A	KËKËKËKËK#	ËK&Ë&K/)T)NNr   )
NNFFNr   FFFN)
Nr  Nr   FFFFNF)
Nr  Nr   FFFNNF)NFNr   F)Nr  Nr   FFN)
NéU  Nr   FFNNNT)	Nr�  Nr   FFNTN)wru   rÚ   rÕ   Úenumr+  r3  Úos.pathrƒ   r2   r%  r
   Útypingr   r   r   r   r   Údns._featuresr   Údns.exceptionÚdns.inetÚdns.messageÚdns.nameÚdns.quicÚ	dns.rcodeÚdns.rdataclassÚdns.rdatatypeÚ
dns.serialÚdns.transactionÚdns.tsigÚdns.xfrr   r   Ú	_featuresÚhaveÚ_have_httpxÚhttpcore._backends.syncr7   rÏ   ÚNetworkBackendÚ_CoreNetworkBackendÚ	_backendsÚsyncÚ
SyncStreamr5   r   ÚHTTPTransportrP   rÎ   r^   ÚImportErrorr³   r   ÚDNSExceptionrs   r|  rw   ry   r|   rg  rz  r)   r�   r�   Úhasattrr‘   r‚   ÚSelectSelectorr–   r˜   r¡   r§   r¯   r1   rY   rà   rù   rØ   ÚfloatÚintÚboolrì   rñ   rö   Úbytesrü   rl  ÚNameÚtsigÚKeyr  r  r  r  r  r"  r(  r4   r  r9  ri   rF  rl   rH  rL  ÚSyncQuicConnectionrn  r  Ú
rdataclassrc  Údefault_algorithmro  Ú
RdataClassÚIntEnumr‹  rŒ  ÚtransactionÚTransactionManagerrœ  r\   r   r   ú<module>rÊ     s¿  ðñ$ ã Û Û Û Û 	Û Û Û Û Û ß 4Õ 4ã Û Û Û Û Û Û Û Û Û Û Û Û òò2ð �m‰m× Ñ  Ó'€ÙÛ"Ûà"×1Ñ1ÐØ×(Ñ(×-Ñ-×8Ñ8€Oô2&Ð-ô 2&ôh˜×,Ñ,õ ÷,&ñ &ð
 €ð.Ûð2 —‘€ôH�s—}‘}×1Ñ1ô HôG�#—-‘-×)Ñ)ô GôˆC�M‰M×&Ñ&ô ô
ˆC�M‰M×&Ñ&ô ð —‘×%Ñ%€ò$ò$ò8%ñ ˆ9�nÔ%ð  ×,Ñ,�Oà×.Ñ.€Oò0ò0ò	)òð" =Aó)%óXð.  $ØØ ØØ"Ø!Ø!ØØØ'+Ø#Ø26Ø"×,Ñ,ñQØ
‡{�{×ÑðQàðQð �e‰_ðQð ð	Qð
 �S‰MðQð ðQð ðQð ðQð �c‰]ðQð ðQð ðQð   ‘}ðQð �$˜�)ÑðQð Ð.Ñ/ðQð �S‰MðQð  	‡[�[×Ñó!Qòh	1ò1ð& #'ñ	Ø
ðà
�—‘×#Ñ# UÐ*Ñ
+ðð ðð ˜‘ð	ð
 ˆ3�ˆ:Ñóð> "&Ø"&Ø#Ø"Ø;?Ø#&Ø!Ø %ØØ+/ñg4Ø
ðg4à˜#‘ðg4ð ˜‘ðg4ð ð	g4ð
 ðg4ð �d˜3Ÿ8™8Ÿ=™=¨#¯(©(¯,©,Ð6Ñ7Ñ8ðg4ð ˜%‘ðg4ð ðg4ð ðg4ð ðg4ð �C—K‘K×'Ñ'Ñ(ðg4ð 	óg4ðZ  $ØØ ØØ#Ø"Ø!Ø %ØØñXØ
‡{�{×ÑðXàðXð �e‰_ðXð ð	Xð
 �S‰MðXð ðXð ðXð ðXð ðXð ðXð �3‰-ðXð ðXð 	‡[�[×ÑóXð|  $ØØ ØØ#Ø"Ø!Ø"Ø"ØñU Ø
‡{�{×ÑðU àðU ð �e‰_ðU ð ð	U ð
 �S‰MðU ð ðU ð ðU ð ðU ð ðU ð �s‰mðU ð �s‰mðU ð ðU ð ˆ3�;‰;×Ñ Ð$Ñ%óU òpò*1ð& #'ñ$Ø
ð$à
�—‘×#Ñ# UÐ*Ñ
+ð$ð ˜‘ð$ð ˆ3�ˆ:Ñó	$ð@ #'Ø"Ø;?Ø#&Ø!ñ,Ø
ð,à˜‘ð,ð ð,ð �d˜3Ÿ8™8Ÿ=™=¨#¯(©(¯,©,Ð6Ñ7Ñ8ð	,ð
 ˜%‘ð,ð ð,ð ˆ3�;‰;×Ñ Ð%Ñ&ó,ò^-ð  $ØØ ØØ"Ø!ØñAØ
‡{�{×ÑðAàðAð �e‰_ðAð ð	Að
 �S‰MðAð ðAð ðAð ðAð �3‰-ðAð 	‡[�[×ÑóAòH.ðØ˜c‘]ðØ,1°$¸°)Ñ,<ðà‡^�^óð2  $ØØ ØØ"Ø!Ø$(Ø,0Ø%)Ø#ñhØ
‡{�{×Ñðhàðhð �e‰_ðhð ð	hð
 �S‰Mðhð ðhð ðhð ðhð �3—=‘=Ñ
!ðhð ˜#Ÿ.™.Ñ)ðhð ˜c‘]ðhð �$˜�)Ñðhð 	‡[�[×Ñóhð\  $ØØ ØØ"Ø!Ø8<Ø#Ø%)ñTØ
‡{�{×ÑðTàðTð �e‰_ðTð ð	Tð
 �S‰MðTð ðTð ðTð ðTð ˜Ÿ™×4Ñ4Ñ5ðTð �$˜�)ÑðTð ˜c‘]ðTð 	‡[�[×ÑóTðt 36·-±-×2DÑ2DØ58·^±^×5FÑ5FØ#ØØ;?Ø37ØØ $Ø ØØØØ.1¯h©h×.HÑ.HñwØðwà
�—‘—‘˜sÐ"Ñ
#ðwð �#—-‘-×)Ñ)¨3Ð.Ñ/ðwð �3—>‘>×,Ñ,¨cÐ1Ñ2ð	wð
 �e‰_ðwð ðwð �d˜3Ÿ8™8Ÿ=™=¨#¯(©(¯,©,Ð6Ñ7Ñ8ðwð �e˜CŸH™HŸM™M¨3Ð.Ñ/Ñ0ðwð ðwð �u‰oðwð �S‰Mðwð ðwð ðwð ðwð ˜Ÿ™Ÿ™ sÐ*Ñ+ðwð  	ó!wôt
ˆd�l‰lô 
ð  ,0ØØ#Ø $Ø ØØŸ™ñpBØðpBà—‘×3Ñ3ðpBð �C—K‘K×'Ñ'Ñ(ðpBð ð	pBð
 �e‰_ðpBð �u‰oðpBð �S‰MðpBð ðpBð ðpBð 
ôpBøðC) ò .÷.ô .ð.ús   Ã2] Ý]"Ý!]"