Skip to content

Instantly share code, notes, and snippets.

@rikonor
Last active September 14, 2022 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rikonor/dd9c3faf685e952f1b0b575889dbd906 to your computer and use it in GitHub Desktop.
Save rikonor/dd9c3faf685e952f1b0b575889dbd906 to your computer and use it in GitHub Desktop.
Generate empty mmdb files
# run 'mcpan MaxMind::DB::Writer::Tree' beforehand
use MaxMind::DB::Writer::Tree;
use Net::Works::Network;
my %types = ();
my $tree = MaxMind::DB::Writer::Tree->new(
ip_version => 4,
record_size => 24,
database_type => 'Empty',
description => { en => 'Empty database' },
map_key_type_callback => sub { $types{ $_[0] } },
);
open my $fh, '>:raw', 'GeoLite2-Empty.mmdb';
$tree->write_tree($fh);
mmdblookup \
--file GeoLite2-Empty.mmdb \
--ip 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment