dohdec
TypeScript icon, indicating that this package has built-in type declarations

5.0.3 • Public • Published

dohdec

Retrieve and decode DNS records using DNS-over-HTTPS (DoH) or DNS-over-TLS (DoT).

Install

npm install --save dohdec

Command Line Usage

You must now install dohdec-cli to use the command line:

npm install -g dohdec-cli

API Usage

const { DNSoverHTTP, DNSoverTLS } = require('dohdec')

const doh = new DNSoverHTTP()
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

Notes

  • All queries will be padded to the next multiple of 128 bytes (see RFC 8467)
  • The JSON protocols are not standardized. The best we have is Google's documentation, which Cloudlflare seems to have followed.

License

MPL-2.0

Tests codecov

/dohdec/

    Package Sidebar

    Install

    npm i dohdec

    Weekly Downloads

    842

    Version

    5.0.3

    License

    MPL-2.0

    Unpacked Size

    62.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • hildjj