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

IP to Nation cannot populate its data due to datasource deprecation #1

Open
kevincupp opened this issue Jan 17, 2019 · 14 comments
Open

Comments

@kevincupp
Copy link

Description of the problem
IP to Nation uses the GeoLite Legacy database from MaxMind, but, it's been deprecated and taken down. As such, IP to Nation cannot populate its data.

Possible Solution
Update the module to use GeoLite2 and note any schema changes in the new database. Also note it requires some license attribution.

@kevincupp
Copy link
Author

Dumping some research into here:

Here is documentation on the legacy CSV format: https://dev.maxmind.com/geoip/legacy/csv/
And now the new CSV format: https://dev.maxmind.com/geoip/geoip2/geoip2-city-country-csv-databases/

The IP ranges are now in the Country-Blocks CSV files, which presents two problems:

  1. The IP ranges are no longer represented in upper and lower bounds, we'll need to manually calculate those if we want to keep that schema, which might be best for quick querying. I'm honestly not sure what the recommendation is for querying data in this new format when you need to find an IP range that matches an IP, whereas it was pretty clear before. There is a tool that converts the new format to the old format that while we can't really use in EE itself, might be helpful to see what's going on there.
  2. There aren't country codes in those CSV files, we have to map a geoname_id to figure out the contry code, which requires going through all of the Country-Locations files in the package. This may be difficult to do in a memory-efficient way if we need to insert the country code into the same table it is now, but maybe we just make a separate lookup table for country codes and let MySQL make the association.

So the database is not quite a drop-in replacement, will require quite a bit of extra massaging to make the transition.

@dankingsley
Copy link

Just wondering if it's possible to be provided database table exports of data before this broke so I can use this feature for the time being?

@kevincupp
Copy link
Author

@dankingsley See if this works: ip2nation.sql.zip

@dankingsley
Copy link

Perfect @kevincupp Thanks!

@litzinger
Copy link

Has anyone considered switching EE to a free service such as https://ipstack.com/?

CloudFront can also add request headers https://aws.amazon.com/about-aws/whats-new/2014/06/26/amazon-cloudfront-device-detection-geo-targeting-host-header-cors/

@dougblackjr
Copy link

I had done something utilizing GeoPlugin for another CMS plugin: https://github.com/PrimitiveSocial/ip-country/blob/master/src/services/IpCountryService.php

@kevincupp If this is something that you think would fit EE, I can work on it and do a PR this week. Are there preferred specs on how this should work?

@litzinger
Copy link

TBH it might make a good add-on. An add-on that had the option of connecting to multiple different services, all implementing an interface that a single module tag can use. A set of config options for each endpoint so the user can choose which to use, and of course tie it into the Consent module somehow to see if the user has to consent to cookies or not depending on location.

@kevincupp
Copy link
Author

Thanks, @dougblackjr. I think IP to Nation's current strategy of storing everything locally gives the advantage of quick look-ups. For instance, if you have a long list of members you want to display the location for, doing an HTTP request for each one might take a while or even hit up against some API limit. While it otherwise sounds nice, it may be seen as a regression for those who do something similar to what I described.

@alexrubin
Copy link

any chance someone has come up with a working solution yet?

@anthony8bc
Copy link

Hi. We had a similar problem and created a simple Geo Location add-on for our clients. Not sure if it's relevant here but thought I'd share in case it's of use. https://devot-ee.com/add-ons/ip-geo-locator

@litzinger
Copy link

Should add that add-on to the EE Store ;) https://expressionengine.com/add-ons

@anthony8bc
Copy link

Should add that add-on to the EE Store ;) https://expressionengine.com/add-ons

Yes, I have applied to be a vendor on the EE Store. Still waiting to hear back from them.

@robinsowell
Copy link

Oh- that was a nice find! And it is available in the store now. Thanks!

@intoeetive
Copy link
Contributor

Moving this issue as Ip2Nation has been taken out of core in EE7 and is now separate add-on: https://github.com/ExpressionEngine/IP-To-Nation

@intoeetive intoeetive transferred this issue from ExpressionEngine/ExpressionEngine Apr 11, 2023
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

8 participants