Open kevincupp opened 5 years ago
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:
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.
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?
@dankingsley See if this works: ip2nation.sql.zip
Perfect @kevincupp Thanks!
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/
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?
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.
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.
any chance someone has come up with a working solution yet?
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
Should add that add-on to the EE Store ;) https://expressionengine.com/add-ons
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.
Oh- that was a nice find! And it is available in the store now. Thanks!
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
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.