joyent/node — pull request #3018 by tjfontaine (2012-03-27 20:29:47+00:00)
Title: Replace c-ares DNS with pure javascript implementation

This replaces the wrapping of c-ares provided from libuv with a [pure javascript implementation of a resolver stack](https://github.com/tjfontaine/node-dns).

### Features

* Match existing `dns` module
* Ability to cancel outstanding resolution requests
* Modify the set of resolvers and settings the platform uses, and force a reload of platform settings
* Make a single query against a specific server
* Rudimentary DNS server
* Allowing users to define/extend resource record types

### Missing (but planned)

* Windows name servers are currently hardcoded to Google public DNS servers
* mDNS single shot lookup
* Basically invoked when the question name ends with `.local` which can be appended to the search path
* Caching layer

### Caveats

* Sockets used for resolution are closed after 300 milliseconds of inactivity
* Thus sockets aren't recreated for every request, but not holding the loop active
* After the new refcounting lands this won't be necessary and the sockets will be `unref`d instead
* `nsswitch.conf` is currently not parsed, but `.lookup` and `.reverse` will check `files` before performing a DNS request
* Inconsistent style
* Much of it passes the linting, but there are other style concerns especially with regard to variable and method naming
* Multiple files included from the source module [native-dns](https://github.com/tjfontaine/node-dns) each prefixed with `dns_`
* This is related to js2c not handling sub folders
* Uses an embedded version of ipaddr.js to handle ipv6 parsing