-
-
Save Phinome/0480922a32bc98e956ad3ee063c5e79a to your computer and use it in GitHub Desktop.
Revisions
-
szalishchuk renamed this gist
Feb 17, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
szalishchuk created this gist
Feb 17, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ var // Local ip address that we're trying to calculate address // Provides a few basic operating-system related utility functions (built-in) ,os = require('os') // Network interfaces ,ifaces = os.networkInterfaces(); // Iterate over interfaces ... for (var dev in ifaces) { // ... and find the one that matches the criteria var iface = ifaces[dev].filter(function(details) { return details.family === 'IPv4' && details.internal === false; }); if(iface.length > 0) address = iface[0].address; } // Print the result console.log(address);