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

Want to use Geolocation DB csv file for nginx #8

Open
jkuj6 opened this issue Feb 21, 2024 · 3 comments
Open

Want to use Geolocation DB csv file for nginx #8

jkuj6 opened this issue Feb 21, 2024 · 3 comments

Comments

@jkuj6
Copy link

jkuj6 commented Feb 21, 2024

I want to use your https://ipapi.is/developers.html#geolocation-database csv file for nginx, however it seems im unable to easily convert it to .dat.

Do you have an easier way to do this?

At the moment im facing a few problems.

  1. I tried using https://github.com/ipinfo/mmdbctl to convert it however there is an issue with the CIDR notation, so i opened an issue here is ipapi csv's conversion supported? ipinfo/mmdbctl#32 but no reply yet.

  2. Then i tried creating my own script to first fit the same format of the csv file as that of ipinfo, i was able to adjust the csv file, except for one issue that i noticed in your csv DB when trying to then use mmdbctl...

mmdbctl import --in geolocationDatabaseIPv4_converted.csv --out data.mmdb
warn: couldn't insert line '154.17.129.024,154.17.129.024,154.17.0.0,Warsaw,Mazovia,Poland,52.22977,21.01178,05-077,Europe/Warsaw'
writing to data.mmdb (1278428 entries)

This 154.17.129.024 is incorrect from your DB. id appreciate if you could fix it.

After i successfully convert it to .mmdb, i can then finally use yet another tool to convert the .mmdb into legacy .dat for usage with nginx.

Finally, to avoid so many conversion tools, Id really appreciate it if you could have your csv file ready for use with nginx, in either .dat or in .mmdb format, or even in a compatible CSV format that is easily converted with mmdbctl.

thanks in advance

@t-e-s-tweb
Copy link

I want to use your https://ipapi.is/developers.html#geolocation-database csv file for nginx, however it seems im unable to easily convert it to .dat.

Do you have an easier way to do this?

At the moment im facing a few problems.

  1. I tried using https://github.com/ipinfo/mmdbctl to convert it however there is an issue with the CIDR notation, so i opened an issue here is ipapi csv's conversion supported? ipinfo/mmdbctl#32 but no reply yet.
  2. Then i tried creating my own script to first fit the same format of the csv file as that of ipinfo, i was able to adjust the csv file, except for one issue that i noticed in your csv DB when trying to then use mmdbctl...
mmdbctl import --in geolocationDatabaseIPv4_converted.csv --out data.mmdb
warn: couldn't insert line '154.17.129.024,154.17.129.024,154.17.0.0,Warsaw,Mazovia,Poland,52.22977,21.01178,05-077,Europe/Warsaw'
writing to data.mmdb (1278428 entries)

This 154.17.129.024 is incorrect from your DB. id appreciate if you could fix it.

After i successfully convert it to .mmdb, i can then finally use yet another tool to convert the .mmdb into legacy .dat for usage with nginx.

Finally, to avoid so many conversion tools, Id really appreciate it if you could have your csv file ready for use with nginx, in either .dat or in .mmdb format, or even in a compatible CSV format that is easily converted with mmdbctl.

thanks in advance

were you able to make it work? I would appreciate it if you could provide the method and your scripts which you used to achieve this.

@ipapi-is
Copy link
Owner

ipapi-is commented Mar 7, 2024

I fixed the underlying root issue. Please try again.

I think I will also provide a .mmdb file, you have me convinced :)

@ipapi-is
Copy link
Owner

ipapi-is commented Mar 7, 2024

Remove first column from the database:

cut -d, -f2- geolocationDatabaseIPv4.csv > data.csv

Then convert:

mmdbctl import --in data.csv --out data.mmdb

that works like a charm and yields:

writing to data.mmdb (1347178 entries)

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

3 participants