Get public network ip under browser and node.js.
npm i qiao-get-ip
// commonjs
const { getIP } = require('qiao-get-ip');
// es6
import { getIP } from 'qiao-get-ip';
get public network ip
- timeout
- type: number
- desc: timeout, ms, default: 300ms
- debug
- type: boolean
- desc: whether to display debug logs, default: false
- return
- type: string
- desc: ip
// ip
const ip = await getIP(timeout);
// ip debug
const ip = await getIP(timeout, true);
Request the following websites and return the fastest response. The default timeout is 200ms