tjfontaine / node-dns

Replacement dns module in pure javascript for node.js
MIT License
584 stars 153 forks source link

Does not handle default ipv6 localhost entries on OS X #32

Closed e110c0 closed 11 years ago

e110c0 commented 11 years ago

on Macs there generally is a special entry in /etc/hosts:

fe80::1%lo0 localhost

while trying something like this:

dns.resolve4('www.google.com', function (err, addresses) {
  if (err) throw err;

  console.log('addresses: ' + JSON.stringify(addresses));

});

it throws: ipaddr.js:374 throw new Error('ipaddr: the address has neither IPv6 nor IPv4 format');

The problem can be avoided by removing that entry from /etc/hosts, but might occur in other scenarios as well. Not sure how to handle this strange entry appropriately.

tjfontaine commented 11 years ago

for now I'm guarding against the interface portion of this, but I think perhaps I should send the issue upstream to ipaddr.js