Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

cookpad/json2mmdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Archived as unmaintained/unused, but maybe it is useful to someone, somewhere.

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

# Initialize Perl environment
perlbrew init
perlbrew install perl-5.16.0
perlbrew switch perl-5.16.0

# Install CPAN Minus
curl -L https://cpanmin.us | perl - App::cpanminus

# Install Perl modules required by the script
perlbrew 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

# Run MMDB file generator
./json2mmdb.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:

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages