Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 745 Bytes

README.md

File metadata and controls

26 lines (16 loc) · 745 Bytes

dns4 - Node.js module to force IPv4 only lookup

Ubuntu 14.04(Trusty) uses glibc-2.19, which can't reliably resolve IP address under some circumstances.

Unluckily Node.js doesn't have an option like Java system property java.net.preferIPv4Stack=true, it resolves both IPv4 and IPv6 addresses by default, so here is this tiny magical module.

WARNING: you'd better upgrade your host OS or Docker base image, usage of this hack is not recommended.

Usage

Just include it in your package.json:

npm install --save dns4

And import it at the very beginning of your program:

require('dns4')   // hijack functions of module dns

// require() other modules