network

WebJar for network

License

License

MIT
Categories

Categories

Net
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

network
Last Version

Last Version

0.4.1
Release Date

Release Date

Type

Type

jar
Description

Description

network
WebJar for network
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/tomas/network

Download network

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/network/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>network</artifactId>
    <version>0.4.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/network/
implementation 'org.webjars.npm:network:0.4.1'
// https://jarcasting.com/artifacts/org.webjars.npm/network/
implementation ("org.webjars.npm:network:0.4.1")
'org.webjars.npm:network:jar:0.4.1'
<dependency org="org.webjars.npm" name="network" rev="0.4.1">
  <artifact name="network" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='network', version='0.4.1')
)
libraryDependencies += "org.webjars.npm" % "network" % "0.4.1"
[org.webjars.npm/network "0.4.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : async jar [1.5.2,2)
org.webjars.npm : commander jar [2.9.0]
org.webjars.npm : needle jar [1.1.2]
org.webjars.npm » wmic jar [0.1.0,0.2)

Project Modules

There are no modules declared in this project.

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.

Versions

Version
0.4.1