/fastgeoip

Very simple and fast wrapper for MaxMind GeoIP

Primary LanguageCMIT LicenseMIT

fastgeoip

Small and simple wrapper for MaxMind GeoIP (country). Partly based on the MaxMind GeoIP C Code and the Net/GeoIP extension.

Currently the only supported operations are:

  • open a database

  • ip to country iso code lookup

… but it is fast ;-)

How to use

gem install fastgeoip

Download the GeoIP database geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

require 'fastgeoip'                   

db = FastGeoIp.open 'path-to-yor-data-file/GeoIP.dat'
db.country_code_by_addr('81.1.1.1') # should yield 'US'

Todo

  • add tests

Changelog

0.2.0 - Ruby 1.9 support 0.1.0 - initial release

Copyright © 2010 Martin Karlsch. See LICENSE for details.