public-ip - 快速获取你的公网IP地址
public-ip - 快速获取你的公网IP地址
Node.js 命令行应用
共597Star
详细介绍
public-ip
Get your public IP address - very fast!
Queries the DNS records of OpenDNS which has an entry with your IP address.
Install
$ npm install --save public-ip
Usage
const publicIp = require('public-ip');
publicIp.v4().then(ip => {
console.log(ip);
//=> '46.5.21.123'
});
publicIp.v6().then(ip => {
console.log(ip);
//=> 'fe80::200:f8ff:fe21:67cf'
});
API
publicIp.v4()
Returns a Promise for your public IPv4 address.
publicIp.v6()
Returns a Promise for your public IPv6 address.
Related
- public-ip-cli - CLI for this module
- internal-ip - Get your internal IP address
License
MIT © Sindre Sorhus
-
23 Star
-
388 Star
-
6 Star
-
1 Star
-
1 Star
-
0 Star
-
5 Star
-
0 Star