Giter VIP home page Giter VIP logo

dat-geoip's Introduction

@jimpick/dat-geoip

An experiment in using hypertrie to host a peer-to-peer geo ip lookup database.

The data from MaxMind GeoLite2 is loaded into a hypertrie.

Install

npm install -g @jimpick/dat-geoip

Usage

There is a CLI to look up an IP address:

$ dat-geoip 66.6.44.4
{
  "ip": "66.6.44.4",
  "network": "66.6.32.0/20",
  "geonameId": 5128581,
  "registeredCountryGeonameId": 6252001,
  "representedCountryGeonameId": 0,
  "isAnonymousProxy": false,
  "isSatelliteProvider": false,
  "postalCode": "10010",
  "latitude": 40.7391,
  "longitude": -73.9826,
  "accuracyRadius": 1000,
  "localeCode": "en",
  "continentCode": "NA",
  "continentName": "North America",
  "countryIsoCode": "US",
  "countryName": "United States",
  "subdivision1IsoCode": "NY",
  "subdivision1Name": "New York",
  "subdivision2IsoCode": "",
  "subdivision2Name": "",
  "cityName": "New York",
  "metroCode": "501",
  "timeZone": "America/New_York",
  "isInEuropeanUnion": false
}

Limitations

  • Just a demo - the data I am seeding might not stay online forever
  • IPv4 only right now
  • English only
  • Dat key for database is hardcoded
  • No library yet
  • Data is stored as JSON - it would be better to store it in a binary format
  • The lookup strategy is quite naive and not heavily tested. A high performance version would probably build a custom index
  • Uses the free GeoLite2 database. I haven't tried loading the paid GeoIP2 database (it probably would work, but take care to keep the key private to avoid violating license terms)

License

This software is MIT licensed.

The data that gets loaded into it from MaxMind has this license:

This product includes GeoLite2 data created by MaxMind, available from
<a href="http://www.maxmind.com">http://www.maxmind.com</a>.

dat-geoip's People

Contributors

jimpick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.