0.20.6 • Published 3 months ago

@appsensorlike/appsensorlike_geolocators_fast_geoip v0.20.6

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

@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.

0.20.6

3 months ago

0.18.1

7 months ago

0.18.0

7 months ago