Skip to content
DNSCrypt - authenticated and encrypted DNS client for nodejs
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src add initial tests Nov 24, 2019
test add tests to validate certificate Dec 2, 2019
.editorconfig init Nov 16, 2019
.eslintignore init Nov 16, 2019
.gitignore
.prettierrc fix eslint errors? Nov 18, 2019
.travis.yml add initial tests Nov 24, 2019
LICENSE
changelog.md
dnscrypt.png
example.js update example Nov 19, 2019
package-lock.json add initial tests Nov 24, 2019
package.json update coverage config Nov 24, 2019
quad9-resolvers.md init Nov 16, 2019
readme.md add initial tests Nov 24, 2019

readme.md

dnscrypt

stability-unstable Build Status npm node license downloads Coverage Status

dnscrypt logo

DNSCrypt - authenticated and encrypted DNS client for nodejs

Usage

const dnscrypt = require('dnscrypt');

dnscrypt.resolve('example.com', (err, addresses) => {
  if (err) {
    console.error(err);
  } else {
    console.log(addresses);
  }
});

// Supports both callback and promise-based styles.
await dnscrypt.resolve4('example.com');

const resolver = dnscrypt.createResolver({ timeout: 1e3 });

How to

  • Use global api dnscrypt.resolve for single looking up.
  • Use resolver api dnscrypt.createResolver() for multiple lookups (to avoid repeated certificate requests).

API

  • dnscrypt.resolve(hostname[, rrtype], callback): void
  • dnscrypt.resolve(hostname[, rrtype]): Promise

See dns.resolve.

  • dnscrypt.resolve4(hostname[, options], callback): void
  • dnscrypt.resolve4(hostname[, options]): Promise

See dns.resolve4.

  • dnscrypt.resolve6(hostname[, options], callback): void
  • dnscrypt.resolve6(hostname[, options]): Promise

See dns.resolve6.

  • dnscrypt.resolveCname(hostname, callback): void
  • dnscrypt.resolveCname(hostname): Promise

See dns.resolveCname.

  • dnscrypt.resolveMx(hostname, callback): void
  • dnscrypt.resolveMx(hostname): Promise

See dns.resolveMx.

  • dnscrypt.resolveNs(hostname, callback): void
  • dnscrypt.resolveNs(hostname): Promise

See dns.resolveNs.

  • dnscrypt.resolvePtr(hostname, callback): void
  • dnscrypt.resolvePtr(hostname): Promise

See dns.resolvePtr.

  • dnscrypt.resolveSoa(hostname, callback): void
  • dnscrypt.resolveSoa(hostname): Promise

See dns.resolveSoa.

  • dnscrypt.resolveSrv(hostname, callback): void
  • dnscrypt.resolveSrv(hostname): Promise

See dns.resolveSrv.

  • dnscrypt.resolveTxt(hostname, callback): void
  • dnscrypt.resolveTxt(hostname): Promise

See dns.resolveTxt.

  • dnscrypt.getServers(): DNSStamp[]

Returns an array of active DNS servers.

  • dnscrypt.createResolver([options]): Resolver

Create a new independent resolver for DNS requests.

  • options.timeout: number - The number of milliseconds before a request times out, 2s default.
  • options.unref: bool - Call .unref() on internal dgram socket.
  • options.sdns: string - Use secure DNS resolver instead of default one.

The following methods from the dnscrypt module are available:

  • resolver.resolve(hostname[, rrtype], callback): void

  • resolver.resolve(hostname[, rrtype]): Promise

  • resolver.resolve4(hostname[, options], callback): void

  • resolver.resolve4(hostname[, options]): Promise

  • resolver.resolve6(hostname[, options], callback): void

  • resolver.resolve6(hostname[, options]): Promise

  • resolver.resolveCname(hostname, callback): void

  • resolver.resolveCname(hostname): Promise

  • resolver.resolveMx(hostname, callback): void

  • resolver.resolveMx(hostname): Promise

  • resolver.resolveNs(hostname, callback): void

  • resolver.resolveNs(hostname): Promise

  • resolver.resolvePtr(hostname, callback): void

  • resolver.resolvePtr(hostname): Promise

  • resolver.resolveSoa(hostname, callback): void

  • resolver.resolveSoa(hostname): Promise

  • resolver.resolveSrv(hostname, callback): void

  • resolver.resolveSrv(hostname): Promise

  • resolver.resolveTxt(hostname, callback): void

  • resolver.resolveTxt(hostname): Promise

  • resolver.getServers(): DNSStamp[]

  • resolver.setServers(sdns): void

Change the address of internal secure DNS server.

  • resolver.close(): void

Close encrypted DNS session.

License

MIT, 2019 (c) Dmitriy Tsvettsikh

You can’t perform that action at this time.