JSPM

@stableness/dohdec

103.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q57004F
  • License MPL-2.0

DNS over HTTPS and DNS over TLS

Package Exports

  • @stableness/dohdec

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stableness/dohdec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

This is forked version from https://github.com/hildjj/dohdec

By mostly removing CLI related code & dependencies for programming using only.
All credit to the original author.




Below is original README:

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]
  --subnet, -b     Use this IP address for EDNS Client Subnet (ECS)     [string]
  --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

Tests codecov