geoip

Get Version

0.8.6

‘Geographic info for an IP address’

What

GeoIP searches a GeoIP database for a given host or IP address, and
returns information about the country where the IP address is allocated,
and the city, ISP and other information, if you have that database version.

Installing

sudo gem install geoip

Prerequisites

You need at least the free GeoIP.dat, for which the last known download
location is http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
or the city database http://www.maxmind.com/app/geolitecity
This API requires the file to be decompressed for searching. Other versions
of this database are available for purchase which contain more detailed
information, but this information is not returned by this implementation.
See www.maxmind.com for more information.

Example

require ‘geoip’
GeoIP.new(‘GeoIP.dat’).country(“www.netscape.sk”)
=> [“www.netscape.sk”, “217.67.16.35”, 196, “SK”, “SVK”, “Slovakia”, “EU”]
GeoIP.new(‘GeoIPASNum.dat’).asn(“www.fsb.ru”)
=> [“AS8342”, “RTComm.RU Autonomous System”]

Source Repository

The trunk repository is http://github.com/cjheath/geoip

License

I don’t normally use the GPL license, but this one is derived
from Maxmind’s code, so I use the license they use.

This version Copyright © 2005 Clifford Heath
Derived from the C version, Copyright © 2003 MaxMind LLC

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Clifford Heath, 12th November 2009
Theme extended from Paul Battley