fh! dZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z ddl Z ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlmZddlmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#e"rddl$Z$e jJjLZ'dZ(d>dZ) d>de jTjVd e e jXjZe.fd ed e e/d e e0e/ff d Z1 d?de jTjVd e ed e e/de2de2de ee jfjhe jjjlfde e.de2de2de2de e jXjZd efdZ7 d@de jXjZde8de e/de0de e8de0de2de2de2de2de e jTjVde e jTjrde2d e jXjZfd Z: dAde jXjZde8de e/de0de e8de0de2de2de2d!e e jTjVd"e e jTjvde e jTjrde2d e e jXjZe2ffd#Z< d>de jTjvd e e jXjZe.fd e e/d e e0e/ffd$Z=d%Z> dBde jTjvd e e/de2de ee jfjhe jjjlfde e.de2d e e jXjZe/ffd&Z? dCde jXjZde8de e/de0de e8de0de2de2de e jTjvde e jTjrd e jXjZfd'Z@ dDde jXjZde8de e/de0de e8de0de2de2de e jTjvde e jTjrd)e e#jd*e e8d+e e2e8fd e jXjZfd,ZBdd-dddddd.d(d(ddejf de jXjZde8de e/de0de e8de0de2de2d/e d0d1e8d2e2d+e e2e8fd3e e8d4e d5d6e e0d e jXjZf d7ZDddddddejdfde8d8e jjde e jXjZde0de e/d9e e/de e8de0d:ede e jTjrd dfd;ZH dEde jXjZde8de e/de0de e8de0de2de2d NsA)A6+A4, A6Fignore_unexpectedone_rr_per_rrsetkeyring request_macignore_trailingraise_on_truncation ignore_errorsqueryc Kd} |jdt|d{\} } t|j| ||s@t j} t j j| |||||}| r| | j|s|| | fS7u#t j j$r.}| r&| $| j|j sYd}~܂d}~wt$r| rYwxYww)ajRead a DNS message from a UDP socket. *sock*, a ``dns.asyncbackend.DatagramSocket``. See :py:func:`dns.query.receive_udp()` for the documentation of the other parameters, and exceptions. Returns a ``(dns.message.Message, float, tuple)`` tuple of the received message, the received time, and the address where the message arrived from. rN)r4r5r3r6r7) recvfromr#rfamilyrr*r+ from_wire Truncated is_response Exception)r$r&r!r2r3r4r5r6r7r8r9wire from_address received_timeres r receive_udprGqs0 D %)]]5(::N%OO|# KK{4E     %%'!1 /$7 &A. U.u7H7H7K =,//A P{{$$ %))!))+6   sK"C7B4C7%B?C7C49#C"C7!C""C40C72C44C75qwheretimeoutrsource source_portbackendc K|j} t|\}}tjj |}t ||f|}| r t | }no| stjj} t|||}| jr||f}nd}| j|tjd||d{}|4d{}t|| ||d{t||||||j |j"|| | | d{\}}}||z |_| s|j'|st(|cdddd{S777s7D7 #1d{7swYyxYww)aFReturn the response obtained after sending a query via UDP. *sock*, a ``dns.asyncbackend.DatagramSocket``, or ``None``, the socket to use for the query. If ``None``, the default, a socket is created. Note that if a socket is provided, the *source*, *source_port*, and *backend* are ignored. *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, the default, then dnspython will use the default backend. See :py:func:`dns.query.udp()` for the documentation of the other parameters, exceptions, and return type of this method. Nr)r-r r*inetaf_for_address_lltupler asyncbackendget_default_backendrdatagram_connection_required make_socketr SOCK_DGRAMr1rGr4macrr@r )rIrJrKrrLrMr2r3r6r7r$rNr8rB begin_timer!rr&cmstupledtuplesrErD_s rudpr_sw8 99;D-g6Z   'BE4="-K 5@5F&&:: ??? K ##@sB B B BcKd}|dkDrG|j|t|d{}|dk(rt|t|z }||z}|dkDrG|S7*w)z|Read the specified number of bytes from stream. Keep trying until we either get the desired amount, or we hit EOF. rrN)recvr#EOFErrorrj)r$countr!r]r0s r _read_exactlyrsMsc A !)))E8J#78 8 8NA E !) H 9s&AA'AAcKt|d|d{}tjd|\}t|||d{}tj} tj j |||||} | | fS7m7Bw)zRead a DNS message from a TCP socket. *sock*, a ``dns.asyncbackend.StreamSocket``. See :py:func:`dns.query.receive_tcp()` for the documentation of the other parameters, exceptions, and return type of this method. rhN!Hr4r5r3r6)rsstructunpackrr*r+r>) r$r!r3r4r5r6ldatalrBrDrEs r receive_tcpr{[s  a4 4E ==u %DQtQ 3 3DIIKM  )'  A }  5 3s"BB,BBABBc K|j} t|\} } |r$|jd{t|} n|tj j |}t|||}||f}| stjj} | j|tjd|||d{} | 4d{}t|| | d{t|| ||j|j |d{\}}|| z |_|j%|st&|cdddd{S7777n7D7#1d{7swYyxYww)aOReturn the response obtained after sending a query via TCP. *sock*, a ``dns.asyncbacket.StreamSocket``, or ``None``, the socket to use for the query. If ``None``, the default, a socket is created. Note that if a socket is provided *where*, *port*, *source*, *source_port*, and *backend* are ignored. *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, the default, then dnspython will use the default backend. See :py:func:`dns.query.tcp()` for the documentation of the other parameters, exceptions, and return type of this method. Nr)r-r getpeernamerr*rPrQrrSrTrVr SOCK_STREAMrnr{r4rXrr@r )rIrJrKrrLrMr3r6r$rNrBrYr!rZrr[r\r]rErDs rrcrcys_4 99;D-g6Z    5@5FXX $ $U +r6;7&&::E ? E( E  E( EE +E E )E4 E(EE( E( E( EEE(E%E E%!E(T ssl_contextserver_hostnameverifyc ZKt|\} }|r t|}n| t| | } tjj |}t |||}||f}| stjj} | j|tjd|||| | d{}|4d{}t|}t|||||||||| d{}tj}|| z |_|cdddd{S7g7^797 #1d{7swYyxYww)aReturn the response obtained after sending a query via TLS. *sock*, an ``asyncbackend.StreamSocket``, 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 connected SSL stream socket, and *where*, *port*, *source*, *source_port*, *backend*, *ssl_context*, and *server_hostname* are ignored. *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, the default, then dnspython will use the default backend. See :py:func:`dns.query.tls()` for the documentation of the other parameters, exceptions, and return type of this method. Nr)r rrr*rPrQrrSrTrVrr~r#rcr)rIrJrKrrLrMr3r6r$rNrrrrYr!rZrr[r\r]rdend_times rtlsrsE< .g6Z 5@5F  /HK XX $ $U +r6;7&&::jA|j<|jB|jD||}|jFjI|_%|jM|stN|S#t $rd}YwxYw77U77#1d{7swYxYww)aReturn the response obtained after sending a query via DNS-over-HTTPS. *client*, a ``httpx.AsyncClient``. If provided, the client to use for the query. Unlike the other dnspython async functions, a backend cannot be provided in this function because httpx always auto-detects the async backend. See :py:func:`dns.query.https()` for the documentation of the other parameters, exceptions, and return type of this method. z.session parameter must be an httpx.AsyncClientNacceptzapplication/dns-messagezhttps://{}:{}{}zhttps://[{}]:{}{}rT) local_addresshttp1http2r local_portrrr=)rrr transport)z content-typezcontent-length)headerscontent=r*)rparamsi+z4{} responded with status code {} Response body: {!r}rv)(rr r)httpx AsyncClient ValueErrorr-r*rPrQ is_addressrrformatrrSrTget_transport_classrupdatestrrjwait_forrbase64urlsafe_b64encoderstripdecodeget status_coderr+r>r4r5elapsed total_secondsrr@r )rIrJrKrrLrMr3r6rrrrrrr=rBrrrurlrNrrrZ the_clientrdtwirerEs rhttpsrs:   j):):;IJJ 99;D XX $ $U +I23G ~#((--e4  #**5$=C 6?? "%,,UD$?C224G ~    -++-#+ I5@5H   d6Y Z  NN$=&)#d)n  %--WdCWH++D188>DKKME$--sGUENKWH!,c!X%9%9C%? $$*Fx++X-=-=%   MM)'  A   + + -AF ==  H[  L !sALK%&C+LK7LAL%K:&A"LK= L LK?C L% K40L3K44L:L=L?LLL LL txn_managerlifetimeudp_modec K|#tjj|\}} ntjj|} |jdj } | tj jk(} |j} |j}tjj|}t|||}||f}t|\}}d}|rd}| r&|tjk7rt j"}d}nt j$}d}| stj&j)} | j+||d||t-|d{}|4d{|r%|j/||t-|d{nr4rXprocess_messageUseTCPONLYrhad_tsig exception FormError)#rJrr9rrKrrLrMrrNserialris_ixfrrrBrr[r\r^r!retry sock_typeis_udpr]rminbounddoner mexpirationr&rwirerCryrzrEs# r inbound_xfrrls* }'',,[92259 ^^A  % %F ***G  ) ) +F ==?D   'B 2v{ 3FT]F$X.OQ E  x7==0))IF**IF&&::$Q "*".;3K&0 &.t}b&A "&.{&;G:;**UG:T4T1UL3 "L+t !& #'4Aq+&F F%}}T59&3Aq+&F F$ (:(::G -- % $)II %!)#)z)0. A !&66q9 !zzHQRqzz--11.AA[- B 3 B3 B  3 BB45U !G F77>>!% v#w||3!# $#*== !G- B- B 3 B3 B3 B3 BsEO8M1 O8)M4*O8-"O#M7r4r5r r@r )rIrJrKrrLrMr3r6rrrNrrBcfactorymfactorythe_connectioncontext the_managerstartr!streamfinishrEs rrrs0 88  566 AD 99;D88((88((#"xx==gF8z  W _ ! ! !,!4!4UD&+!V"0"9 UJ)55g>>F D Dkk$---#^^Jz,BCC D DYY[F ! ! KK ! ! II -+ "   &% %AF ==  H-  ! ? D-C D D D D ! ! ! !    sB#H>%G+&H>)H)9G.:H)=9H6G17 HG3 HG;G5 !G;=G7 >G; H G9H& H)1H29H':2H>.H)1H3H5G;7G;9H;H HH HH)H$ HH$ H)'H>)H;/H2 0H;7H>)N) NNFFNrFFFN) NrHNrFFFFNNF) NrHNrFFFNNNF)NFNrF)NrHNrFFNN) NUNrFFNNNNT) NrNrFFNTNN)K__doc__r contextlibrrwrtypingrrrrrdns.asyncbackendr* dns.exceptiondns.inet dns.messagedns.namedns.quic dns.rcodedns.rdataclass dns.rdatatypedns.transactiondns._asyncbackendr dns.queryr r r r r rrrrrrrPlow_level_address_tuplerRrr#rSDatagramSocketr+r,bytesfloatintr1boolnameNametsigKeyrGrBackendr_ StreamSocketrernrsr{rc SSLContextr AF_UNSPECrr transactionTransactionManagerrrAsyncQuicConnectionrrrs $  44)     88 + +  #'    ) )  ##U* +   3: @"&"&#";?#&! %+/:0   ) ):0#:0:0 :0  :0 d388==#((,,67 8 :0%:0:0:0:0 CKK'' (:0 :0@ $ #"! %6:26? {{? ?e_?  ? SM ?  ????? 3##22 3?c&&.. /?? [[?J $ #"!:>8<26A  {{A A e_A   A SM A  A A A A s''667A s''445A c&&.. /A A  3;;   $%A N#'$   ' '$  ##U* +$$ 3: $2  #'";?#&!    ' 'd388==#((,,67 8  %    3;;   %&B $ "!48265 {{5 5e_5  5 SM 5  555 3##00 15c&&.. /5 [[5v $ "!4826,0%)#C {{C Ce_C  C SM C  CCC 3##00 1Cc&&.. /C#..)Cc]C $) C [[CR $ "!,0#'+7;",,r  {{r r e_r   r SM r  r r r  ( )r  r  r  $) r  }r 34r  SMr  [[!r p,0# $  26bB bB33bB CKK'' (bB  bB e_ bB uo bB SMbBbBbBc&&.. /bB bBP $ "!9=#26%);  {{; ; e_;   ; SM ;  ; ; ; 556;  $) ; c&&.. /; c];  [[; r