Return 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
(
q: dns.message.Message,
where: str,
timeout: float | None = None,
port: int = 853,
source: str | None = None,
source_port: int = 0,
one_rr_per_rrset: bool = False,
ignore_trailing: bool = False,
connection: dns.quic.AsyncQuicConnection | None = None,
verify: bool | str = True,
backend: dns.asyncbackend.Backend | None = None,
hostname: str | None = None,
server_hostname: str | None = None,
)
| 768 | |
| 769 | |
| 770 | async def quic( |
| 771 | q: dns.message.Message, |
| 772 | where: str, |
| 773 | timeout: float | None = None, |
| 774 | port: int = 853, |
| 775 | source: str | None = None, |
| 776 | source_port: int = 0, |
| 777 | one_rr_per_rrset: bool = False, |
| 778 | ignore_trailing: bool = False, |
| 779 | connection: dns.quic.AsyncQuicConnection | None = None, |
| 780 | verify: bool | str = True, |
| 781 | backend: dns.asyncbackend.Backend | None = None, |
| 782 | hostname: str | None = None, |
| 783 | server_hostname: str | None = None, |
| 784 | ) -> dns.message.Message: |
| 785 | """Return the response obtained after sending an asynchronous query via |
| 786 | DNS-over-QUIC. |
| 787 | |
| 788 | *backend*, a ``dns.asyncbackend.Backend``, or ``None``. If ``None``, |
| 789 | the default, then dnspython will use the default backend. |
| 790 | |
| 791 | See :py:func:`dns.query.quic()` for the documentation of the other |
| 792 | parameters, exceptions, and return type of this method. |
| 793 | """ |
| 794 | |
| 795 | if not dns.quic.have_quic: |
| 796 | raise NoDOQ("DNS-over-QUIC is not available.") # pragma: no cover |
| 797 | |
| 798 | if server_hostname is not None and hostname is None: |
| 799 | hostname = server_hostname |
| 800 | |
| 801 | q.id = 0 |
| 802 | wire = q.to_wire() |
| 803 | the_connection: dns.quic.AsyncQuicConnection |
| 804 | if connection: |
| 805 | cfactory = dns.quic.null_factory |
| 806 | mfactory = dns.quic.null_factory |
| 807 | the_connection = connection |
| 808 | else: |
| 809 | (cfactory, mfactory) = dns.quic.factories_for_backend(backend) |
| 810 | |
| 811 | async with cfactory() as context: |
| 812 | async with mfactory( |
| 813 | context, |
| 814 | verify_mode=verify, |
| 815 | server_name=server_hostname, |
| 816 | ) as the_manager: |
| 817 | if not connection: |
| 818 | the_connection = the_manager.connect( # pyright: ignore |
| 819 | where, port, source, source_port |
| 820 | ) |
| 821 | (start, expiration) = _compute_times(timeout) |
| 822 | stream = await the_connection.make_stream(timeout) # pyright: ignore |
| 823 | async with stream: |
| 824 | await stream.send(wire, True) |
| 825 | wire = await stream.receive(_remaining(expiration)) |
| 826 | finish = time.time() |
| 827 | r = dns.message.from_wire( |
nothing calls this directly
no test coverage detected
searching dependent graphs…