cookpad/json2mmdb

Name: json2mmdb

Owner: Cookpad Inc.

Description: null

Created: 2017-03-08 05:51:30.0

Updated: 2017-03-08 05:54:01.0

Pushed: 2017-03-08 06:02:08.0

Homepage: null

Size: 3

Language: Perl

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Introduction

MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).

This repository was inspired of MaxMind's spec of their DB format.

It contains a simple script that generates a sample City database from a JSON file.

MMDB file generator

The Perl script json2mmdb.pl was based on MaxMind's test data generator.

Run Perl using perlbrew. Follow install instructions. (The copy-pastable curl command is recommended.)

itialize Perl environment
brew init
brew install perl-5.16.0
brew switch perl-5.16.0

stall CPAN Minus
 -L https://cpanmin.us | perl - App::cpanminus

stall Perl modules required by the script
brew exec cpanm Devel::Refcount MaxMind::DB::Reader::XS MaxMind::DB::Writer::Tree Net::Works::Network GeoIP2 Data::Printer Text::CSV_XS File::Slurp JSON::XS

n MMDB file generator
on2mmdb.pl

It generates the file GeoIP2-City-sample.mmdb that can be used as sample database in tests.

You can also pass a file name (without extension) as argument to the command:

on2mmdb.pl GeoIP2-City # Will generate GeoIP2-City.mmdb file from GeoIP2-City.json

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.