alexreisner/geocoder

[Review request] Interested in integrating IPinfo's free IP databses for local IP address lookups.

Opened this issue · 2 comments

Context

I am the DevRel of IPinfo.io, and we really appreciate the support the library has for our API.

We are hoping to do a PR for integrating IPinfo's free IP databases for the project. We are hoping to write the integration code to support our free IP to Country ASN database.

Features of the database:

  • Daily updates, full accuracy and no range aggregation
  • IPv4 and IPv6 information from the same database
  • Supported file format: CSV, MMDB, and JSON
  • Licensed under CC-BY-SA 4.0

Database schema

FIELD NAME EXAMPLE DATA TYPE DESCRIPTION
start_ip 1.0.16.0 TEXT Starting IP address of an IP address range
end_ip 1.0.31.255 TEXT Ending IP address of an IP address range
country JP TEXT ISO 3166 country code of the location
country_name Japan TEXT Name of the country
continent AS TEXT Continent code of the country
continent_name Asia TEXT Name of the continent
asn AS2519 TEXT Autonomous System Number
as_name ARTERIA Networks Corporation TEXT Name of the AS (Autonomous System) organization
as_domain arteria-net.com TEXT Official domain or website of the AS organization

Users can download the database using their free account access token. The download URL is:

curl -L https://ipinfo.io/data/free/country_asn.mmdb?token=<ACCESS_TOKEN> -o country_asn.mmdb

The MMDB reader library facilitates only IP address lookups and no reverse IP lookups or information searches.

Review

We would appreciate a review from the maintainer(s) before we start coding. We are hoping to implement the feature set described here: https://github.com/alexreisner/geocoder/blob/master/README_API_GUIDE.md#geolite2-geoip2

The features I am seeing at this moment are:

  • Pre-downloading the database and linking the file path
    • We have rate limits for data downloads. Users might also want to implement some sort of cronjob outside the project to refresh the data. Automatic download sounds nice but I am not sure about the implementation side. If you have any feedback please let us know.
  • Installing the maxminddb. The contribution guideline states: "Do not add dependencies on other gems". So, users must install the MMDB reader library before they get started.

If you have any feedback that will be greatly appreciated.

Thank you for the detailed request! This sounds like a really nice service and I'd be happy to add support for it. Your approach (imitating GeoLite2) is exactly right. I'm sorry about the no-external-dependency rule. The best way to handle the maxminddb gem requirement is also to imitate the GeoLite2 lookup and print a console message if the lookup is selected and the gem isn't present. Feel free to get started on a PR, which I will be happy to review.

@alexreisner awesome! I really appreciate the approval! I had geocoder in my mind since we launched our free DB. We will get started with the PR. Thank you very much.