HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/dns/__pycache__/asyncquery.cpython-310.pyc
o

!we�e�!@s�dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZddlmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#e"rpddl$Z$e
j%j&Z'dd�Z(dMdd	�Z)	dMd
e
j*j+dee
j,j-e.fded
e	e/de
e0e/ff
dd�Z1								dNd
e
j*j+de	ed
e	e/de2de2de	ee
j3j4e
j5j6fde	e.de2de2defdd�Z7										dOde
j,j-de8de	e/de0d e	e8d!e0de2de2de2de2d
e	e
j*j+d"e	e
j*j9de
j,j-fd#d$�Z:										dPde
j,j-de8de	e/de0d e	e8d!e0de2de2de2d%e	e
j*j+d&e	e
j*j;d"e	e
j*j9de
e
j,j-e2ffd'd(�Z<	dMd
e
j*j;dee
j,j-e.fd
e	e/de
e0e/ffd)d*�Z=d+d,�Z>					dQd
e
j*j;d
e	e/de2de	ee
j3j4e
j5j6fde	e.de2de
e
j,j-e/ffd-d.�Z?								dRde
j,j-de8de	e/de0d e	e8d!e0de2de2d
e	e
j*j;d"e	e
j*j9de
j,j-fd/d0�Z@		1								dSde
j,j-de8de	e/de0d e	e8d!e0de2de2d
e	e
j*j;d"e	e
j*j9d2e	e#jAd3e	e8de
j,j-fd4d5�ZBdd6dddddd7d8d8ddejCf
de
j,j-de8de	e/de0d e	e8d!e0de2de2d9e	d:d;e8d<e2d=ee2e8fd>e	e8d?e	d@dAe	e0de
j,j-f dBdC�ZDddddddejEdfde8dDe
jFjGdEe	e
j,j-de0de	e/dFe	e/d e	e8d!e0dGed"e	e
j*j9ddfdHdI�ZH		1						8		dTde
j,j-de8de	e/de0d e	e8d!e0de2de2dJe	e
jIjJd=ee2e8fd"e	e
j*j9d3e	e8de
j,j-fdKdL�ZIdS)UzTalk to a DNS server.�N)�Any�Dict�Optional�Tuple�Union)�NullContext)
�BadResponse�NoDOH�NoDOQ�UDPMode�_compute_times�_have_http2�_matches_destination�
_remaining�have_doh�sslcCsV|s|r)|dur%|tjkrd}||fS|tjkrd}||fStd|����||fSdS)Nz0.0.0.0z::zunknown address family )�socket�AF_INET�AF_INET6�NotImplementedError)�af�address�port�r�G/home/arjun/projects/env/lib/python3.10/site-packages/dns/asyncquery.py�
_source_tuple:s

��rcCs&|dur|s
t��}t||d�SdS)Nr)�time�max)�
expiration�nowrrr�_timeoutJs
r �sock�what�destinationr�returnc�sB�t|tjj�r|��}t��}|�||t||��IdH}||fS)a�Send a DNS message to the specified UDP socket.

    *sock*, a ``dns.asyncbackend.DatagramSocket``.

    *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.  The expiration value is meaningless for the asyncio backend, as
    asyncio's transport sendto() never blocks.

    Returns an ``(int, float)`` tuple of bytes sent and the sent time.
    N)�
isinstance�dns�message�Message�to_wirer�sendtor )r!r"r#r�	sent_time�nrrr�send_udpSs�r-F��ignore_unexpected�one_rr_per_rrset�keyring�request_mac�ignore_trailing�raise_on_truncationc	
�s`�d}		|�dt|��IdH\}	}
t|j|
||�rnqt��}tjj|	|||||d�}|||
fS)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.
    r.��N)r1r2r0r3r4)�recvfromr r�familyrr&r'�	from_wire)
r!r#rr/r0r1r2r3r4�wire�from_address�
received_time�rrrr�receive_udpqs&�
���
r>�5�q�where�timeoutr�source�source_port�backendc�s�|��}t|�\}
}tj�|�}t||f|�}|
rt|
�}n%|s&tj��}t	|||�}|�
�r5||f}nd}|�|tj
d||�IdH}|4IdH�7}t||||�IdHt||||||j|j||	�	IdH\}}}||
|_|�|�sut�|Wd�IdHS1IdHs�wYdS)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&�inet�af_for_address�_lltupler�asyncbackend�get_default_backendr�datagram_connection_required�make_socketr�
SOCK_DGRAMr-r>r1�macr�is_responser)r@rArBrrCrDr/r0r3r4r!rEr:�
begin_timerrr#�cm�stuple�dtuple�sr=r<�_rrr�udp�s@�


�

0�rV�udp_sock�tcp_sockc
�sp�zt|||||||||d|	|�IdH}|dfWStjjy7t|||||||||
|�
IdH}|dfYSw)a�Return the response to the query, trying UDP first and falling back
    to TCP if UDP results in a truncated response.

    *udp_sock*, a ``dns.asyncbackend.DatagramSocket``, 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 the *source*,
    *source_port*, and *backend* are ignored for the UDP query.

    *tcp_sock*, a ``dns.asyncbackend.StreamSocket``, or ``None``, the
    socket to use for the TCP query.  If ``None``, the default, a
    socket is created.  Note that if a socket is provided *where*,
    *source*, *source_port*, and *backend*  are ignored for the TCP query.

    *backend*, a ``dns.asyncbackend.Backend``, or ``None``.  If ``None``,
    the default, then dnspython will use the default backend.

    See :py:func:`dns.query.udp_with_fallback()` for the documentation
    of the other parameters, exceptions, and return type of this
    method.
    TNF)rVr&r'�	Truncated�tcp)
r@rArBrrCrDr/r0r3rWrXrE�responserrr�udp_with_fallback�s@�"
�

��r\c�sb�t|tjj�r
|��}n|}t|�}t�d|�|}t��}|�	|t
||��IdHt|�|fS)z�Send a DNS message to the specified TCP socket.

    *sock*, a ``dns.asyncbackend.StreamSocket``.

    See :py:func:`dns.query.send_tcp()` for the documentation of the other
    parameters, exceptions, and return type of this method.
    �!HN)r%r&r'r(r)�len�struct�packr�sendallr )r!r"rr:�l�tcpmsgr+rrr�send_tcps�
rdc�sP�d}|dkr&|�|t|��IdH}|dkrt�|t|�}||}|dks|S)z|Read the specified number of bytes from stream.  Keep trying until we
    either get the desired amount, or we hit EOF.
    r.rN)�recvr �EOFErrorr^)r!�countrrTr,rrr�
_read_exactly4s��rhc�sZ�t|d|�IdH}t�d|�\}t|||�IdH}t��}	tjj|||||d�}
|
|	fS)z�Read 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.
    �Nr]�r1r2r0r3)rhr_�unpackrr&r'r9)r!rr0r1r2r3�ldatarbr:r<r=rrr�receive_tcpBs��rmc
	�s�|��}
t|�\}}|r|��IdHt|�}
n%tj�|�}t|||�}||f}|	s0tj�	�}	|	�
|tjd|||�IdH}
|
4IdH�2}t
||
|�IdHt||||j|j|�IdH\}}|||_|�|�sjt�|Wd�IdHS1IdHs|wYdS)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&rFrGrrIrJrLr�SOCK_STREAMrdrmr1rNrrOr)r@rArBrrCrDr0r3r!rEr:rPrrQrrRrSrTr=r<rrrrZ`s0�


��

0�rZ�U�ssl_context�server_hostnamec�s�t|�\}}
|rt|�}n;|
dur"t��}
tjj|
_|dur"d|
_tj	�
|�}t|||�}||f}|	s9tj�
�}	|	�|tjd||||
|�IdH}|4IdH�*}t|
�}t||||||||||	�
IdH}t��}|||_|Wd�IdHS1IdHswYdS)a�Return 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.
    NFr)rrr�create_default_context�
TLSVersion�TLSv1_2�minimum_version�check_hostnamer&rFrGrrIrJrLrror rZr)r@rArBrrCrDr0r3r!rErqrrrPrrQrrRrSrTr[�end_timerrr�tls�sT�



�

�
0�ryi�z
/dns-queryT�clientzhttpx.AsyncClient�path�post�verify�bootstrap_address�resolverzdns.asyncresolver.Resolverr8c
�s�tst�|rt|tj�std��|��}ztj�	|�}Wnty(d}Ynwd}ddi}|durStj�
|�rS|tjkrFd�
|||	�}n|tjkrRd�
|||	�}n|}tj��}|durcd}d}n|}|}|��|dt||||
|d	�}|r|t|�}n	tjdt||d
�}|4IdH�F}|
r�|�dtt|��d��|�|j|||d�|�IdH}nt�|��d
�}|��}|�|j||d|id�|�IdH}Wd�IdHn1IdHs�wY|jdks�|jdkr�td�
||j|j���tj j!|j|j"|j#||d�}|j$�%�|_&|�'|��s
t(�|S)a�Return 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.AsyncClientN�acceptzapplication/dns-messagezhttps://{}:{}{}zhttps://[{}]:{}{}rT)�
local_address�http1�http2r}�
local_portr~rr8)r�r�r}�	transport)zcontent-typezcontent-length)�headers�content�=r&)r��params��i+z4{} responded with status code {}
Response body: {!r}rj))rr	r%�httpx�AsyncClient�
ValueErrorr)r&rFrG�
is_addressrr�formatrrIrJ�get_transport_classr
r�update�strr^�wait_forr|�base64�urlsafe_b64encode�rstrip�decode�get�status_coder�r'r9r1r2�elapsed�
total_secondsrrOr)r@rArBrrCrDr0r3rzr{r|r}r~rr8r:rr�r��urlrEr�r�rQ�
the_clientr[�twirer=rrr�https�s���

�
�
�
����(�
���r��txn_manager�query�lifetime�udp_modec
#�s��|durtj�|�\}}
ntj�|�}
|jdj}|tjjk}|��}
|�	�}tj
�|�}t|||�}||f}t
|�\}}d}|�rud}|rR|tjkrRtj}d}ntj}d}|	s^tj��}	|	�||d||t|��IdH}|4IdH��|r�|�||t|��IdHnt�dt|��|}|�||�IdHtj�|||
|���}d}d}|�s:t
|�\}}|dus�|dur�||kr�|}|r�t||f|�}	t|�}|�d|�IdH\}}t|||d�r�nq�nt |d|�IdH} t�!d| �\}!t ||!|�IdH}|tjjk}tj"j#||j$|j%d|
|||d�}"z|�&|"�}Wntjj'�y4|�s$J�|tj(k�r+�d}d}tj}Yq�w|"j)}|r�|�sK|j$�rK|"j*�sKtj+�,d	��Wd�n	1�sVwYWd�IdHn1IdH�slwY|sCdSdS)
amConduct an inbound transfer and apply it via a transaction from the
    txn_manager.

    *backend*, a ``dns.asyncbackend.Backend``, or ``None``.  If ``None``,
    the default, then dnspython will use the default backend.

    See :py:func:`dns.query.inbound_xfr()` for the documentation of
    the other parameters, exceptions, and return type of this method.
    NrTFr]r6ri)r1r2�xfr�origin�tsig_ctx�multir0zmissing TSIG)-r&r��
make_query�extract_serial_from_query�question�rdtype�	rdatatype�IXFR�from_wire_originr)rFrGrrr�NEVERrrMrorIrJrLr r*r_r`r^ra�InboundrHr7rrhrkr'r9r1rN�process_message�UseTCP�ONLYr��had_tsig�	exception�	FormError)#rAr�r�rrBr�rCrDr�rE�serialr��is_ixfrr�r:rrRrSrUr�retry�	sock_type�is_udprTrc�inbound�doner��mexpirationr#�rwirer;rlrbr=rrr�inbound_xfrVs��

����

��)� �*��r��
connectionc�s��tjjs	td��d|_|��}|rtjj}
tjj}|}ntj�|
�\}
}|
�4IdH��}|||	|d�4IdH�V}|sC|�||||�}t	|�\}}|�
|�IdH}|4IdH�|�|d�IdH|�t
|��IdH}Wd�IdHn1IdHs{wYt��}Wd�IdHn1IdHs�wYtjj||j|j||d�}Wd�IdHn1IdHs�wYt||d�|_|�|�s�t�|S)aiReturn the response obtained after sending an asynchronous query via
    DNS-over-QUIC.

    *backend*, a ``dns.asyncbackend.Backend``, or ``None``.  If ``None``,
    the default, then dnspython will use the default backend.

    See :py:func:`dns.query.quic()` for the documentation of the other
    parameters, exceptions, and return type of this method.
    zDNS-over-QUIC is not available.rN)�verify_mode�server_nameTrjg)r&�quic�	have_quicr
�idr)�null_factory�factories_for_backend�connectr�make_stream�send�receiverrr'r9r1r2rrOr)r@rArBrrCrDr0r3r�r}rErrr:�cfactory�mfactory�the_connection�context�the_manager�startr�stream�finishr=rrrr��sJ��(�
(��(�
r�)N)NNFFNr.FF)
Nr?NrFFFFNN)
Nr?NrFFFNNN)NFNr.F)Nr?NrFFNN)
NrpNrFFNNNN)
NrpNrFFNTNN)K�__doc__r��
contextlibrr_r�typingrrrrr�dns.asyncbackendr&�
dns.exception�dns.inet�dns.message�dns.name�dns.quic�	dns.rcode�dns.rdataclass�
dns.rdatatype�dns.transaction�dns._asyncbackendr�	dns.queryrr	r
rrr
rrrrr�rF�low_level_address_tuplerHrr rI�DatagramSocketr'r(�bytes�float�intr-�bool�name�Name�tsig�Keyr>r��BackendrV�StreamSocketr\rdrhrmrZ�
SSLContextry�	AF_UNSPECr�r��transaction�TransactionManagerr�r��AsyncQuicConnectionrrrr�<module>s�0


�����

� ���������	�

�,���������	�
�
�
�
�@���������	�

�
�
�
�E����

��������
�!���������
	�

�
�;���������
	�

���
�L���������	�
��
�
���
�x���
������	�

�
�h���������
	�

�
��
�