All Projects → runk → Node Maxmind

runk / Node Maxmind

Licence: mit
Maxmind GEO Lookup

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Node Maxmind

Reconpi
ReconPi - A lightweight recon tool that performs extensive scanning with the latest tools.
Stars: ✭ 490 (-2.2%)
Mutual labels:  hacktoberfest
Awesome Plotters
A curated list of code and resources for computer-controlled drawing machines and other visual art robots.
Stars: ✭ 495 (-1.2%)
Mutual labels:  hacktoberfest
Ultra Runner
🏃⛰ Ultra fast monorepo script runner and build tool
Stars: ✭ 496 (-1%)
Mutual labels:  hacktoberfest
Silverstripe Cms
SilverStripe CMS - this is a module for SilverStripe Framework rather than a standalone app. Use https://github.com/silverstripe/silverstripe-installer/ to set this up.
Stars: ✭ 492 (-1.8%)
Mutual labels:  hacktoberfest
Flutter Pi
A light-weight Flutter Engine Embedder for Raspberry Pi that runs without X.
Stars: ✭ 492 (-1.8%)
Mutual labels:  hacktoberfest
Gameserver
League Sandbox's Game Server
Stars: ✭ 497 (-0.8%)
Mutual labels:  hacktoberfest
Steam
☁️ Python package for interacting with Steam
Stars: ✭ 489 (-2.4%)
Mutual labels:  hacktoberfest
Lapin
AMQP client library in Rust, with a clean, futures based API
Stars: ✭ 497 (-0.8%)
Mutual labels:  hacktoberfest
Auroradns.gui
纯净抗污染,简单轻量级
Stars: ✭ 494 (-1.4%)
Mutual labels:  hacktoberfest
Pangeo
Pangeo website + discussion of general issues related to the project.
Stars: ✭ 500 (-0.2%)
Mutual labels:  hacktoberfest
Takenote
TakeNote is a note-taking app for the web. You can use the demo app at takenote.dev. It is a static site without a database and does not sync your notes to the cloud. The notes are persisted temporarily in local storage, but you can download all notes in markdown format as a zip.
Stars: ✭ 5,180 (+933.93%)
Mutual labels:  hacktoberfest
Rest.js
GitHub REST API client for JavaScript
Stars: ✭ 156 (-68.86%)
Mutual labels:  hacktoberfest
Carbonate
Utilities for managing graphite clusters
Stars: ✭ 498 (-0.6%)
Mutual labels:  hacktoberfest
Hacktoberfest 2020
Make this Hacktoberfest a learning period and contribute to Great Open Source Projects.
Stars: ✭ 492 (-1.8%)
Mutual labels:  hacktoberfest
Simd Json
Rust port of simdjson
Stars: ✭ 499 (-0.4%)
Mutual labels:  hacktoberfest
Openml
Open Machine Learning
Stars: ✭ 489 (-2.4%)
Mutual labels:  hacktoberfest
Po Angular
Biblioteca de componentes Angular.
Stars: ✭ 497 (-0.8%)
Mutual labels:  hacktoberfest
Asciidoctor.js
A JavaScript port of Asciidoctor, a modern implementation of AsciiDoc
Stars: ✭ 500 (-0.2%)
Mutual labels:  hacktoberfest
Imgui Go
Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)
Stars: ✭ 499 (-0.4%)
Mutual labels:  hacktoberfest
Pdm
A modern Python package manager with PEP 582 support.
Stars: ✭ 492 (-1.8%)
Mutual labels:  hacktoberfest

node-maxmind Build Status

Javascript module for Geo IP lookup using Maxmind binary databases (aka mmdb or geoip2). Fastest Maxmind lookup library available - up to 17,000% faster than other libraries. Module has 100% test coverage with comprehensive test suite. It natively works with binary Maxmind database format and doesn't require any "CSV - {specific lib format}" conversions as some other modules do. Maxmind binary databases are highly optimized for size and performance so there's no point using other formats.

GEO databases

You might want to use geolite2 module with free geo databases. Alternatively, free databases available for download here. If you need better accuracy you should consider buying commercial subscription.

Installation

npm i maxmind

Usage

JavaScript

const maxmind = require('maxmind');

maxmind.open('/path/to/GeoLite2-City.mmdb').then((lookup) => {
  console.log(lookup.get('66.6.44.4'));

  console.log(lookup.getWithPrefixLength('66.6.44.4'));
});

maxmind.open('/path/to/GeoOrg.mmdb').then((lookup) => {
  console.log(lookup.get('66.6.44.4'));

  console.log(lookup.getWithPrefixLength('66.6.44.4'));
});

TypeScript

import maxmind, { CityResponse } from 'maxmind';

const lookup = await maxmind.open<CityResponse>('/path/to/GeoLite2-City.mmdb');
console.log(lookup.get('66.6.44.4')); // inferred type maxmind.CityResponse

console.log(lookup.getWithPrefixLength('66.6.44.4')); // tuple with inferred type [maxmind.CityResponse|null, number]

Sync API

You can use Reader class directly, if you would want to instantiate it in non-async fashion. Use cases would include receiving a buffer database over network, or just reading it synchronously from disk.

import { Reader } from 'maxmind';
const buffer = fs.readFileSync('./db.mmdb');
const lookup = new Reader<CityResponse>(buffer);
const city = lookup.get('8.8.8.8');

const [city2, prefixLength] = lookup.getWithPrefixLength('66.6.44.4');

Supported response types:

- CountryResponse
- CityResponse
- AnonymousIPResponse
- AsnResponse
- ConnectionTypeResponse
- DomainResponse
- IspResponse

V6 Support

Module is fully compatible with IPv6. There are no differences in API between IPv4 and IPv6.

const lookup = await maxmind.open('/path/to/GeoLite2.mmdb');
const location = lookup.get('2001:4860:0:1001::3004:ef68');

Options

maxmind.open(filepath, [options])

  • filepath: <string> Path to the binary mmdb database file.
  • options: <Object>
    • cache: <Object> Cache options. Under the bonnet module uses tiny-lru cache.
      • max: <number> Max cache items to keep in memory. Default: 6000.
    • watchForUpdates: <boolean> Supports reloading the reader when changes occur to the database that is loaded. Default: false.
    • watchForUpdatesNonPersistent: <boolean> Controlls wether the watcher should be persistent or not. If it is persistent, a node process will be blocked in watching state if the watcher is the only thing still running in the program. Default: false.
    • watchForUpdatesHook: <Function> Hook function that is fired on database update. Default: null.

Does it work in browser?

Current module is designed to work in node.js environment. Check out mmdb-lib that's used under the bonnet - it's environment agnostic and does work in browser.

IP addresses validation

Module supports validation for both IPv4 and IPv6:

maxmind.validate('66.6.44.4'); // returns true
maxmind.validate('66.6.44.boom!'); // returns false

maxmind.validate('2001:4860:0:1001::3004:ef68'); // returns true
maxmind.validate('2001:4860:0:1001::3004:boom!'); // returns false

GeoIP Legacy binary format

In case you want to use legacy GeoIP binary databases you should use [email protected].

References

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].