/usr/lib/python3.9/site-packages/dns/__pycache__
NameSizeModeActions
asyncbackend.cpython-39.opt-1.pyc26160644editdlrm
asyncbackend.cpython-39.pyc26160644editdlrm
asyncquery.cpython-39.opt-1.pyc178050644editdlrm
asyncquery.cpython-39.pyc178170644editdlrm
asyncresolver.cpython-39.opt-1.pyc129580644editdlrm
asyncresolver.cpython-39.pyc130020644editdlrm
dnssec.cpython-39.opt-1.pyc321600644editdlrm
dnssec.cpython-39.pyc321880644editdlrm
dnssectypes.cpython-39.opt-1.pyc16160644editdlrm
dnssectypes.cpython-39.pyc16160644editdlrm
e164.cpython-39.opt-1.pyc34520644editdlrm
e164.cpython-39.pyc34520644editdlrm
edns.cpython-39.opt-1.pyc147200644editdlrm
edns.cpython-39.pyc147340644editdlrm
entropy.cpython-39.opt-1.pyc33480644editdlrm
entropy.cpython-39.pyc33480644editdlrm
enum.cpython-39.opt-1.pyc32490644editdlrm
enum.cpython-39.pyc32490644editdlrm
exception.cpython-39.opt-1.pyc55180644editdlrm
exception.cpython-39.pyc57140644editdlrm
flags.cpython-39.opt-1.pyc22080644editdlrm
flags.cpython-39.pyc22080644editdlrm
grange.cpython-39.opt-1.pyc10890644editdlrm
grange.cpython-39.pyc11330644editdlrm
immutable.cpython-39.opt-1.pyc24280644editdlrm
immutable.cpython-39.pyc24280644editdlrm
inet.cpython-39.opt-1.pyc46030644editdlrm
inet.cpython-39.pyc46030644editdlrm
ipv4.cpython-39.opt-1.pyc18440644editdlrm
ipv4.cpython-39.pyc18440644editdlrm
ipv6.cpython-39.opt-1.pyc39380644editdlrm
ipv6.cpython-39.pyc39380644editdlrm
message.cpython-39.opt-1.pyc506310644editdlrm
message.cpython-39.pyc506720644editdlrm
name.cpython-39.opt-1.pyc350740644editdlrm
name.cpython-39.pyc350890644editdlrm
namedict.cpython-39.opt-1.pyc29860644editdlrm
namedict.cpython-39.pyc29860644editdlrm
nameserver.cpython-39.opt-1.pyc89080644editdlrm
nameserver.cpython-39.pyc89080644editdlrm
node.cpython-39.opt-1.pyc116050644editdlrm
node.cpython-39.pyc116050644editdlrm
opcode.cpython-39.opt-1.pyc24750644editdlrm
opcode.cpython-39.pyc24750644editdlrm
query.cpython-39.opt-1.pyc402980644editdlrm
query.cpython-39.pyc403430644editdlrm
rcode.cpython-39.opt-1.pyc32530644editdlrm
rcode.cpython-39.pyc32530644editdlrm
rdata.cpython-39.opt-1.pyc236090644editdlrm
rdata.cpython-39.pyc236090644editdlrm
rdataclass.cpython-39.opt-1.pyc27920644editdlrm
rdataclass.cpython-39.pyc27920644editdlrm
rdataset.cpython-39.opt-1.pyc154370644editdlrm
rdataset.cpython-39.pyc154510644editdlrm
rdatatype.cpython-39.opt-1.pyc66730644editdlrm
rdatatype.cpython-39.pyc66730644editdlrm
renderer.cpython-39.opt-1.pyc98220644editdlrm
renderer.cpython-39.pyc98410644editdlrm
resolver.cpython-39.opt-1.pyc524720644editdlrm
resolver.cpython-39.pyc526250644editdlrm
reversename.cpython-39.opt-1.pyc30550644editdlrm
reversename.cpython-39.pyc30550644editdlrm
rrset.cpython-39.opt-1.pyc78850644editdlrm
rrset.cpython-39.pyc78990644editdlrm
serial.cpython-39.opt-1.pyc29330644editdlrm
serial.cpython-39.pyc29330644editdlrm
set.cpython-39.opt-1.pyc87990644editdlrm
set.cpython-39.pyc87990644editdlrm
tokenizer.cpython-39.opt-1.pyc172420644editdlrm
tokenizer.cpython-39.pyc172560644editdlrm
transaction.cpython-39.opt-1.pyc202610644editdlrm
transaction.cpython-39.pyc202610644editdlrm
tsig.cpython-39.opt-1.pyc103810644editdlrm
tsig.cpython-39.pyc103810644editdlrm
tsigkeyring.cpython-39.opt-1.pyc18350644editdlrm
tsigkeyring.cpython-39.pyc18350644editdlrm
ttl.cpython-39.opt-1.pyc16800644editdlrm
ttl.cpython-39.pyc16800644editdlrm
update.cpython-39.opt-1.pyc88860644editdlrm
update.cpython-39.pyc88860644editdlrm
version.cpython-39.opt-1.pyc5630644editdlrm
version.cpython-39.pyc5630644editdlrm
versioned.cpython-39.opt-1.pyc87230644editdlrm
versioned.cpython-39.pyc87750644editdlrm
win32util.cpython-39.opt-1.pyc56530644editdlrm
win32util.cpython-39.pyc56530644editdlrm
wire.cpython-39.opt-1.pyc33270644editdlrm
wire.cpython-39.pyc33550644editdlrm
xfr.cpython-39.opt-1.pyc77710644editdlrm
xfr.cpython-39.pyc77890644editdlrm
zone.cpython-39.opt-1.pyc452680644editdlrm
zone.cpython-39.pyc454120644editdlrm
zonefile.cpython-39.opt-1.pyc176630644editdlrm
zonefile.cpython-39.pyc176870644editdlrm
zonetypes.cpython-39.opt-1.pyc10230644editdlrm
zonetypes.cpython-39.pyc10230644editdlrm
_asyncbackend.cpython-39.opt-1.pyc42080644editdlrm
_asyncbackend.cpython-39.pyc42080644editdlrm
_asyncio_backend.cpython-39.opt-1.pyc89840644editdlrm
_asyncio_backend.cpython-39.pyc90020644editdlrm
_ddr.cpython-39.opt-1.pyc40710644editdlrm
_ddr.cpython-39.pyc40710644editdlrm
_features.cpython-39.opt-1.pyc23670644editdlrm
_features.cpython-39.pyc23670644editdlrm
_immutable_ctx.cpython-39.opt-1.pyc21590644editdlrm
_immutable_ctx.cpython-39.pyc21590644editdlrm
__init__.cpython-39.opt-1.pyc6670644editdlrm
__init__.cpython-39.pyc6670644editdlrm
Edit: /usr/lib/python3.9/site-packages/dns/__pycache__/query.cpython-39.pyc (40343B)
a àMÒe0Öã@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z mZmZmZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZdd„Zdd„Z ej! "d¡Z#e#�r>ddl$Z%ddl&Z&e%j'Z(e%j)j*j+Z,Gd d „d e(ƒZ-Gd d „d e&j.ƒZ/nGd d „d ƒZ/e#Z0z ddl1Z1Wn"e2�y~Gdd„dƒZ1Yn0ejZ3Gdd„dej4j5ƒZ6Gdd„dej4j7ƒZ8Gdd„dej4j5ƒZ9Gdd„dej4j5ƒZ:ej;jdd„Z?e@edƒ�r ejAaBnejCaBdd „ZDd!d"„ZEd#d$„ZFd%d&„ZGdhd(d)„ZHdid*d+„ZIdd,ddd-d-dd.d'dd'dejJf ejKjLeMeeNeOeeMeOePePee eMePeeMeePeMfed/eeOejKjLd0œd1d2„ZQd3d4„ZRd5d6„ZSdje eejKjLeTfe eeNeeOeNfd7œd8d9„ZUdke ee eeNePePee ejVjWejXjYfeeTePePePeejKjLe d;œ dddd'ddddd-ejXjnf eMeejVjWeMfeejjjoeMfeejljpeMfeeNeOee ejVjWejXjYfeeejVjWeMfePeeNeeMeOeOePeejVjWeMfe d`œdadb„Z;Gdcdd„ddejqƒZrdd>dddderjsfeMejtjueejKjLeOeeNeeNeeMeOerddeœ dfdg„ZvdS)szTalk to a DNS server.éN)ÚAnyÚDictÚOptionalÚTupleÚUnioncCs,|dur dS|t ¡}|dkr(tjj‚|S)Nç)ÚtimeÚdnsÚ exceptionÚTimeout)Ú expirationÚtimeout©rú-/usr/lib/python3.9/site-packages/dns/query.pyÚ _remaining/s  rcCs|dur dStt ¡||ƒS©N)Úminr)r r rrrÚ_expiration_for_this_attempt8srZdohcs0eZdZ‡fdd„Zddd„Zd dd„Z‡ZS) Ú_NetworkBackendcs&tƒ ¡||_||_||_||_dSr)ÚsuperÚ__init__Ú _local_portÚ _resolverÚ_bootstrap_addressÚ_family)ÚselfÚresolverÚ local_portÚbootstrap_addressÚfamily©Ú __class__rrrGs  z_NetworkBackend.__init__Nc Csg}t|ƒ\}}tj |¡r(| |¡nP|jdur@| |j¡n8t|ƒ}|j} |r^tj |¡} |j j || |d�} |   ¡}|D]’} tj | ¡} |dusž|j dkr´tj  ||j f| ¡} nd} t| tj| ƒ}td|ƒ}z(t|tj  | |f| ¡|ƒt|ƒWSt�y Yq|0q|tj‚dS)N)rÚlifetimerg@)Ú_compute_timesr ÚinetÚ is_addressÚappendrrrÚ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 rZanswersÚaddressÚafÚsourceÚsockZattempt_expirationrrrÚ connect_tcpNsB     ÿ  ÿ ýz_NetworkBackend.connect_tcpcCst‚dSr©ÚNotImplementedError)rÚpathr r5rrrÚconnect_unix_socketusz#_NetworkBackend.connect_unix_socket)N)N)Ú__name__Ú __module__Ú __qualname__rr;r?Ú __classcell__rrr rrFs  ÿ (ÿrcs*eZdZdddejdœ‡fdd„ Z‡ZS)Ú_HTTPTransportrN)rrrrcsB|durddl}|j ¡}tƒj|i|¤Žt||||ƒ|j_dS©Nr)Z dns.resolverrZResolverrrrZ_poolZ_network_backend)rrrrrÚargsÚkwargsr r rrr{s  ÿz_HTTPTransport.__init__)r@rArBr,Ú AF_UNSPECrrCrrr rrDzs úrDc@seZdZdd„ZdS)rDcCst‚dSrr<)rr2r3r r4rrrr;‘sz_HTTPTransport.connect_tcpN)r@rArBr;rrrrrD�sc@sXeZdZdZGdd„deƒZGdd„deƒZGdd„dƒZGdd „d ƒZe d d „ƒZ d S) Ússlrc@s eZdZdS)zssl.WantReadExceptionN©r@rArBrrrrÚWantReadExceptionžsrKc@s eZdZdS)zssl.WantWriteExceptionNrJrrrrÚWantWriteException¡srLc@s eZdZdS)zssl.SSLContextNrJrrrrÚ SSLContext¤srMc@s eZdZdS)z ssl.SSLSocketNrJrrrrÚ SSLSocket§srNcOs tdƒ‚dS)Nzno ssl support)r0)ÚclsrFrGrrrÚcreate_default_contextªszssl.create_default_contextN) r@rArBÚ CERT_NONEr0rKrLrMrNÚ classmethodrPrrrrrI›srIc@seZdZdZdS)ÚUnexpectedSourcez=A DNS query response came from an unexpected address or port.N©r@rArBÚ__doc__rrrrrS´srSc@seZdZdZdS)Ú BadResponsez|j|d|d�WS|WSWntyb| ¡‚Yn0dS)NF)Zdo_handshake_on_connectÚserver_hostname)Úsocket_factoryZ setblockingZbindZ wrap_socketr0Úclose)r8Útyper9Ú ssl_contextrtrfrrrr+Rs   ý  r+i»Fz /dns-queryzdns.resolver.Resolver)Úqrqr r3r9rrÚone_rr_per_rrsetÚignore_trailingÚsessionr>ÚpostrÚverifyrrÚreturnc Csâtst‚|r t|tjƒs tdƒ‚| ¡}t||||dƒ\}}}d}ddi}|dur’tj   |¡r’|t j krxd  ||| ¡}q–|t jkr–d  ||| ¡}n|}|dur¨d}d}n|d}|d }t|d d | || | |d �}|ràt |¡}ntjd d | |d �}|�p}| �r*| dtt|ƒƒd œ¡|j||||d�}n.t |¡ d¡}| ¡}|j|||d|id�}Wdƒn1�sn0Y|jdk�s�|jdk�r¦td  ||j|j¡ƒ‚tjj|j|j|j ||d�}|j! "¡|_#| $|¡�sÞt%‚|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://:/. *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.ClientFNZacceptzapplication/dns-messagezhttps://{}:{}{}zhttps://[{}]:{}{}rriT)r4Úhttp1Úhttp2r~rrrr)r€r�r~Ú transport)z content-typezcontent-length)ÚheadersÚcontentr ó=r )rƒr ÚparamséÈi+z2{} responded with status code {} Response body: {}©ÚkeyringÚ request_macrzr{)&Úhave_dohrWrYÚhttpxZClientrpÚto_wirersr r$r%r,ZAF_INETÚformatZAF_INET6rDÚ contextlibÚ nullcontextÚupdateÚstrÚlenr}Úbase64Zurlsafe_b64encodeÚrstripÚdecodeÚgetZ status_coder„ÚmessageÚ from_wirer‰rŠÚelapsedZ total_secondsrÚ is_responserV)ryrqr r3r9rrrzr{r|r>r}rr~rrÚwirer8r6Z the_sourcer‚rƒÚurlr4rÚcmÚresponseZtwireÚrrrrÚhttpsfs€D ÿ   ø   þÿ ÿ& ÿÿû  r¡cCs0z | |¡WSty(t||ƒYq0qdS)z‹Reads a datagram from the socket. A Timeout exception will be raised if the operation is not completed by the expiration time. N)ZrecvfromÚBlockingIOErrorrg)r:Zmax_sizer rrrÚ _udp_recvús  r£cCsFz"|r| ||¡WS| |¡WSWqty>t||ƒYq0qdS)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. N)ZsendtoÚsendr¢rh)r:Údatarmr rrrÚ _udp_sends  r¦)r:Úwhatrmr rcCs4t|tjjƒr| ¡}t ¡}t||||ƒ}||fS)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. )rYr r˜ÚMessager�rr¦)r:r§rmr Ú sent_timeÚnrrrÚsend_udps r«ó) r:rmr rnrzr‰rŠr{Úraise_on_truncationÚ ignore_errorsÚqueryrc  Csîd} t|d|ƒ\} } t|j| ||ƒs&qt ¡} ztjj| |||||d�}Wnntjjyœ}z6| r†| dur†|  | ¡¡s†WYd}~qn‚WYd}~n&d}~0t y¸| r²Yqn‚Yn0| rÒ| durÒ|  |¡sÒq|rÞ|| fS|| | fSqdS)aRead 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Šrzr{r­N) r£rorrr r˜r™Ú Truncatedr›r0)r:rmr rnrzr‰rŠr{r­r®r¯rœrlÚ received_timer ÚerrrÚ receive_udp2sD> ÿú ÿþ ý r´é5) ryrqr r3r9rrrnrzr{r­r:r®rc  CsÈ| ¡} t||||ƒ\} }}t|ƒ\}}| r8t | ¡}nt| tj|ƒ}|�b}t|| ||ƒt ||||||j |j || | |ƒ \}}|||_ | sš|  |¡sšt‚|WdƒS1s²0YdsÄJ‚dS)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``. NF)r�rsr#r�r�r+r,Ú SOCK_DGRAMr«r´r‰Úmacrr›rV)ryrqr r3r9rrrnrzr{r­r:r®rœr8rmÚ begin_timer ržrfr r²rrrÚudpœs:8ÿ   õ "ÿr¹) ryrqr r3r9rrrnrzr{Úudp_sockÚtcp_sockr®rc Csdz(t|||||||||d| | ƒ } | dfWStjjy^t||||||||| ƒ } | dfYS0dS)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. TFN)r¹r r˜r±Útcp) ryrqr r3r9rrrnrzr{rºr»r®rŸrrrÚudp_with_fallback÷s:9ô ÷ r½c Cs€d}|dkr|z.| |¡}|dkr$t‚|t|ƒ8}||7}Wqttjfy\t||ƒYqtjyxt||ƒYq0q|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) ZrecvÚEOFErrorr“r¢rIÚSSLWantReadErrorrgÚSSLWantWriteErrorrh)r:Úcountr rfrªrrrÚ _net_readOs   rÂc Cstd}t|ƒ}||krpz|| ||d…¡7}Wq ttjfyPt||ƒYq tjylt||ƒYq 0q dS)z‘Write the specified data to the socket. A Timeout exception will be raised if the operation is not completed by the expiration time. rN)r“r¤r¢rIrÀrhr¿rg)r:r¥r ÚcurrentÚlrrrÚ _net_writedsrÅ)r:r§r rcCsPt|tjjƒr|jdd�}nt|ƒ dd¡|}t ¡}t|||ƒt|ƒ|fS)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)Zprepend_lengthéZbig) rYr r˜r¨r�r“Úto_bytesrrÅ)r:r§r Útcpmsgr©rrrÚsend_tcpts  rÉ)r:r rzr‰rŠr{rc CsLt|d|ƒ}t d|¡\}t|||ƒ}t ¡} tjj|||||d�} | | fS)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Úunpackrr r˜r™) r:r rzr‰rŠr{ÚldatarÄrœr²r rrrÚ receive_tcp’s!  ûrÎcCs`| |¡}|dkrdS|tjtjtjfvrDt||ƒ| tjtj ¡}|dkr\t |t   |¡ƒ‚dSrE) Z connect_exÚerrnoZ EINPROGRESSZ EWOULDBLOCKZEALREADYrhZ getsockoptr,Z SOL_SOCKETZSO_ERRORÚOSErrorÚosÚstrerror)rfr7r Úerrrrrr.Ás  r.) ryrqr r3r9rrrzr{r:rc CsÈ| ¡} t|ƒ\} } |r$t |¡} n"t||||ƒ\} }}t| tj|ƒ} | �b}|s\t||| ƒt || | ƒt || ||j |j |ƒ\}}|| |_ | |¡sšt‚|WdƒS1s²0YdsÄJ‚dS)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``. NF)r�r#r�r�rsr+r,r-r.rÉrÎr‰r·rr›rV)ryrqr r3r9rrrzr{r:rœr¸r ržr8rmrfr r²rrrr¼Ìs*+  ÿ   ÿ  "ÿr¼cCsPz| ¡WdStjy,t||ƒYqtjyHt||ƒYq0qdSr)Z do_handshakerIr¿rgrÀrhrerrrÚ_tls_handshakesrÔ)rtr~rcCs„d}d}t|tƒr>tj |¡r$|}ntj |¡r6|}ntdƒ‚tj||d�}tj j |_ |durdd|_ |  dg¡|dur€tj|_|S)Nzinvalid verify string)ÚcafileÚcapathFÚdot)rYr’rÑr>ÚisfileÚisdirrprIrPZ TLSVersionZTLSv1_2Zminimum_versionZcheck_hostnameZset_alpn_protocolsrQÚ verify_mode)rtr~rÕrÖrxrrrÚ_make_dot_ssl_contexts      rÛéU) ryrqr r3r9rrrzr{r:rxrtr~rc  Csò|rt|||||||||ƒ S| ¡} t|ƒ\} }t||||ƒ\}}}| durZ|sZt| | ƒ} t|tj|| | d��h}t|||ƒt ||ƒt || |ƒt ||||j |j |ƒ\}}|| |_| |¡sÄt‚|WdƒS1sÜ0YdsîJ‚dS)akReturn 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)rxrtF)r¼r�r#rsrÛr+r,r-r.rÔrÉrÎr‰r·rr›rV)ryrqr r3r9rrrzr{r:rxrtr~rœr¸r r8rmrfr r²rrrÚtls1sN=÷  ÿ   û   ÿ  "ÿrÝ) ryrqr r3r9rrrzr{Ú connectionr~rtrc  Cstjjstdƒ‚d|_| ¡} |r2t d¡} |} ntjj| | d�} | }| �||s`|  ||||¡} t |ƒ\}}|   |¡�*}|  | d¡|  t|ƒ¡} Wdƒn1s¦0Yt ¡}Wdƒn1sÌ0Ytjj| |j|j||d�}t||dƒ|_| |¡�st‚|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. *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``. zDNS-over-QUIC is not available.rN)rÚZ server_nameTrˆr)r ÚquicZ have_quicrXÚidr�r�r�ZSyncQuicManagerZconnectr#Z make_streamr¤Zreceiverrr˜r™r‰rŠÚmaxr›rV)ryrqr r3r9rrrzr{rÞr~rtrœZmanagerZthe_connectionZ the_managerÚstartr ÚstreamZfinishr rrrrßœs<2 ÿ   ,&û rß)rqÚzoneÚrdtypeÚrdclassr r3r‰ÚkeynameÚ relativizer"r9rrÚserialÚuse_udpÚ keyalgorithmrc' cs¾t|tƒrtj |¡}tjj |¡}tj  |||¡}|tjj krdtj  |dddd| ¡}|j   |¡|dur||j|||d�| ¡}t||| | ƒ\}}} | r°|tjj kr°tdƒ‚| rºtjntj}t||| ƒ��Ú}t| ƒ\}}t|||ƒt|ƒ}| �rt||d|ƒnt d|¡|}t|||ƒd }d }d }d}|�rF|}tjj}nd}|}d} |�sšt|ƒ\}}!|!du�s‚|du�r†|!|k�r†|}!| �ržt|d |!ƒ\}}n&t|d |!ƒ}"t  d|"¡\}t|||!ƒ}|tjj k}#tjj!||j"|j#d || d |#d �}$|$ $¡}%|%tj$j%k�rt&|%ƒ‚|$j'} d}&|du�rª|$j(�r<|$j(dj|k�rHtj) *d¡‚|$j(d}|j+tjj,k�rntj) *d¡‚d}&| -¡}|tjj k�rªtj. /|dj.¡| k�r¦d }nd }|$j(|&d…D]´}|�rÎtj) *d¡‚|j+tjj,k�rX|j|k�rX|�r|dj.| k�r tj) *d¡‚d }n|tjj k�r&| }||k�rj|tjj0k�sR|tjj k�rj|�rjd }n|�r¸tjj0}d }�q¸|�r�|j"�r�|$j1�s�tj) *d¡‚|$V�qRWdƒn1�s°0YdS)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)Ú algorithmzcannot do a UDP AXFRrÊFTr°rÆ©r‰rŠÚxfrÚoriginÚtsig_ctxZmultirzz No answer or RRset not for qnamezfirst RRset is not an SOArizanswers after final SOAzIXFR base serial mismatchú missing TSIG)2rYr’r ÚnameZ from_textÚ rdatatypeÚ RdataTypeZmaker˜Ú make_queryÚIXFRÚrrsetZ authorityr&Zuse_tsigr�rsrpr,r¶r-r+r#r.r“r¦rËÚpackrÅÚemptyr£rÂrÌr™r‰r·ÚrcodeZNOERRORÚ TransferErrorròZanswerr Ú FormErrorråríÚcopyréZSerialÚAXFRÚhad_tsig)'rqrärårær r3r‰rçrèr"r9rrrérêrëryrùrœr8rmÚ sock_typerfr6r rÄrÈÚdoneZ delete_modeZ expecting_SOAZ soa_rrsetrñZonameròÚ mexpirationrÍÚis_ixfrr rüZ answer_indexrrrrðósÆE    ÿ       ÿÿ   ø         ÿ þþ rðc@seZdZdZdZdZdZdS)ÚUDPModeaHow 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" rrirÆN)r@rArBrUÚNEVERZ TRY_FIRSTÚONLYrrrrr­sr) rqÚ txn_managerr¯r3r r"r9rrÚudp_moderc  Csh|durtj |¡\}} n tj |¡} |jdj} | tjjk} | ¡} |  ¡} t ||||ƒ\}}}t |ƒ\}}d}|�rdd}| r–|t j kr–tj}d}n tj}d}t|||ƒ��¢}t|||ƒ|rÐt|| d|ƒn t dt| ƒ¡| }t|||ƒtj || | |¡��,}d}d}|�st |ƒ\}}|du�s>|du�rB||k�rB|}|�rZt|d|ƒ\}}n&t|d|ƒ}t d|¡\}t|||ƒ}tjj||j|jd| || | d�}z|  |¡}WnDtjj!�yô|�sÎJ‚|t j"k�rÜ‚d}d}t j }Y�qYn0|j#}�q|�s"|j�r"|j$�s"tj% &d ¡‚Wdƒn1�s80YWdƒqr1�sX0YqrdS) 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. NrTFrÊr°rÆrïró)'r rðr÷Zextract_serial_from_queryZquestionrårõrøZfrom_wire_originr�rsr#rrr,r¶r-r+r.r¦rËrúr“rÅZInboundr£rÂrÌr˜r™r‰r·Zprocess_messageZUseTCPrròrr rþ)rqr r¯r3r r"r9rrr rérårrñrœr8rmr6r ZretryrZis_udprfrÈZinboundrròrZrwirerÍrÄr rrrÚ inbound_xfrºs€/   ÿ      ÿÿ  ø     r )T)NN)N) NNFFNr¬FFFN) NrµNrFFFFNF) NrµNrFFFNNF)N)NFNr¬F)NrµNrFFN) NrÜNrFFNNNT) NrÜNrFFNTN)wrUr”r�ÚenumrÏrÑZos.pathr\r,rËrÚtypingrrrrrZ dns._featuresr Z dns.exceptionZdns.inetZ dns.messageZdns.nameZdns.quicZ dns.rcodeZdns.rdataclassZ dns.rdatatypeZ dns.serialZdns.transactionZdns.tsigZdns.xfrrrZ _featuresZhaveZ _have_httpxZhttpcore._backends.syncr1rŒZNetworkBackendZ_CoreNetworkBackendZ _backendsÚsyncZ SyncStreamr/rZ HTTPTransportrDr‹rIÚ ImportErrorrur Z DNSExceptionrSrþrVrWrXrðrýr#rarbÚhasattrrcr[ZSelectSelectorrgrhrkrorsr+rHr˜r¨r’ÚfloatÚintÚboolr¡r£r¦Úbytesr«rôÚNameZtsigZKeyr´r¹r½rÂrÅrÉrÎr.r¼rÔrMrÛrNrÝrßZSyncQuicConnectionrõrZ rdataclassrìZdefault_algorithmröZ RdataClassÚIntEnumrrZ transactionZTransactionManagerr rrrrÚs„   4   ÿ , ñ ð  ü û õ ô môó ^ôó Xý ü úù /÷ö D þ ô ó nõ  ô Zñð ;÷ ö