Graceful stack switching in dns.lookup. This will fix ENETUNREACH in case you have IPv4 disabled on host, but IPv6 available.
Want to see pretty graphs? Log in now!
npm install dns-graceful-stack-switch
|2||downloads in the last week|
|8||downloads in the last month|
|Last Published By|
|Version||0.0.7 last updated 8 months ago|
|Keywords||dns, IPv6, IPv4, stack, ENETUNREACH|
Monkey patch DNS lookup method for node.js.
If you used node.js with disabled IPv4 - you got exception (ENETUNREACH) in most of network operations, but
ping6 address working fine.
To fix this error with minimal amount of code (you still can use
dns.resolve6 and get valid IPv6 addresses) - monkey patched lookup method was written.
// Mokey patch require('dns-graceful-stack-switch')(6); // Remove mokey patch require('dns-graceful-stack-switch')(null, true);
This module returns
defaultVersion- IP stack version that will be used first to lookup address. If it fails - another will be used. Defaults to
process.env.NODE_DNS_GRACEFUL_STACK_SWITCH_DEFAULTand after that to
remove- remove monkeypatch. Defaults to
After executing dns.lookup will be loaded with
lookup method will be replaced.
This bug was "patched" in Node.js, but magic option in
net.connect (which gives you ability to write right http.Agent) released only in Node.js 0.11.6.
To run the tests: