Currently an external service is queried once per session to determine the user's IP address.
TODO: provide local solution to avoid this external dependency.
Possibility: build on ip2cc http://drupal.org/node/45806
However, that module looks to need some refactoring. I opened two issues: #309952: Pull JSON functionality into a separate module, #309947: Pull node handling into a separate module.
Comments
Comment #1
recidive commentedAnother possibility is to build on geouser module (http://drupal.org/project/geouser) that's based on data from http://www.maxmind.com/ and have up to city granularity. Also this provides coordinates, which can help if we e.g. need automatic time zones discovering. I don't know the status of that module and the accuracy of maxmind data compared to ip2cc, though.
Comment #2
nedjoWe should support multiple external solutions for IP to location mapping, while probably having a simple fallback like the one already implemented.
Existing Drupal modules handling ip2cc or similar functionality generally are uneven, are tied to their particular proprietary third party solutions, lump in a lot of additional functionality, and produce data in very different ways.
As in many other cases, e.g. wysiwyg, there's a need here for a generic API that can be used for various third party solutions, providing data in an established format.
Comment #3
nedjoThis needs to be done. For high traffic sites we can't rely on an external service.
Proposed implementation:
1. Introduce a hook_country_code_handler through which modules can register their handlers for country code determination.
2. Implement this hook in country_code using the existing call.
3. Introduce an admin setting to select which handler to use.
4. Write implementations for other, more robust handlers.
Comment #4
nedjoI'm going to implement this approach.
Comment #5
nedjoIntroduced this hook with the existing hostip implementation.
Added a config option that shows up only if there is more than one hanlder available.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
zidong.c commentedThank you for your attention for GeoUser module (http://drupal.org/project/geouser), I am the author of this module.
This module is based on an IP database called GeoLiteCity, which as far as I know is most accurate free/open source IP database available, they also provide a commercial one which is more accurate.
I am currently working on providing an easy-to-use, and easy-to-understand API for other Drupal module to retrieve Geographic information based on user's IP address.
The GeoUser module is on Beta status now, you can check out if you're interested.
Zidong