Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

node-ipdox

mikelcalvo44ISC1.0.4TypeScript support: included

node-ipdox is a Node.js library for GeoIP lookup, leveraging various free GeoIP APIs. It provides a unified response format and incorporates local caching to minimize duplicate requests.

geoip, ip lookup, ipdoxxing, ipdox, ip, ip address, ip address lookup

readme

NPM version

Node.JS IP Doxxer

IPDox is a simple and efficient IP geolocation library for Node.js. It fetches data from multiple geolocation APIs and provides a unified response. It also includes a caching mechanism to prevent unnecessary requests.

Installation

npm install node-ipdox --save

Usage

import { IPDox } from "node-ipdox";

const ipdox = new IPDox({
    cacheMaxItems: 5000,
    cacheMaxAge: 43200000,
    maxRetries: 10
});

ipdox
    .doxIP({ ip: "8.8.8.8" })
    .then(response => console.log(response))
    .catch(error => console.error(error));

API

new IPDox({ cacheMaxItems, cacheMaxAge, maxRetries })

Creates a new instance of IPDox.

  • cacheMaxItems - The maximum number of items to store in the cache (default: 1000)
  • cacheMaxAge - The cache timeout in milliseconds (default: 43200000 (12 hours))
  • maxRetries - Maximum number of retries if an API request fails (default: 10)

ipdox.doxIP({ ip })

Fetches geolocation data for the specified IP address.

  • ip - IP address

Returns a Promise that resolves to an IPDOXResponse object.

If no response is found, undefined is returned.

IPDOXResponse

The IPDOXResponse object includes the following properties:

export interface IPDOXResponse {
    ip: string; // IP address
    country: string; // Country ISO code
    city: string; // City name
    continent: string; // Continent ISO code
    latitude: number; // Latitude
    longitude: number; // Longitude
    zip: string; // Zip code
    isp: string; // ISP name
    proxy?: boolean; // Boolean indicating if the IP address is a proxy (might be undefined)
    isHosting?: boolean; // Boolean indicating if the IP address is a hosting provider (might be undefined)
    proxyInfo?: {
        // Proxy information  (might be undefined)
        isVPN: boolean; // Boolean indicating if the IP address is a VPN (might be undefined)
        isTOR: boolean; // Boolean indicating if the IP address is a TOR node (might be undefined)
        isProxy: boolean; // Boolean indicating if the IP address is a proxy (might be undefined)
    };
    timeZone: string; // Time zone
    source: string; // Source API
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the ISC License.