geoip 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +13 -0
- data/geoip.gemspec +4 -4
- data/lib/geoip.rb +4 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0fbea1dc4ed77b0dbdb77c24bbea36c3157648a
|
|
4
|
+
data.tar.gz: 2bd5fcf48e46090d0b78383822d547304f4cbacd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5be733f5691c1c1096e638ecbd9831cb7387aaf55ae118a9bf7c1bb7eaee1c5f0eab890e3c172286f345029bc19df63584f8eeb5bdea01539592aa94768d36d1
|
|
7
|
+
data.tar.gz: 5a808dc0dfc62714d422b6f75e35b2b3123e58357c79ef34714d1f78a0f8d5b4d8285aa8db5f29b1864eb7cfaed4dbe917f6c9f4afe55d09ff4d6e76248972af
|
data/README.rdoc
CHANGED
|
@@ -10,6 +10,8 @@ and the city, ISP and other information, if you have that database version.
|
|
|
10
10
|
|
|
11
11
|
== FEATURES/PROBLEMS:
|
|
12
12
|
|
|
13
|
+
Does not support the new Maxmind v2 database formats.
|
|
14
|
+
|
|
13
15
|
Includes support for ASN data files, thanks to Roland Matiz.
|
|
14
16
|
This release adds support for timezone names, thanks to Tonni Aagesen.
|
|
15
17
|
|
|
@@ -62,6 +64,17 @@ region_name, city_name, postal_code, latitude, longitude, dma_code, area_code, t
|
|
|
62
64
|
GeoIP.new('GeoIPASNum.dat').asn("www.fsb.ru")
|
|
63
65
|
=> ["AS8342", "RTComm.RU Autonomous System"]
|
|
64
66
|
|
|
67
|
+
For testing or other purposes, you might wish to treat localhost IP addresses as
|
|
68
|
+
some other address - an external one. You can do this by assigning the desired
|
|
69
|
+
external IP address to the attribute local_ip_alias:
|
|
70
|
+
|
|
71
|
+
g = GeoIP.new('GeoIP.dat')
|
|
72
|
+
g.city("127.0.0.1")
|
|
73
|
+
=> nil
|
|
74
|
+
g.local_ip_alias = "173.194.112.35"
|
|
75
|
+
g.city("127.0.0.1")
|
|
76
|
+
#<struct GeoIP::City request="127.0.0.1", ip="173.194.112.35", country_code2="US", country_code3="USA", country_name="United States", continent_code="NA", region_name="CA", city_name="Mountain View", postal_code="94043", latitude=37.41919999999999, longitude=-122.0574, dma_code=807, area_code=650, timezone="America/Los_Angeles", real_region_name="California">
|
|
77
|
+
|
|
65
78
|
== REQUIREMENTS:
|
|
66
79
|
|
|
67
80
|
You need one of the free GeoLite country, city or ASN databases, or a subscription database version.
|
data/geoip.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: geoip 1.6.
|
|
5
|
+
# stub: geoip 1.6.2 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "geoip"
|
|
9
|
-
s.version = "1.6.
|
|
9
|
+
s.version = "1.6.2"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib"]
|
|
13
13
|
s.authors = ["Clifford Heath", "Roland Moriz"]
|
|
14
|
-
s.date = "
|
|
14
|
+
s.date = "2016-08-03"
|
|
15
15
|
s.description = "GeoIP searches a GeoIP database for a given host or IP address, and\nreturns information about the country where the IP address is allocated,\nand the city, ISP and other information, if you have that database version."
|
|
16
16
|
s.email = ["clifford.heath@gmail.com", "rmoriz@gmail.com"]
|
|
17
17
|
s.executables = ["geoip"]
|
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
|
42
42
|
]
|
|
43
43
|
s.homepage = "http://github.com/cjheath/geoip"
|
|
44
44
|
s.licenses = ["LGPL"]
|
|
45
|
-
s.rubygems_version = "2.
|
|
45
|
+
s.rubygems_version = "2.4.5"
|
|
46
46
|
s.summary = "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."
|
|
47
47
|
end
|
|
48
48
|
|
data/lib/geoip.rb
CHANGED
|
@@ -58,7 +58,7 @@ require 'yaml'
|
|
|
58
58
|
class GeoIP
|
|
59
59
|
|
|
60
60
|
# The GeoIP GEM version number
|
|
61
|
-
VERSION = "1.6.
|
|
61
|
+
VERSION = "1.6.2"
|
|
62
62
|
|
|
63
63
|
# The +data/+ directory for geoip
|
|
64
64
|
DATA_DIR = File.expand_path(File.join(File.dirname(__FILE__),'..','data','geoip'))
|
|
@@ -709,9 +709,10 @@ class GeoIP
|
|
|
709
709
|
record.slice!(record.index("\0")..-1)
|
|
710
710
|
|
|
711
711
|
# AS####, Description
|
|
712
|
-
# REVISIT: Text is in Latin-1 (ISO8859-1)
|
|
713
712
|
if record =~ /^(AS\d+)(?:\s(.*))?$/
|
|
714
|
-
|
|
713
|
+
# set the correct encoding in ruby 1.9 compatible environments:
|
|
714
|
+
asn = $2.respond_to?(:force_encoding) ? $2.force_encoding('iso-8859-1').encode('utf-8') : $2
|
|
715
|
+
ASN.new($1, asn)
|
|
715
716
|
else
|
|
716
717
|
record
|
|
717
718
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geoip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Clifford Heath
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: |-
|
|
15
15
|
GeoIP searches a GeoIP database for a given host or IP address, and
|
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
64
64
|
version: '0'
|
|
65
65
|
requirements: []
|
|
66
66
|
rubyforge_project:
|
|
67
|
-
rubygems_version: 2.
|
|
67
|
+
rubygems_version: 2.4.5
|
|
68
68
|
signing_key:
|
|
69
69
|
specification_version: 4
|
|
70
70
|
summary: GeoIP searches a GeoIP database for a given host or IP address, and returns
|