This package has been deprecated

Author message:

This package has moved, please use @cryptoscamdb/graceful-dns instead.

graceful-dns

1.2.0 • Public • Published

graceful-dns

Disclaimer

Are you writing code in dev environments? Check out the experimental DNS Promises API (added in v10.6.0)

Do you want promises to reject instead of returning undefined? Check out dns-then

This project wraps a part of Node.js's dns module in non-rejecting promises (instead of rejecting, it returns undefined. It also parses URLs to hostnames automatically. It's not a 1:1 port.

Usage

npm install graceful-dns

API

  • getServers() - returns an array of IP addresses which are configured for DNS lookups
  • setServers(servers) - configures an array of IP addresses which are configured for DNS lookups
  • getIP(hostname) - returns a promise which will resolve to either undefined or the IP address
  • getDNS(hostname) - returns a promise which will resolve to either undefined or an array of DNS records
  • getNS(hostname) - returns a promise which will resolve to either undefined or an array of nameservers
  • reverseDNS(ip) - returns a promise which will resolve to either undefined or an array of hostnames

Examples

const dns = require('graceful-dns');

(async () => {
    const ip = await dns.getIP('example.com');
    if(ip) {
        console.log("Found IP: " + ip);
    } else {
        console.log("Could not find IP address");
    }
})();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i graceful-dns

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

4.65 kB

Total Files

5

Last publish

Collaborators

  • luit