get-real-ip
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

get real ip

get a real public ip on broswer.

Getting started

npm install get-real-ip
yarn add get-real-ip
pnpm add get-real-ip

Usage

import getRealIp from "get-real-ip";
getRealIp().then((ip) => {
  console.log("ip: ", ip);
})(
  // or with async/await
  async () => {
    const ip = await getRealIp();
    console.log("ip: ", ip);
  }
)();

Use custom iceServers

import getRealIp from "get-real-ip";
const iceServers = [
  {
    urls: ["stun:stun.l.google.com:19302"],
  },
];
getRealIp(iceServers).then((ip) => {
  console.log("ip: ", ip);
})(
  // or with async/await

  async () => {
    const ip = await getRealIp(iceServers);
    console.log("ip: ", ip);
  }
)();

Package Sidebar

Install

npm i get-real-ip

Weekly Downloads

4

Version

1.0.6

License

MIT

Unpacked Size

2.45 kB

Total Files

4

Last publish

Collaborators

  • chenym1992