HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/dns/__pycache__/asyncquery.cpython-37.pyc
B

��f�b�@sdZddlmZmZmZmZmZddlZddlZddl	Z	ddl
Z
ddlZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZddlmZmZmZmZmZmZm Z m!Z!m"Z"er�ddl#Z#e
j$j%Z&dd�Z'd5dd	�Z(d6e
j)j*ee
j+j,e-feee.ee/e.fd
�dd�Z0d7e
j)j*eeee.e1e1eee
j2j3e
j4j5fee-e1e1ed�
dd�Z6d8e
j+j,e7ee.e/ee7e/e1e1e1e1ee
j)j*ee
j)j8e
j+j,d�
dd�Z9d9e
j+j,e7ee.e/ee7e/e1e1e1ee
j)j*ee
j)j:ee
j)j8ee
j+j,e1fd�
dd�Z;d:e
j)j:ee
j+j,e-fee.ee/e.fd�dd�Z<dd�Z=d;e
j)j:ee.e1eee
j2j3e
j4j5fee-e1ee
j+j,e.fd�dd �Z>d<e
j+j,e7ee.e/ee7e/e1e1ee
j)j:ee
j)j8e
j+j,d!�d"d#�Z?d=e
j+j,e7ee.e/ee7e/e1e1ee
j)j:ee
j)j8eej@ee7e
j+j,d%�
d&d'�ZAd>e
j+j,e7ee.e/ee7e/e1e1ed+e7e1ee1e7fe
j+j,d,�
d-d.�ZBddddddejCdfe7e
jDjEee
j+j,e/ee.ee.ee7e/eee
j)j8dd/�d0d1�ZFd?e
j+j,e7ee.e/ee7e/e1e1ee
jGjHee1e7fee
j)j8e
j+j,d2�d3d4�ZGdS)@zTalk to a DNS server.�)�Any�Dict�Optional�Tuple�UnionN)�NullContext)	�_compute_times�_matches_destination�BadResponse�ssl�UDPMode�_have_httpx�_have_http2�NoDOH�NoDOQcCsN|s|rF|dkr>|tjkr d}n|tjkr0d}ntd|����||fSdSdS)Nz0.0.0.0z::zunknown address family )�socket�AF_INET�AF_INET6�NotImplementedError)�af�address�port�r�?/opt/alt/python37/lib/python3.7/site-packages/dns/asyncquery.py�
_source_tuple;s

rcCs&|r|st��}t||d�SdSdS)Nr)�time�max)�
expiration�nowrrr�_timeoutKs
r)�sock�what�destinationr�returnc�s@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_udpTs
r,F�)
r r"r�ignore_unexpected�one_rr_per_rrset�keyring�request_mac�ignore_trailing�raise_on_truncationr#c	
�s`d}	x0|�dt|��IdH\}	}
t|j|
||�rPqWt��}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-i��N)r0r1r/r2r3)�recvfromrr	�familyrr%r&�	from_wire)
r r"rr.r/r0r1r2r3�wire�from_address�
received_time�rrrr�receive_udprsr;�5)
�q�where�timeoutr�source�source_portr.r/r2r3r �backendr#c�s�|��}t|�\}
}tj�|�}t||f|�}|
r<t|
�}nJ|sJtj��}t	|||�}|�
�rh||f}nd}|�|tj
d||�IdH}|4IdH�Z}t||||�IdHt||||||j|j||	�	IdH\}}}||
|_|�|�s�t�|SQIdHRXdS)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(rr%�inet�af_for_address�_lltupler�asyncbackend�get_default_backendrZdatagram_connection_required�make_socketr�
SOCK_DGRAMr,r;r0�macr�is_responser
)r=r>r?rr@rAr.r/r2r3r rBr7�
begin_timerrr"�cm�stuple�dtuple�sr:r9�_rrr�udp�s:




rR)
r=r>r?rr@rAr.r/r2�udp_sock�tcp_sockrBr#c
�sny,t|||||||||d|	|�IdH}|dfStjjk
rht|||||||||
|�
IdH}|dfSXdS)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)rRr%r&Z	Truncated�tcp)
r=r>r?rr@rAr.r/r2rSrTrB�responserrr�udp_with_fallback�s8"rW)r r!rr#c�s`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.
    z!HN)r$r%r&r'r(�len�struct�packr�sendallr)r r!rr7�l�tcpmsgr*rrr�send_tcps

r^c�sLd}xB|dkrF|�|t|��IdH}|dkr0t�|t|�}||}qW|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�EOFErrorrX)r �countrrPr+rrr�
_read_exactly5s
rb)r rr/r0r1r2r#c�sXt|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.
    �Nz!H)r0r1r/r2)rbrY�unpackrr%r&r6)r rr/r0r1r2�ldatar\r7r9r:rrr�receive_tcpCsrf)r=r>r?rr@rAr/r2r rBr#c

�s�|��}
t|�\}}|r0|��IdHt|�}
nJtj�|�}t|||�}||f}|	s^tj�	�}	|	�
|tjd|||�IdH}
|
4IdH�P}t
||
|�IdHt||||j|j|�IdH\}}|||_|�|�s�t�|SQIdHRXdS)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%rCrDrrFrGrHr�SOCK_STREAMr^rfr0rJrrKr
)r=r>r?rr@rAr/r2r rBr7rLrrMrrNrOrPr:r9rrrrUas(



rU�U)
r=r>r?rr@rAr/r2r rB�ssl_context�server_hostnamer#c�s�t|�\}}
|rt|�}n�|
dkrDt��}
tjj|
_|dkrLd|
_nd}
d}tj	�
|�}t|||�}||f}|	sztj�
�}	|	�|tjd||||
|�IdH}|4IdH�@}t|
�}t||||||||||	�
IdH}t��}|||_|SQIdHRXdS)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)rrr�create_default_context�
TLSVersion�TLSv1_2�minimum_version�check_hostnamer%rCrDrrFrGrHrrhrrUr)r=r>r?rr@rAr/r2r rBrjrkrLrrMrrNrOrPrVZend_timerrr�tls�sP



rq��
/dns-queryTzhttpx.AsyncClient)
r=r>r?rr@rAr/r2�client�path�post�verifyr#c
�s�tstd��|��}ytj�|�}
Wntk
r<d}
YnXd}ddi}|
dk	r�|
tjkrld�	|||	�}q�|
tj
kr�d�	|||	�}n|}|dk	r�tj|dd�}|r�t
|�}ntjd	t||d
�}|4IdH�r}|
�r|�dtt|��d��|j||||d�IdH}n4t�|��d
�}|��}|j|||d|id�IdH}WdQIdHRX|jdk�sd|jdk�rztd�	||j|j���tjj|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.
    zhttpx is not available.N�acceptzapplication/dns-messagezhttps://{}:{}{}zhttps://[{}]:{}{}r)Z
local_addressT)Zhttp1Zhttp2rw�	transport)zcontent-typezcontent-length)�headers�contentr?�=r%)rzr?�params��i+z4{} responded with status code {}
Response body: {!r})r0r1r/r2)$r
rr(r%rCrD�
ValueErrorrr�formatr�httpxZAsyncHTTPTransportrZAsyncClientr�update�strrXrv�base64�urlsafe_b64encode�rstrip�decode�get�status_coder{r&r6r0r1�elapsed�
total_secondsrrKr
)r=r>r?rr@rAr/r2rtrurvrwr7rryrz�urlrMZ
the_clientrVZtwirer:rrr�https�s\



(r�)r>�txn_manager�queryrr?�lifetimer@rA�udp_moderBr#c
#�s�|dkrtj�|�\}}
ntj�|�}
|jdj}|tjjk}|��}
|�	�}tj
�|�}t|||�}||f}t
|�\}}d}�xT|�r�d}|r�|tjkr�tj}d}n
tj}d}|	s�tj��}	|	�||d||t|��IdH}|4IdH���|�r|�||t|��IdHn&t�dt|��|}|�||�IdHtj�|||
|���v}d}d}�xB|�s�t
|�\}}|dk�s�|dk	�r�||k�r�|}|�r�t||f|�}xjt|�}|�d|�IdH\}}t|||d��r�P�q�Wn2t |d|�IdH} t�!d| �\}!t ||!|�IdH}|tjjk}tj"j#||j$|j%d|
|||d�}"y|�&|"�}WnDtjj'k
�r�|�sdt(�|tj)k�rr�d}d}tj}�wTYnX|"j*}�qTW|�s�|j$�r�|"j+�s�tj,�-d	��WdQRXWdQIdHRXq�WdS)
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.
    NrTFz!Hi��rc)r0r1�xfr�origin�tsig_ctxZmultir/zmissing TSIG).r%r�Z
make_queryZextract_serial_from_queryZquestion�rdtypeZ	rdatatypeZIXFRZfrom_wire_originr(rCrDrrr�NEVERrrIrhrFrGrHrr)rYrZrXr[ZInboundrEr4r	rbrdr&r6r0rJZprocess_messageZUseTCP�AssertionErrorZONLYr�Zhad_tsig�	exceptionZ	FormError)#r>r�r�rr?r�r@rAr�rB�serialr�Zis_ixfrr�r7rrNrOrQr�retryZ	sock_typeZis_udprPr]Zinbound�doner�Zmexpirationr"Zrwirer8rer\r:rrr�inbound_xfrDs�






r�)r=r>r?rr@rAr/r2�
connectionrwrBr#c�s>tjjstd��d|_|��}|r8tjj}tjj}
|}ntj�|
�\}}
|�4IdH��}|
||	d�4IdH�x}|s�|�||||�}t	�	�}|�
�IdH}|4IdH�(|�|d�IdH|�|�IdH}WdQIdHRXt	�	�}WdQIdHRXtj
j||j|j||d�}WdQIdHRXt||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_modeT)r0r1r/r2g)r%�quicZ	have_quicr�idr(Znull_factoryZfactories_for_backend�connectrZmake_stream�sendZreceiver&r6r0r1rrKr
)r=r>r?rr@rAr/r2r�rwrBr7ZcfactoryZmfactoryZthe_connection�contextZthe_manager�start�stream�finishr:rrrr��s: r�)N)N)NNFFNr-FF)
Nr<NrFFFFNN)
Nr<NrFFFNNN)N)NFNr-F)Nr<NrFFNN)
NriNrFFNNNN)
NrrNrFFNrsTT)	NriNrFFNTN)I�__doc__�typingrrrrrr��
contextlibrrYrZdns.asyncbackendr%Z
dns.exceptionZdns.inetZdns.nameZdns.messageZdns.quicZ	dns.rcodeZdns.rdataclassZ
dns.rdatatypeZdns.transactionZdns._asyncbackendrZ	dns.queryrr	r
rrr
rrrr�rCZlow_level_address_tuplerErrrFZDatagramSocketr&r'�bytes�float�intr,�bool�name�NameZtsigZKeyr;r�ZBackendrRZStreamSocketrWr^rbrfrU�
SSLContextrqr�r�ZtransactionZTransactionManagerr�r�ZAsyncQuicConnectionrrrr�<module>s�,

8"63>8.20@B2U8]<