This repository has been archived by the owner. It is now read-only.

Replace c-ares DNS with pure javascript implementation #3018

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
3 participants

This replaces the wrapping of c-ares provided from libuv with a pure javascript implementation of a resolver stack.

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 unrefd 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 each prefixed with dns_
    • This is related to js2c not handling sub folders
  • Uses an embedded version of ipaddr.js to handle ipv6 parsing
/*
Copyright 2011 Timothy J Fontaine <tjfontaine@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

*/

Need to use the original license:

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// 'Software'), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
Member

bnoordhuis commented Dec 28, 2012

I still would like to see this land some day, there's really no reason to use c-ares here. :-/

I was just going to close this today, as I've started to expand native-dns beyond the scope of what would make sense to have in core. c-ares is indeed good enough for most people.

@tjfontaine tjfontaine closed this Dec 28, 2012

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.