alrico88 / aipi

Get IP info via an echoip instance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aipi

Get IP information from any echoip instance

Installation

Using npm npm i aipi

Using yarn yarn add aipi

Usage

In CommonJS env

const { IPInfoFetcher } = require('aipi');

Using imports

import { IPInfoFetcher } from 'aipi';

Then

const ipInfoFetcher = new IPInfoFetcher('https://MY_EXAMPLE_ECHOIP_INSTANCE/json'); // If not provided, it uses ifconfig.co by default

const myIpInfo = await ipInfoFetcher.getInfo(); // myIpInfo is the current IP's info

const customIpInfo = await ipInfoFetcher.getInfo('9.9.9.9'); // customIpInfo is '9.9.9.9' info

Similar geo data to geoip-lite can be obtained via the getGeo method.

Documentation

See DOCS

About

Get IP info via an echoip instance

License:MIT License


Languages

Language:TypeScript 100.0%