Open
Description
Describe the issue
The documentation mentions HostResolverBase
but doesn't describe its interface. Is it possible to provide our own resolver based on this class?
One that uses DoH, as in the example below:
import dns.message
import dns.resolver
import requests
def resolve(qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN, url="https://dns.google/dns-query"):
query = dns.message.make_query(qname, rdtype, rdclass)
query_data = query.to_wire()
headers = {'content-type': 'application/dns-message'}
response = requests.post(url, data=query_data, headers=headers)
response_data = response.content
response = dns.message.from_wire(response_data)
ips = []
if response.answer:
answer = dns.resolver.Answer(qname=qname, rdtype=rdtype, rdclass=rdclass, response=response)
if answer.rrset.rdtype == dns.rdatatype.A:
for record in answer.rrset:
ip = record.to_text()
ips.append(ip)
return ips
I don't use the AWS CRT directly, but by using the Mqtt connection builder with AWS IoT SDK V2.
Links
https://awslabs.github.io/aws-crt-python/api/io.html#awscrt.io.HostResolverBase