@stableness/dohdec

103.1.0 • Public • Published

dohdec

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

Install

npm i -S dohdec

Command Line Usage

dohdec [name] [rrtype]

Look up DNS name using DNS-over-HTTPS (DoH)

Positionals:
  name    The name to look up.  If not specified, use a readline loop to look up
          multiple names.                                               [string]
  rrtype  Resource Record type to look up                [string] [default: "A"]

Options:
  --version        Show version number                                 [boolean]
  --dns, -d        Use DNS format instead of JSON                      [boolean]
  --ecs, -e        Use this many bits for EDNS Client Subnet (ECS)      [number]
  --full, -f       Full response, not just answers                     [boolean]
  --get, -g        Force http GET for DNS-format lookups               [boolean]
  --no-decode, -n  Do not decode JSON or DNS wire format               [boolean]
  --dnssec, -s     Request DNSsec records                              [boolean]
  --url, -u        The URL of the DoH service
                      [string] [default: "https://cloudflare-dns.com/dns-query"]
  --tls, -t        Use DNS-over-TLS instead of DNS-over-HTTPS          [boolean]
  --tlsServer, -i  Connect to this DNS-over-TLS server      [default: "1.1.1.1"]
  --tlsPort, -p    Connect to this TCP port for DNS-over-TLS      [default: 853]
  --verbose, -v    Print debug info                                    [boolean]
  -h, --help       Show help                                           [boolean]

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

License

MPL-2.0

Build Status Coverage Status

Package Sidebar

Install

npm i @stableness/dohdec

Weekly Downloads

57

Version

103.1.0

License

MPL-2.0

Unpacked Size

28.5 kB

Total Files

9

Last publish

Collaborators

  • imcotton