sherpya / geolite2legacy

MaxMind GeoLite2 (CSV) to Legacy format converter
MIT License
254 stars 88 forks source link

use csv version info in data file comment #8

Closed laurensbl closed 4 years ago

laurensbl commented 5 years ago

According to https://dev.maxmind.com/geoip/geoip2/geoip2-city-country-csv-databases/ the name of the directory holding the csv files in the zip file contains the date of GeoIP2 databases. This can be used to provide version info in the output legacy db file.

laurensbl commented 5 years ago

Btw, I noticed that the data file comment of the converted ASN DB is somehow broken; When I use

#!/usr/bin/perl
use Geo::IP;
my $gi = Geo::IP->open("/path/to/GeoIP.dat", GEOIP_STANDARD);
print "GeoLite Country database version:\n";
print $gi->database_info;
print "\n\nGeoLite City database version:\n";
my $gi = Geo::IP->open("/path/to/GeoLiteCity.dat", GEOIP_STANDARD);
print $gi->database_info;
print "\n\nGeoLite ASN database version:\n";
my $gi = Geo::IP->open("/path/to/GeoIPASNum.dat", GEOIP_STANDARD);
print $gi->database_info . "\n";

the data file comment of the Country and City DBs are printed correctly, but the comment of the ASN db doesn't show. It did show with the latest legacy DBs from MaxMind.

GeoLite Country database version:
GeoLite2-Country-CSV_20190326 converted to legacy MaxMind DB with geolite2legacy by sherpya

GeoLite City database version:
GeoLite2-City-CSV_20190326 converted to legacy MaxMind DB with geolite2legacy by sherpya

GeoLite ASN database version:
GeoLite Country database version:
GEO-106FREE 20180327 Build 1 Copyright (c) 2018 MaxMind Inc All Rights Reserved

GeoLite City database version:
GEO-533LITE 20180327 Build 1 Copyright (c) 2018 MaxMind Inc All Rights Reserved

GeoLite ASN database version:
GEO-117 20180324 Build 1 Copyright (c) 2018 MaxMind Inc All Rights Reserved
sherpya commented 4 years ago

closed with 6acf333