Skip to content

chenym1992/get-real-ip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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);
  }
)();

Releases

No releases published

Packages

No packages published