Retrieve and decode DNS records using DNS-over-HTTPS (DoH) or DNS-over-TLS (DoT).
npm install --save dohdec
You must now install
dohdec-cli
to use the command line:
npm install -g dohdec-cli
const {DNSoverHTTPS, DNSoverTLS} = require('dohdec');
const doh = new DNSoverHTTPS();
await doh.lookup('ietf.org', 'AAAA'); // JSON result from CloudFlare
await doh.lookup('ietf.org', {
rrtype: 'MX',
json: false, // Use DNS wire format
decode: false, // Do not decode results
dnssec: true, // Request DNS records
});
const dot = new DNSoverTLS({host: '1.1.1.1'});
await dot.lookup('ietf.org');
Full documents here
If you need a more full-featured replacement for [dnsPromises.Resolver]https://nodejs.org/api/dns.html#class-dnspromisesresolver), take a look at the Tangerine project.