resolveDoH
resolveDoH resolves domain name by "DNS Queries over HTTPS" (RFC 8484).
Supported record
- A
- AAAA
- CNAME
- MX
- TXT
Usage
You need to prepare DoH server (e.g. Google Public DNS, OpenDNS).
A record
import { resolveDoH } from "https://deno.land/x/resolvedoh/mod.ts";
const DoHServer = new URL("https://dns.google/dns-query");
const records = await resolveDoH(DoHServer, "example.com");
console.log(records.answer); // => [ "93.184.216.34" ]
Another records
import { resolveDoH } from "https://deno.land/x/resolvedoh@0.0.2/mod.ts";
const DoHServer = new URL("https://dns.google/dns-query");
const records = await resolveDoH(DoHServer, "example.com", "AAAA");
console.log(records.answer); // => ["2606:2800:220:1:248:1893:25c8:1946" ]