Giter VIP home page Giter VIP logo

geoip-experiment's Introduction

GeoIP Experiment

Experiment to fit and query MaxMind database into dynamodb. Works with IPv4 and IPv6.

Prerequisites:

npm install

You must put maxmind CSVs into the data folder:

./data/GeoIP2-City-Blocks-IPv4.csv
./data/GeoIP2-City-Blocks-IPv6.csv
./data/GeoIP2-City-Locations-en.csv

Export the database:

npm run build -- --type=IPv4|IPv6

the output will be located in ./out named like this:

./out/${YYYYMMAA}_out_${IPv4|IPv6}.json

Example entry:

iph{"n":"281021"}ips{"n":"3758092288"}pc{"s":""}lc{"s":"en"}con_c{"s":"AS"}con_n{"s":"Asia"}cou_c{"s":"HK"}cou_n{"s":"Hong Kong"}s1_c{"s":""}s1_n{"s":""}s2_c{"s":""}s2_n{"s":""}cy_n{"s":""}m_c{"s":""}is_eu{"n":"0"}

Table of fields in the resulting database:

column name description value type
iph ip hash used for the hash key. Number
ips ip start as number Number
pc postal_code ("" when unknown) String
lc location_code ("" when unknown) String
con_c continent_code ("" when unknown) String
con_n continent_name ("" when unknown) String
cou_c country_iso_code ("" when unknown) String
cou_n country_name ("" when unknown) String
s1_c subdivision_1_code ("" when unknown) String
s1_n subdivision_1_name ("" when unknown) String
s2_c subdivision_2_code ("" when unknown) String
s2_n subdivision_2_name ("" when unknown) String
cy_n city_name ("" when unknown) String
m_c metro_code ("" when unknown) String
is_eu is_european_union (0 when unknown) Number

Clean the database:

npm run clean

Run a local dynamodb mock

npm run dynamodb-run

Insert IPv4 data into dynamodb mock

npm run dynamodb-insert

Run a test query on dynamodb mock

npm run dynamodb-query

geoip-experiment's People

Contributors

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