dface
get ip address by interface
for when you want to listen on a particular interface but don't know what the ip address is going to be
eg. when spawning multiple ec2 instances from a pre-configured cloned image
npm install dface
var dface = ; // so that you can still pass the usual host config through dface == '0.0.0.0'; == '0.0.0.0'; == '10.0.0.1'; // so that you can specify ip by interface/ip-version/alias-seq == '10.0.0.1'; == '10.0.0.1'; == '1111:a660:201:e6::4a4:a315'; == == ; // default == '55.5.34.99'; // assuming eth0 has a second ip (alias) THROWS Error'no such interface eth66/ipv4';
in case of confusion, see your interfaces
node -e 'console.log(os.networkInterfaces())'