var os = require('os'),
    http = require('http');

function getIpsNoLocalhost() {
    var networkInterfaces = os.networkInterfaces();

    var ips = [];

    for ( var i in networkInterfaces) {
        var iface = networkInterfaces[i];
        if (i === 'lo')
            continue;
        ips.push(iface[0].address);
    }

    return ips;
}

function getVerifiedIp(ips, port, fn) {
    function verify(e, ip) {
        if (e) {
            if (ips.length) {
                verifyIp(ips.pop(), port, verify);
            }
        } else {
            fn(null, ip);
            fn = null;
        }

        if (fn) {
            fn('Valid ip not found');
        }

    }

    verifyIp(ips.pop(), port, verify);
}

function verifyIp(ip, port, fn) {
    http.get('http://' + ip + ':' + port + '/ping', function(res) {
        if (res.statusCode === 200) {
            fn(null, ip);
        } else {
            fn(res);
        }
    }).on('error', fn);
}

function getIp(port, fn) {
    var ips = getIpsNoLocalhost();
    getVerifiedIp(ips, port, fn);
}

module.exports = getIp;
@@ -254,16 +254,18 @@
 == 'lo')
+ %7B
 %0A       
@@ -279,16 +279,26 @@
 ntinue;%0A
+        %7D%0A
         
@@ -347,24 +347,265 @@
 urn ips;%0A%7D%0A%0A
+function verifyIp(ip, port, fn) %7B%0A    http.get('http://' + ip + ':' + port + '/ping', function(res) %7B%0A        if (res.statusCode === 200) %7B%0A            fn(null, ip);%0A        %7D else %7B%0A            fn(res);%0A        %7D%0A    %7D).on('error', fn);%0A%7D%0A%0A
 function get
@@ -970,249 +970,8 @@
 %0A%7D%0A%0A
-function verifyIp(ip, port, fn) %7B%0A    http.get('http://' + ip + ':' + port + '/ping', function(res) %7B%0A        if (res.statusCode === 200) %7B%0A            fn(null, ip);%0A        %7D else %7B%0A            fn(res);%0A        %7D%0A    %7D).on('error', fn);%0A%7D%0A%0A
 func

Make hint happy :)