Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

network

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

network - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

README.md

29

lib/index.js

@@ -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",

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);
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc