Network Utilies for Node.js
Install
$ npm install network
Usage
Get public IP
Returns your public IP address, as reported by DynDNS.org.
var network = require('network');
network.get_public_ip(function(err, ip) {
console.log(err || ip);
})
Get private IP
Returns the IP address assigned to your first active network inteface.
network.get_private_ip(function(err, ip) {
console.log(err || ip);
})
Get gateway IP
Returns the IP address assigned to your first active network inteface.
network.get_gateway_ip(function(err, ip) {
console.log(err || ip);
})
Get active interface
Returns the IP address, MAC address and gateway IP address for the active
network interface.
network.get_active_interface(function(err, obj) {
})
Get interfaces list
Returns list of network interfaces, including MAC addresses and the such, just
as in the example above.
network.get_interfaces_list(function(err, list) {
})
Copyright
Written by Tomás Pollak. Copyright (c) 2014 Fork, Ltd.
License
MIT.