internal-ip
Get your internal IP address
Last updated 4 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install internal-ip 
SYNC missed versions from official npm registry.

internal-ip Build Status

Get your internal IP address

Install

$ npm install internal-ip

Usage

const internalIp = require('internal-ip');

(async () => {
	console.log(await internalIp.v6());
	//=> 'fe80::1'

	console.log(await internalIp.v4());
	//=> '10.0.0.79'
})();

console.log(internalIp.v6.sync())
//=> 'fe80::1'

console.log(internalIp.v4.sync())
//=> '10.0.0.79'

The module returns the address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, undefined will be returned.

The module relies on operating systems tools. On Linux and Android, the ip command must be available, which depending on distribution might not be installed by default. It is usually provided by the iproute2 package.

Related


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Current Tags

  • 6.0.0                                ...           latest (4 months ago)

16 Versions

  • 6.0.0                                ...           4 months ago
  • 5.0.0                                ...           9 months ago
  • 4.3.0                                ...           a year ago
  • 4.2.0                                ...           a year ago
  • 4.1.0                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.3                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
Downloads
Today 11,837
This Week 11,837
This Month 269,018
Last Day 8,832
Last Week 159,775
Last Month 640,944
Dependencies (2)
Dev Dependencies (3)
Dependents (272)

Copyright 2014 - 2016 © taobao.org |