Skip to content

Instantly share code, notes, and snippets.

@evanlucas
Last active April 26, 2016 14:58
Show Gist options
  • Save evanlucas/e54b62bc3ed4d5707b35f24848a9fb6a to your computer and use it in GitHub Desktop.
Save evanlucas/e54b62bc3ed4d5707b35f24848a9fb6a to your computer and use it in GitHub Desktop.

dns

[Docs]

  • dns.resolve() now supports resolving plain DNS PTR records. Previously, calling dns.resolve(hostname, 'PTR', cb) would call dns.reverse() on the hostname. That is no longer the case. One must now pass the hostname as a reverse IN-ADDR domain.

Before:

dns.resolve('8.8.4.4', 'PTR', (err, result) => {
  if (err) {
    // handle error
  }
  // result => ['google-public-dns-b.google.com']
});

After:

dns.resolve('4.4.8.8-in-addr.arpa', 'PTR', (err, result) => {
  if (err) {
    // handle error
  }
  // result => ['google-public-dns-b.google.com']
});

// one could also simply do
dns.reverse('8.8.4.4', (err, result) => {
  if (err) {
    // handle error
  }
  // result => ['google-public-dns-b.google.com']
});
  • dns.lookupService(host, port, callback) Previously, if port was not a number, a TypeError would be thrown. Now, the port will be coerced to a number. If the port is outside the range of 0-65535, a TypeError will be thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment