@appsensorlike/appsensorlike_geolocators_fast_geoip

0.20.6 • Public • Published

@appsensorlike/appsensorlike geo locator implementation utilizing https://www.npmjs.com/package/fast-geoip library. You can find it useful when you have to filter requests by geolocation. If you add geolocation along with the IP address in IPAddress constructor, it will be visualized in Dashboard's geo map.

Installation

npm i @appsensorlike/appsensorlike_geolocators_fast_geoip

Usage

import { FastGeoIPLocator } from "@appsensorlike/appsensorlike_geolocators_fast_geoip";
import { IPAddress } from "@appsensorlike/appsensorlike/core/core.js"

const geoLocator = new FastGeoIPLocator();

const getLocation = await geoLocator.readLocation("80.80.128.0");

console.log(getLocation);

//follow two options to create an IPAddress with geolocation
//
//use already obtained geolocation
const ipAddress1 = new IPAddress("80.80.128.0", getLocation);

//obtain geolocation and create an instance of IPAddress in one step
const ipAddress2 = await IPAddress.fromString("80.80.128.0", geoLocator);

console.log(ipAddress1);

TypeScript support

You need TypeScript version >= 4.7 in order the paths exported by the module to be resolved.

Readme

Keywords

Package Sidebar

Install

npm i @appsensorlike/appsensorlike_geolocators_fast_geoip

Weekly Downloads

10

Version

0.20.6

License

ISC

Unpacked Size

4.16 kB

Total Files

4

Last publish

Collaborators

  • si076