__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
"""curio async I/O library query support"""
import socket
import curio
import curio.socket # type: ignore
import dns._asyncbackend
import dns.exception
import dns.inet
def _maybe_timeout(timeout):
if timeout:
return curio.ignore_after(timeout)
else:
return dns._asyncbackend.NullContext()
# for brevity
_lltuple = dns.inet.low_level_address_tuple
# pylint: disable=redefined-outer-name
class DatagramSocket(dns._asyncbackend.DatagramSocket):
def __init__(self, socket):
super().__init__(socket.family)
self.socket = socket
async def sendto(self, what, destination, timeout):
async with _maybe_timeout(timeout):
return await self.socket.sendto(what, destination)
raise dns.exception.Timeout(
timeout=timeout
) # pragma: no cover lgtm[py/unreachable-statement]
async def recvfrom(self, size, timeout):
async with _maybe_timeout(timeout):
return await self.socket.recvfrom(size)
raise dns.exception.Timeout(timeout=timeout) # lgtm[py/unreachable-statement]
async def close(self):
await self.socket.close()
async def getpeername(self):
return self.socket.getpeername()
async def getsockname(self):
return self.socket.getsockname()
class StreamSocket(dns._asyncbackend.StreamSocket):
def __init__(self, socket):
self.socket = socket
self.family = socket.family
async def sendall(self, what, timeout):
async with _maybe_timeout(timeout):
return await self.socket.sendall(what)
raise dns.exception.Timeout(timeout=timeout) # lgtm[py/unreachable-statement]
async def recv(self, size, timeout):
async with _maybe_timeout(timeout):
return await self.socket.recv(size)
raise dns.exception.Timeout(timeout=timeout) # lgtm[py/unreachable-statement]
async def close(self):
await self.socket.close()
async def getpeername(self):
return self.socket.getpeername()
async def getsockname(self):
return self.socket.getsockname()
class Backend(dns._asyncbackend.Backend):
def name(self):
return "curio"
async def make_socket(
self,
af,
socktype,
proto=0,
source=None,
destination=None,
timeout=None,
ssl_context=None,
server_hostname=None,
):
if socktype == socket.SOCK_DGRAM:
s = curio.socket.socket(af, socktype, proto)
try:
if source:
s.bind(_lltuple(source, af))
except Exception: # pragma: no cover
await s.close()
raise
return DatagramSocket(s)
elif socktype == socket.SOCK_STREAM:
if source:
source_addr = _lltuple(source, af)
else:
source_addr = None
async with _maybe_timeout(timeout):
s = await curio.open_connection(
destination[0],
destination[1],
ssl=ssl_context,
source_addr=source_addr,
server_hostname=server_hostname,
)
return StreamSocket(s)
raise NotImplementedError(
"unsupported socket " + f"type {socktype}"
) # pragma: no cover
async def sleep(self, interval):
await curio.sleep(interval)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| quic | Folder | 0755 |
|
|
| rdtypes | Folder | 0755 |
|
|
| __init__.py | File | 1.61 KB | 0644 |
|
| _asyncbackend.py | File | 1.96 KB | 0644 |
|
| _asyncio_backend.py | File | 5.03 KB | 0644 |
|
| _curio_backend.py | File | 3.48 KB | 0644 |
|
| _immutable_ctx.py | File | 2.4 KB | 0644 |
|
| _trio_backend.py | File | 3.83 KB | 0644 |
|
| asyncbackend.py | File | 2.88 KB | 0644 |
|
| asyncquery.py | File | 24.68 KB | 0644 |
|
| asyncresolver.py | File | 10.24 KB | 0644 |
|
| dnssec.py | File | 42.17 KB | 0644 |
|
| dnssectypes.py | File | 1.76 KB | 0644 |
|
| e164.py | File | 3.88 KB | 0644 |
|
| edns.py | File | 13.69 KB | 0644 |
|
| entropy.py | File | 4.14 KB | 0644 |
|
| enum.py | File | 3.17 KB | 0644 |
|
| exception.py | File | 5.45 KB | 0644 |
|
| flags.py | File | 2.69 KB | 0644 |
|
| grange.py | File | 2.1 KB | 0644 |
|
| immutable.py | File | 1.79 KB | 0644 |
|
| inet.py | File | 4.9 KB | 0644 |
|
| ipv4.py | File | 2.02 KB | 0644 |
|
| ipv6.py | File | 6.05 KB | 0644 |
|
| message.py | File | 60.38 KB | 0644 |
|
| name.py | File | 33.62 KB | 0644 |
|
| namedict.py | File | 3.91 KB | 0644 |
|
| node.py | File | 12.37 KB | 0644 |
|
| opcode.py | File | 2.67 KB | 0644 |
|
| py.typed | File | 0 B | 0644 |
|
| query.py | File | 48.02 KB | 0644 |
|
| rcode.py | File | 4.06 KB | 0644 |
|
| rdata.py | File | 29.07 KB | 0644 |
|
| rdataclass.py | File | 2.91 KB | 0644 |
|
| rdataset.py | File | 16.67 KB | 0644 |
|
| rdatatype.py | File | 7.17 KB | 0644 |
|
| renderer.py | File | 10.42 KB | 0644 |
|
| resolver.py | File | 61.92 KB | 0644 |
|
| reversename.py | File | 3.74 KB | 0644 |
|
| rrset.py | File | 8.97 KB | 0644 |
|
| serial.py | File | 3.52 KB | 0644 |
|
| set.py | File | 8.88 KB | 0644 |
|
| tokenizer.py | File | 23.03 KB | 0644 |
|
| transaction.py | File | 21.12 KB | 0644 |
|
| tsig.py | File | 11.19 KB | 0644 |
|
| tsigkeyring.py | File | 2.58 KB | 0644 |
|
| ttl.py | File | 2.91 KB | 0644 |
|
| update.py | File | 11.96 KB | 0644 |
|
| version.py | File | 1.88 KB | 0644 |
|
| versioned.py | File | 11.5 KB | 0644 |
|
| win32util.py | File | 8.84 KB | 0644 |
|
| wire.py | File | 2.76 KB | 0644 |
|
| xfr.py | File | 12.96 KB | 0644 |
|
| zone.py | File | 49.86 KB | 0644 |
|
| zonefile.py | File | 26.84 KB | 0644 |
|
| zonetypes.py | File | 690 B | 0644 |
|