-
-
Save artembokhan/b05031f77860416ab55171488a8e1538 to your computer and use it in GitHub Desktop.
it creates 'empty.mmdb', empty MaxMind geoip database, good enough for your tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/perl | |
# run 'mcpan MaxMind::DB::Writer' beforehand | |
use MaxMind::DB::Writer::Tree; | |
use Net::Works::Network; | |
my %types = ( | |
#color => 'utf8_string', | |
#dogs => [ 'array', 'utf8_string' ], | |
#size => 'uint16', | |
); | |
my $tree = MaxMind::DB::Writer::Tree->new( | |
ip_version => 6, | |
record_size => 28, | |
database_type => 'GeoLite2-City', | |
languages => ['en', 'ru'], | |
description => { en => 'GeoLite2 City database (empty)' }, | |
map_key_type_callback => sub { $types{ $_[0] } }, | |
); | |
# my $network = Net::Works::Network->new_from_string( string => '2001:db8::/48' ); | |
# $tree->insert_network( | |
# $network, | |
# { | |
# color => 'blue', | |
# dogs => [ 'Fido', 'Ms. Pretty Paws' ], | |
# size => 42, | |
# }, | |
# ); | |
open my $fh, '>:raw', 'empty.mmdb'; | |
$tree->write_tree($fh); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment