0.1.0 • Published 4 years ago

dns4 v0.1.0

Weekly downloads
1
License
BSD-3-Clause
Repository
github
Last release
4 years ago

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
0.1.0

4 years ago