npm

Need private packages and team management tools?Check out npm Orgs. »

dohdec

2.0.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]
  --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

install

npm i dohdec

Downloadsweekly downloads

6

version

2.0.0

license

MPL-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability