0.7.0 • Published 3 months ago

network v0.7.0

Weekly downloads
3,385
License
MIT
Repository
github
Last release
3 months ago

Network Utilies for Node.js

Install

$ npm install network

Usage

Get public IP

Returns your public IP address, as reported by DynDNS.org or other services.

var network = require('network');

network.get_public_ip(function(err, ip) {
  console.log(err || ip); // should return your public IP address
})
CLI
$ network public_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); // err may be 'No active network interface found'.
})
CLI
$ network private_ip

Get gateway IP

Returns the IP of the gateway that your active network interface is linked to.

network.get_gateway_ip(function(err, ip) {
  console.log(err || ip); // err may be 'No active network interface found.'
})
CLI
$ network gateway_ip

Get active interface

Returns the IP, MAC address and interface type for the active network interface. On OS X and Linux you also get the IP of its assigned gateway.

network.get_active_interface(function(err, obj) {

  /* obj should be:

  { name: 'eth0',
    ip_address: '10.0.1.3',
    mac_address: '56:e5:f9:e4:38:1d',
    type: 'Wired',
    netmask: '255.255.255.0',
    gateway_ip: '10.0.1.1' }

  */
})
CLI
$ network active_interface

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) {

  /* list should be:

  [{
    name: 'eth0',
    ip_address: '10.0.1.3',
    mac_address: '56:e5:f9:e4:38:1d',
    type: 'Wired',
    netmask: '255.255.255.0',
    gateway_ip: '10.0.1.1' 
   },
   { ... }, { ... }]

  */
})
CLI
$ network interfaces_list

Copyright

Written by Tomás Pollak. Copyright (c) Fork, Ltd.

License

MIT.

@deadcanaries/kadencepenguins-eggs-devpenguins-toolsblocxus@mernjs/clinode-red-powerbox-dioshared-react-native-types@everything-registry/sub-chunk-2260network2use@aragonite/vbox-runner@arisan/streamer2@codetoz/dns@exponent/network@hollowy/coap-node@hollowy/coap-shepherd@kadenceproject/kadencetimeclockwizardubiaccess-frameworkubiaccess_serverudpp2pthing-it-device-temperature-alertthing-it-device-foscamthing-it-device-node-monitorvibluezweb-server-managerwakeonlan-webwasmicowmmihaa-microservicebus-corewmmihaa-microservicebus-node@lwmqn/shepherd@lwmqn/qnode@mallanic/server-manager@rochismo/net-utils@ramborogers/whereami@pcelvng/net@pointnetwork/kadenceao-networkarputils@ump/network@xyo-network/ip-servicebeame-utilsatomosbeame-sdkcoap-nodecoap-shepherdcodedconsul-adapterdnschanger-clidigiweb-config-clipageinsightpmpproxy-pacget-my-ip-serardicagoogle-home-notifier-offlinegoogle-notifygoldilocksqr-filetransferqrfframer-local-live-previewfribbels-e7-optimizerformide-client-2gauge-clipreygenerator-citrixmdns-swarmnode_dns_changerelectron-reporternode-red-contrib-fake-wemonode-red-contrib-get-mynode-red-contrib-get-my-ipnsheyepiqursvibluezexpresszzonboard-api-discoverylegiondlwm2m-bs-servermac-address-utilsmicroservicebus.nodemonitoring_server_apimqtt-nodemqtt-shepherdnat-traversenatman-apinatman-api-udpdropsocksnetchecknew-rvtshwpagetimelineoref0perfect-bandwidthpckget-system-info-libhomebridge-modern-formshomebridge-modern-forms-fanshawk-webcrawlerh5-testrvtshwinstall-coded-nodejs-offskadence-kimkad-traverse
0.7.0

3 months ago

0.6.1

2 years ago

0.6.0

3 years ago

0.5.0

4 years ago

0.4.1

6 years ago

0.4.0

7 years ago

0.3.2

7 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago