Open benmonro opened 6 years ago
So the conversion tool has evolved a bit to do the downloading and converting as one job. It's called updatedb
here: https://github.com/bluesmoon/node-geoip/blob/master/scripts/updatedb.js
You'll want to edit it, and modify the URLs to the paid versions that you have access to on MaxMind's servers, but if you're a javascript programmer, you could just as well edit the script to accept pre-fetched DB files, and skip the fetch
call at line 441
If you'd like to submit a patch for this, I'll merge it in.
I went about it something like this:
serve
module and serve a folder with the GeoIP2 CSV zip file in it, so that it's downloadable from a URL like localhost:5000/[whatever].zip
.updatedb.js
file to download from those URLs, while serve
is running.updatedb.js
file to use GeoIP2-
prefixes instead of GeoLite2
prefixes.updatedb.js
to use the http
module instead of https
.I only used the paid files at the country-level, but needed to download the free City level files to have something to work with, so here's what my updatedb.js
file looked like, in defining the database
object at the top:
var databases = [
{
type: 'country',
url: 'http://localhost:5000/GeoIP2-Country-CSV_20181218.zip',
src: [
'GeoIP2-Country-Locations-en.csv',
'GeoIP2-Country-Blocks-IPv4.csv',
'GeoIP2-Country-Blocks-IPv6.csv'
],
dest: [
'',
'geoip-country.dat',
'geoip-country6.dat'
]
},
{
type: 'city',
url: 'http://localhost:5000/GeoLite2-City-CSV_20181218.zip',
src: [
'GeoLite2-City-Locations-en.csv',
'GeoLite2-City-Blocks-IPv4.csv',
'GeoLite2-City-Blocks-IPv6.csv'
],
dest: [
'geoip-city-names.dat',
'geoip-city.dat',
'geoip-city6.dat'
]
}
];
Is the format the same for paid files? Only the place where they can be fetched is different?
yes
I've paid for the maxmind database. is there any documentation on how to use the conversion tool i keep reading about? I have the DB files, how do i now convert them so geoip-lite will be able to use them?