Socket
Socket
Sign inDemoInstall

internal-ip

Package Overview
Dependencies
23
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.3.0 to 5.0.0

79

index.d.ts
interface v6 {
/**
* @returns The IPv6 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
*
* @example
*
* console.log(await internalIp.v6());
* //=> 'fe80::1'
*/
(): Promise<string>;
@returns The IPv6 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.
@example
```
import internalIp = require('internal-ip');
console.log(await internalIp.v6());
//=> 'fe80::1'
```
*/
(): Promise<string | undefined>;
/**
* @returns The IPv6 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
*
* @example
*
* console.log(internalIp.v6.sync());
* //=> 'fe80::1'
*/
sync(): string;
@returns The IPv6 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.
@example
```
import internalIp = require('internal-ip');
console.log(internalIp.v6.sync());
//=> 'fe80::1'
```
*/
sync(): string | undefined;
}

@@ -25,20 +31,26 @@

/**
* @returns The IPv4 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
*
* @example
*
* console.log(await internalIp.v4())
* //=> '10.0.0.79'
*/
(): Promise<string>;
@returns The IPv4 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.
@example
```
import internalIp = require('internal-ip');
console.log(await internalIp.v4())
//=> '10.0.0.79'
```
*/
(): Promise<string | undefined>;
/**
* @returns The IPv4 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
*
* @example
*
* console.log(internalIp.v4.sync())
* //=> '10.0.0.79'
*/
sync(): string;
@returns The IPv4 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.
@example
```
import internalIp = require('internal-ip');
console.log(internalIp.v4.sync())
//=> '10.0.0.79'
```
*/
sync(): string | undefined;
}

@@ -49,7 +61,4 @@

v4: v4;
// TODO: Remove this for the next major release
default: typeof internalIp;
};
export = internalIp;

@@ -28,6 +28,7 @@ 'use strict';

function promise(family) {
return defaultGateway[family]().then(result => {
return findIp(result.gateway) || null;
}).catch(() => null);
async function promise(family) {
try {
const result = await defaultGateway[family]();
return findIp(result.gateway);
} catch (_) {}
}

@@ -38,6 +39,4 @@

const result = defaultGateway[family].sync();
return findIp(result.gateway) || null;
} catch (error) {
return null;
}
return findIp(result.gateway);
} catch (_) {}
}

@@ -52,3 +51,1 @@

module.exports = internalIp;
// TODO: Remove this for the next major release
module.exports.default = internalIp;
{
"name": "internal-ip",
"version": "4.3.0",
"version": "5.0.0",
"description": "Get your internal IP address",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=6"
"node": ">=8"
},

@@ -36,10 +36,10 @@ "scripts": {

"dependencies": {
"default-gateway": "^4.2.0",
"ipaddr.js": "^1.9.0"
"default-gateway": "^5.0.4",
"ipaddr.js": "^1.9.1"
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
}
}

@@ -33,3 +33,3 @@ # internal-ip [![Build Status](https://travis-ci.org/sindresorhus/internal-ip.svg?branch=master)](https://travis-ci.org/sindresorhus/internal-ip)

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, `null` will be returned.
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.

@@ -46,4 +46,12 @@ 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.

## License
---
MIT © [Sindre Sorhus](https://sindresorhus.com)
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-internal-ip?utm_source=npm-internal-ip&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc