Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conversion tool #136

Open
benmonro opened this issue Apr 20, 2018 · 5 comments
Open

conversion tool #136

benmonro opened this issue Apr 20, 2018 · 5 comments

Comments

@benmonro
Copy link

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?

@bluesmoon
Copy link
Collaborator

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.

@konklone
Copy link

I went about it something like this:

  • Install the 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.
  • Update the URLs in the updatedb.js file to download from those URLs, while serve is running.
  • Update the filenames in the updatedb.js file to use GeoIP2- prefixes instead of GeoLite2 prefixes.
  • Change the lines in updatedb.js to use the http module instead of https.

@konklone
Copy link

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'
		]
	}
];

@ar2rsawseen
Copy link
Collaborator

Is the format the same for paid files? Only the place where they can be fetched is different?

@bluesmoon
Copy link
Collaborator

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants