Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

dnscrypt - authenticated and encrypted dns client for nodejs

Topics

Resources

License

Stars

Watchers

Forks