Comparing version 0.0.5 to 0.0.6
@@ -10,6 +10,7 @@ "use strict"; | ||
var ip_address_regex = /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/; | ||
// var ip_regex = /((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})/; | ||
var ip_regex = /(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)/; | ||
var is_ip_address = function(str) { | ||
return ip_address_regex.test(str); | ||
return ip_regex.test(str); | ||
}; | ||
@@ -35,7 +36,8 @@ | ||
var regex = /(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)/, | ||
urls = ['checkip.dyndns.org', | ||
'http://wtfismyip.com/text', | ||
'http://ipecho.net/plain', | ||
'http://ifconfig.me/ip']; | ||
var urls = [ | ||
'checkip.dyndns.org', | ||
'http://wtfismyip.com/text', | ||
'http://ipecho.net/plain', | ||
'http://ifconfig.me/ip' | ||
]; | ||
@@ -48,4 +50,4 @@ var get = function(i) { | ||
var body = resp && resp.body.toString(); | ||
if (body && body.match(regex)) { | ||
return cb(null, body.match(regex)[1]); | ||
if (body && body.match(ip_regex)) { | ||
return cb(null, body.match(ip_regex)[1]); | ||
} | ||
@@ -94,3 +96,2 @@ get(i+1); | ||
}) | ||
}); | ||
@@ -112,6 +113,10 @@ | ||
cb(null, nic); | ||
os_functions.gateway_ip_for(nic_name, function(err, ip) { | ||
if (!err && ip) | ||
nic.gateway_ip = ip.toString().trim(); | ||
cb(null, nic); | ||
}) | ||
}); | ||
}); | ||
}); | ||
@@ -118,0 +123,0 @@ |
{ | ||
"name": "network", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Cross platform network utilities for Node.js (gateway_ip, MAC address, etc)", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
10
test.js
var network = require('./'); | ||
network.get_public_ip(function(err, res) { | ||
console.log('Public IP --- '); | ||
console.log(err || res); | ||
}) | ||
network.get_private_ip(function(err, res) { | ||
@@ -17,1 +22,6 @@ console.log('Private IP --- '); | ||
}) | ||
network.get_network_interfaces_list(function(err, res) { | ||
console.log('Network Interfaces List --- '); | ||
console.log(err || res); | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14293
9
306
2
92