Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 96 lines (70 sloc) 4.191 kb
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
1 = geoip
2
3e44fa2 revert merge
Tonni Aagesen authored
3 http://github.com/cjheath/geoip
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
4
5 == DESCRIPTION:
6
7 GeoIP searches a GeoIP database for a given host or IP address, and
8 returns information about the country where the IP address is allocated,
9 and the city, ISP and other information, if you have that database version.
10
11 == FEATURES/PROBLEMS:
12
7d8fc2a @cjheath Rolled to 0.8.7 with timezone support
authored
13 Includes support for ASN data files, thanks to Roland Matiz.
14 This release adds support for timezone names, thanks to Tonni Aagesen.
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
15
d7141cd @cjheath Added file-sharing warnings and pointers
authored
16 If you have required 'io/extra' and have IO#pread, cross-process file-descriptor sharing is enabled.
17 Each GeoIP instance keeps the file descriptor open, with a Mutex for thread-safety.
18 You should consider this if your process will fork without exec, as
b0c7762 @cjheath Please can we agree on some plain-text markup standards?
authored
19 {modrails does}[http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintential_file_descriptor_sharing]
d7141cd @cjheath Added file-sharing warnings and pointers
authored
20
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
21 == SYNOPSIS:
22
23 require 'geoip'
5f5a031 @cjheath Further cleaning up including Readme
authored
24
25 # Use the country database:
5e344b5 @cjheath Doc refinements, Rolled to 1.0.0
authored
26 c = GeoIP.new('GeoIP.dat').country('www.nokia.com')
27 => ["www.nokia.com", "147.243.3.83", 69, "FI", "FIN", "Finland", "EU"]
28 c.country_code3
29 => "FIN"
30 c.to_hash
31 => {:country_code3=>"FIN", :country_name=>"Finland", :continent_code=>"EU", :request=>"www.nokia.com", :country_code=>69, :country_code2=>"FI", :ip=>"147.243.3.83"}
7d8fc2a @cjheath Rolled to 0.8.7 with timezone support
authored
32
d7141cd @cjheath Added file-sharing warnings and pointers
authored
33 Returned values are the requested hostname, the IP address as a dotted quad,
34 Maxmind's country code, the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3
35 country code, the ISO3166 country name, and the continent code.
5f5a031 @cjheath Further cleaning up including Readme
authored
36
37 # Use the city database:
5e344b5 @cjheath Doc refinements, Rolled to 1.0.0
authored
38 c = GeoIP.new('GeoLiteCity.dat').city('github.com')
39 => ["github.com", "207.97.227.239", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]
40 >> c.longitude
41 => -122.4156
42 >> c.timezone
43 => "America/Los_Angeles"
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
44
216d1f1 Import timezones from http://www.maxmind.com/timezone.txt and add tim…
Tonni Aagesen authored
45 GeoIP.new('GeoCity.dat').city('github.com')
7d8fc2a @cjheath Rolled to 0.8.7 with timezone support
authored
46 => ["github.com", "207.97.227.239", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]
47
d7141cd @cjheath Added file-sharing warnings and pointers
authored
48 Returned values are the requested hostname, the IP address as a dotted quad,
49 the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3 country code, the
50 ISO3166 country name, the continent code, the region (state or territory) name,
51 city name, postal_code/zipcode, latitude, longitude, USA DMA code, USA area code,
52 timezone name.
5f5a031 @cjheath Further cleaning up including Readme
authored
53
d7141cd @cjheath Added file-sharing warnings and pointers
authored
54 Result arrays from both city and country have mixed-in accessor methods as appropriate:
55 request, ip, country_code, country_code2, country_code3, country_name, continent_code,
56 region_name, city_name, postal_code, latitude, longitude, dma_code, area_code, timezone
216d1f1 Import timezones from http://www.maxmind.com/timezone.txt and add tim…
Tonni Aagesen authored
57
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
58 GeoIP.new('GeoIPASNum.dat').asn("www.fsb.ru")
59 => ["AS8342", "RTComm.RU Autonomous System"]
60
61 == REQUIREMENTS:
62
5e344b5 @cjheath Doc refinements, Rolled to 1.0.0
authored
63 You need one of the free GeoLite country, city or ASN databases, or a subscription database version.
64 The last known download locations for the GeoLite database versions are
65 <http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz>,
66 <http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz>,
43f63c0 @cjheath Fixed to work with Ruby 1.9
authored
67 <http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz>.
68
69 This API requires the file to be decompressed for searching. Other versions
70 of this database are available for purchase which contain more detailed
71 information, but this information is not returned by this implementation.
72 See www.maxmind.com for more information.
73
74 == INSTALL:
75
76 sudo gem install geoip
77
78 == LICENSE:
79
daad456 @cjheath Removed erroneous MIT license from newgem
authored
80 This version Copyright (C) 2005 Clifford Heath
81 Derived from the C version, Copyright (C) 2003 MaxMind LLC
82
83 This library is free software; you can redistribute it and/or
84 modify it under the terms of the GNU General Public
85 License as published by the Free Software Foundation; either
86 version 2.1 of the License, or (at your option) any later version.
87
88 This library is distributed in the hope that it will be useful,
89 but WITHOUT ANY WARRANTY; without even the implied warranty of
90 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
91 General Public License for more details.
92
93 You should have received a copy of the GNU General Public
94 License along with this library; if not, write to the Free Software
95 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Something went wrong with that request. Please try again.