This package has been deprecated

Author message:

Use dns-graceful-stack-switch instead

dns-gracefull-stack-switch

0.0.5 • Public • Published

dns-gracefull-stack-switch

Build Status NPM version

Monkey patch DNS lookup method for node.js.

Why?

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.

How?

// Mokey patch
require('dns-gracefull-stack-switch')(6);
// Remove mokey patch
require('dns-gracefull-stack-switch')(null, true);

This module returns function(defaultVersion, remove).

  • defaultVersion - IP stack version that will be used first to lookup address. If it fails - another will be used. Defaults to 4.
  • remove - remove monkeypatch. Defaults to false.

After executing dns.lookup will be loaded with require and lookup method will be replaced.

Node.JS way

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:

Unix/Macintosh:

make test

Readme

Keywords

none

Package Sidebar

Install

npm i dns-gracefull-stack-switch

Weekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • floatdrop