maxmind-geoip2 0.2.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +33 -0
- data/Gemfile +1 -7
- data/README.dev.md +1 -1
- data/README.md +36 -14
- data/lib/maxmind/geoip2/client.rb +289 -265
- data/lib/maxmind/geoip2/errors.rb +0 -7
- data/lib/maxmind/geoip2/model/abstract.rb +19 -15
- data/lib/maxmind/geoip2/model/anonymous_ip.rb +62 -50
- data/lib/maxmind/geoip2/model/asn.rb +33 -29
- data/lib/maxmind/geoip2/model/city.rb +59 -55
- data/lib/maxmind/geoip2/model/connection_type.rb +27 -23
- data/lib/maxmind/geoip2/model/country.rb +57 -53
- data/lib/maxmind/geoip2/model/domain.rb +27 -23
- data/lib/maxmind/geoip2/model/enterprise.rb +13 -9
- data/lib/maxmind/geoip2/model/insights.rb +12 -8
- data/lib/maxmind/geoip2/model/isp.rb +45 -41
- data/lib/maxmind/geoip2/reader.rb +260 -233
- data/lib/maxmind/geoip2/record/abstract.rb +17 -13
- data/lib/maxmind/geoip2/record/city.rb +33 -29
- data/lib/maxmind/geoip2/record/continent.rb +32 -28
- data/lib/maxmind/geoip2/record/country.rb +47 -43
- data/lib/maxmind/geoip2/record/location.rb +64 -60
- data/lib/maxmind/geoip2/record/maxmind.rb +14 -10
- data/lib/maxmind/geoip2/record/place.rb +22 -18
- data/lib/maxmind/geoip2/record/postal.rb +26 -22
- data/lib/maxmind/geoip2/record/represented_country.rb +20 -16
- data/lib/maxmind/geoip2/record/subdivision.rb +42 -38
- data/lib/maxmind/geoip2/record/traits.rb +204 -191
- data/maxmind-geoip2.gemspec +10 -3
- data/test/data/LICENSE +4 -0
- data/test/data/MaxMind-DB-spec.md +570 -0
- data/test/data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
- data/test/data/README.md +4 -0
- data/test/data/bad-data/README.md +7 -0
- data/test/data/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
- data/test/data/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
- data/test/data/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +1 -0
- data/test/data/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
- data/test/data/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
- data/test/data/bad-data/maxminddb-golang/invalid-string-length.mmdb +1 -0
- data/test/data/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +1 -0
- data/test/data/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
- data/test/data/bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb +0 -0
- data/test/data/perltidyrc +12 -0
- data/test/data/source-data/GeoIP2-Anonymous-IP-Test.json +49 -0
- data/test/data/source-data/GeoIP2-City-Test.json +12852 -0
- data/test/data/source-data/GeoIP2-Connection-Type-Test.json +102 -0
- data/test/data/source-data/GeoIP2-Country-Test.json +15916 -0
- data/test/data/source-data/GeoIP2-DensityIncome-Test.json +14 -0
- data/test/data/source-data/GeoIP2-Domain-Test.json +452 -0
- data/test/data/source-data/GeoIP2-Enterprise-Test.json +687 -0
- data/test/data/source-data/GeoIP2-ISP-Test.json +12595 -0
- data/test/data/source-data/GeoIP2-Precision-Enterprise-Test.json +2148 -0
- data/test/data/source-data/GeoIP2-Static-IP-Score-Test.json +2132 -0
- data/test/data/source-data/GeoIP2-User-Count-Test.json +2837 -0
- data/test/data/source-data/GeoLite2-ASN-Test.json +37 -0
- data/test/data/source-data/README +15 -0
- data/test/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
- data/test/data/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
- data/test/data/test-data/GeoIP2-City-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-Country-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-Domain-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-ISP-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-Static-IP-Score-Test.mmdb +0 -0
- data/test/data/test-data/GeoIP2-User-Count-Test.mmdb +0 -0
- data/test/data/test-data/GeoLite2-ASN-Test.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-nested.mmdb +0 -0
- data/test/data/test-data/MaxMind-DB-test-pointer-decoder.mmdb +0 -0
- data/test/data/test-data/README.md +26 -0
- data/test/data/test-data/maps-with-pointers.raw +0 -0
- data/test/data/test-data/write-test-data.pl +691 -0
- data/test/data/tidyall.ini +5 -0
- data/test/test_client.rb +4 -2
- data/test/test_model_country.rb +16 -0
- data/test/test_reader.rb +59 -0
- metadata +156 -10
- data/Gemfile.lock +0 -70
@@ -2,27 +2,31 @@
|
|
2
2
|
|
3
3
|
require 'maxmind/geoip2/record/abstract'
|
4
4
|
|
5
|
-
module MaxMind
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
module MaxMind
|
6
|
+
module GeoIP2
|
7
|
+
module Record
|
8
|
+
# Location data common to different location types.
|
9
|
+
class Place < Abstract
|
10
|
+
# @!visibility private
|
11
|
+
def initialize(record, locales)
|
12
|
+
super(record)
|
13
|
+
@locales = locales
|
14
|
+
end
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# The first available localized name in order of preference.
|
17
|
+
#
|
18
|
+
# @return [String, nil]
|
19
|
+
def name
|
20
|
+
n = names
|
21
|
+
return nil if n.nil?
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
@locales.each do |locale|
|
24
|
+
return n[locale] if n.key?(locale)
|
25
|
+
end
|
24
26
|
|
25
|
-
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
@@ -2,29 +2,33 @@
|
|
2
2
|
|
3
3
|
require 'maxmind/geoip2/record/abstract'
|
4
4
|
|
5
|
-
module MaxMind
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
module MaxMind
|
6
|
+
module GeoIP2
|
7
|
+
module Record
|
8
|
+
# Contains data for the postal record associated with an IP address.
|
9
|
+
#
|
10
|
+
# This record is returned by all location services and databases besides
|
11
|
+
# Country.
|
12
|
+
class Postal < Abstract
|
13
|
+
# The postal code of the location. Postal codes are not available for all
|
14
|
+
# countries. In some countries, this will only contain part of the postal
|
15
|
+
# code. This attribute is returned by all location databases and services
|
16
|
+
# besides Country.
|
17
|
+
#
|
18
|
+
# @return [String, nil]
|
19
|
+
def code
|
20
|
+
get('code')
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
# A value from 0-100 indicating MaxMind's confidence that the postal code
|
24
|
+
# is correct. This attribute is only available from the Insights service
|
25
|
+
# and the GeoIP2 Enterprise database.
|
26
|
+
#
|
27
|
+
# @return [Integer, nil]
|
28
|
+
def confidence
|
29
|
+
get('confidence')
|
30
|
+
end
|
31
|
+
end
|
28
32
|
end
|
29
33
|
end
|
30
34
|
end
|
@@ -2,22 +2,26 @@
|
|
2
2
|
|
3
3
|
require 'maxmind/geoip2/record/country'
|
4
4
|
|
5
|
-
module MaxMind
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
module MaxMind
|
6
|
+
module GeoIP2
|
7
|
+
module Record
|
8
|
+
# Contains data for the represented country associated with an IP address.
|
9
|
+
#
|
10
|
+
# This class contains the country-level data associated with an IP address
|
11
|
+
# for the IP's represented country. The represented country is the country
|
12
|
+
# represented by something like a military base.
|
13
|
+
#
|
14
|
+
# See {MaxMind::GeoIP2::Record::Country} for inherited methods.
|
15
|
+
class RepresentedCountry < Country
|
16
|
+
# A string indicating the type of entity that is representing the country.
|
17
|
+
# Currently we only return +military+ but this could expand to include
|
18
|
+
# other types in the future.
|
19
|
+
#
|
20
|
+
# @return [String, nil]
|
21
|
+
def type
|
22
|
+
get('type')
|
23
|
+
end
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
@@ -2,47 +2,51 @@
|
|
2
2
|
|
3
3
|
require 'maxmind/geoip2/record/place'
|
4
4
|
|
5
|
-
module MaxMind
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
5
|
+
module MaxMind
|
6
|
+
module GeoIP2
|
7
|
+
module Record
|
8
|
+
# Contains data for the subdivisions associated with an IP address.
|
9
|
+
#
|
10
|
+
# This record is returned by all location databases and services besides
|
11
|
+
# Country.
|
12
|
+
#
|
13
|
+
# See {MaxMind::GeoIP2::Record::Place} for inherited methods.
|
14
|
+
class Subdivision < Place
|
15
|
+
# This is a value from 0-100 indicating MaxMind's confidence that the
|
16
|
+
# subdivision is correct. This attribute is only available from the
|
17
|
+
# Insights service and the GeoIP2 Enterprise database.
|
18
|
+
#
|
19
|
+
# @return [Integer, nil]
|
20
|
+
def confidence
|
21
|
+
get('confidence')
|
22
|
+
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
# This is a GeoName ID for the subdivision. This attribute is returned by
|
25
|
+
# all location databases and services besides Country.
|
26
|
+
#
|
27
|
+
# @return [Integer, nil]
|
28
|
+
def geoname_id
|
29
|
+
get('geoname_id')
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
# This is a string up to three characters long contain the subdivision
|
33
|
+
# portion of the ISO 3166-2 code. See
|
34
|
+
# https://en.wikipedia.org/wiki/ISO_3166-2. This attribute is returned by
|
35
|
+
# all location databases and services except Country.
|
36
|
+
#
|
37
|
+
# @return [String, nil]
|
38
|
+
def iso_code
|
39
|
+
get('iso_code')
|
40
|
+
end
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
# A Hash where the keys are locale codes and the values are names. This attribute is returned by all location services and
|
43
|
+
# databases besides country.
|
44
|
+
#
|
45
|
+
# @return [Hash<String, String>, nil]
|
46
|
+
def names
|
47
|
+
get('names')
|
48
|
+
end
|
49
|
+
end
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
@@ -3,198 +3,211 @@
|
|
3
3
|
require 'ipaddr'
|
4
4
|
require 'maxmind/geoip2/record/abstract'
|
5
5
|
|
6
|
-
module MaxMind
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
module MaxMind
|
7
|
+
module GeoIP2
|
8
|
+
module Record
|
9
|
+
# Contains data for the traits record associated with an IP address.
|
10
|
+
#
|
11
|
+
# This record is returned by all location services and databases.
|
12
|
+
class Traits < Abstract
|
13
|
+
# @!visibility private
|
14
|
+
def initialize(record)
|
15
|
+
super(record)
|
16
|
+
if record && !record.key?('network') && record.key?('ip_address') &&
|
17
|
+
record.key?('prefix_length')
|
18
|
+
ip = IPAddr.new(record['ip_address']).mask(record['prefix_length'])
|
19
|
+
# We could use ip.prefix instead of record['prefix_length'], but that
|
20
|
+
# method only becomes available in Ruby 2.5+.
|
21
|
+
record['network'] = format('%s/%d', ip.to_s, record['prefix_length'])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# The autonomous system number associated with the IP address. See
|
26
|
+
# Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
|
27
|
+
# This attribute is only available from the City and Insights web service
|
28
|
+
# and the GeoIP2 Enterprise database.
|
29
|
+
#
|
30
|
+
# @return [Integer, nil]
|
31
|
+
def autonomous_system_number
|
32
|
+
get('autonomous_system_number')
|
33
|
+
end
|
34
|
+
|
35
|
+
# The organization associated with the registered autonomous system number
|
36
|
+
# for the IP address. See
|
37
|
+
# Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
|
38
|
+
# This attribute is only available from the City and Insights web service
|
39
|
+
# and the GeoIP2 Enterprise database.
|
40
|
+
#
|
41
|
+
# @return [String, nil]
|
42
|
+
def autonomous_system_organization
|
43
|
+
get('autonomous_system_organization')
|
44
|
+
end
|
45
|
+
|
46
|
+
# The connection type may take the following values: "Dialup",
|
47
|
+
# "Cable/DSL", "Corporate", "Cellular". Additional values may be added in
|
48
|
+
# the future. This attribute is only available in the GeoIP2 Enterprise
|
49
|
+
# database.
|
50
|
+
#
|
51
|
+
# @return [String, nil]
|
52
|
+
def connection_type
|
53
|
+
get('connection_type')
|
54
|
+
end
|
55
|
+
|
56
|
+
# The second level domain associated with the IP address. This will be
|
57
|
+
# something like "example.com" or "example.co.uk", not "foo.example.com".
|
58
|
+
# This attribute is only available from the City and Insights web service
|
59
|
+
# and the GeoIP2 Enterprise database.
|
60
|
+
#
|
61
|
+
# @return [String, nil]
|
62
|
+
def domain
|
63
|
+
get('domain')
|
64
|
+
end
|
65
|
+
|
66
|
+
# The IP address that the data in the model is for. If you performed a "me"
|
67
|
+
# lookup against the web service, this will be the externally routable IP
|
68
|
+
# address for the system the code is running on. If the system is behind a
|
69
|
+
# NAT, this may differ from the IP address locally assigned to it. This
|
70
|
+
# attribute is returned by all end points.
|
71
|
+
#
|
72
|
+
# @return [String, nil]
|
73
|
+
def ip_address
|
74
|
+
get('ip_address')
|
75
|
+
end
|
76
|
+
|
77
|
+
# This is true if the IP address belongs to any sort of anonymous network.
|
78
|
+
# This property is only available from GeoIP2 Precision Insights.
|
79
|
+
#
|
80
|
+
# @return [Boolean]
|
81
|
+
def anonymous?
|
82
|
+
get('is_anonymous')
|
83
|
+
end
|
84
|
+
|
85
|
+
# This is true if the IP address is registered to an anonymous VPN
|
86
|
+
# provider. If a VPN provider does not register subnets under names
|
87
|
+
# associated with them, we will likely only flag their IP ranges using the
|
88
|
+
# hosting_provider? property. This property is only available from GeoIP2
|
89
|
+
# Precision Insights.
|
90
|
+
#
|
91
|
+
# @return [Boolean]
|
92
|
+
def anonymous_vpn?
|
93
|
+
get('is_anonymous_vpn')
|
94
|
+
end
|
95
|
+
|
96
|
+
# This is true if the IP address belongs to a hosting or VPN provider (see
|
97
|
+
# description of the anonymous_vpn? property). This property is only
|
98
|
+
# available from GeoIP2 Precision Insights.
|
99
|
+
#
|
100
|
+
# @return [Boolean]
|
101
|
+
def hosting_provider?
|
102
|
+
get('is_hosting_provider')
|
103
|
+
end
|
104
|
+
|
105
|
+
# This attribute is true if MaxMind believes this IP address to be a
|
106
|
+
# legitimate proxy, such as an internal VPN used by a corporation. This
|
107
|
+
# attribute is only available in the GeoIP2 Enterprise database.
|
108
|
+
#
|
109
|
+
# @return [Boolean]
|
110
|
+
def legitimate_proxy?
|
111
|
+
get('is_legitimate_proxy')
|
112
|
+
end
|
113
|
+
|
114
|
+
# This is true if the IP address belongs to a public proxy. This property
|
115
|
+
# is only available from GeoIP2 Precision Insights.
|
116
|
+
#
|
117
|
+
# @return [Boolean]
|
118
|
+
def public_proxy?
|
119
|
+
get('is_public_proxy')
|
120
|
+
end
|
121
|
+
|
122
|
+
# This is true if the IP address is on a suspected anonymizing network
|
123
|
+
# and belongs to a residential ISP. This property is only available
|
124
|
+
# from GeoIP2 Precision Insights.
|
125
|
+
#
|
126
|
+
# @return [Boolean]
|
127
|
+
def residential_proxy?
|
128
|
+
get('is_residential_proxy')
|
129
|
+
end
|
130
|
+
|
131
|
+
# This is true if the IP address is a Tor exit node. This property is only
|
132
|
+
# available from GeoIP2 Precision Insights.
|
133
|
+
#
|
134
|
+
# @return [Boolean]
|
135
|
+
def tor_exit_node?
|
136
|
+
get('is_tor_exit_node')
|
137
|
+
end
|
138
|
+
|
139
|
+
# The name of the ISP associated with the IP address. This attribute is
|
140
|
+
# only available from the City and Insights web services and the GeoIP2
|
141
|
+
# Enterprise database.
|
142
|
+
#
|
143
|
+
# @return [String, nil]
|
144
|
+
def isp
|
145
|
+
get('isp')
|
146
|
+
end
|
147
|
+
|
148
|
+
# The network in CIDR notation associated with the record. In particular,
|
149
|
+
# this is the largest network where all of the fields besides ip_address
|
150
|
+
# have the same value.
|
151
|
+
#
|
152
|
+
# @return [String, nil]
|
153
|
+
def network
|
154
|
+
get('network')
|
155
|
+
end
|
156
|
+
|
157
|
+
# The name of the organization associated with the IP address. This
|
158
|
+
# attribute is only available from the City and Insights web services and
|
159
|
+
# the GeoIP2 Enterprise database.
|
160
|
+
#
|
161
|
+
# @return [String, nil]
|
162
|
+
def organization
|
163
|
+
get('organization')
|
164
|
+
end
|
165
|
+
|
166
|
+
# An indicator of how static or dynamic an IP address is. This property is
|
167
|
+
# only available from GeoIP2 Precision Insights.
|
168
|
+
#
|
169
|
+
# @return [Float, nil]
|
170
|
+
def static_ip_score
|
171
|
+
get('static_ip_score')
|
172
|
+
end
|
173
|
+
|
174
|
+
# The estimated number of users sharing the IP/network during the past 24
|
175
|
+
# hours. For IPv4, the count is for the individual IP. For IPv6, the count
|
176
|
+
# is for the /64 network. This property is only available from GeoIP2
|
177
|
+
# Precision Insights.
|
178
|
+
#
|
179
|
+
# @return [Integer, nil]
|
180
|
+
def user_count
|
181
|
+
get('user_count')
|
182
|
+
end
|
183
|
+
|
184
|
+
# The user type associated with the IP address. This can be one of the
|
185
|
+
# following values:
|
186
|
+
#
|
187
|
+
# * business
|
188
|
+
# * cafe
|
189
|
+
# * cellular
|
190
|
+
# * college
|
191
|
+
# * content_delivery_network
|
192
|
+
# * dialup
|
193
|
+
# * government
|
194
|
+
# * hosting
|
195
|
+
# * library
|
196
|
+
# * military
|
197
|
+
# * residential
|
198
|
+
# * router
|
199
|
+
# * school
|
200
|
+
# * search_engine_spider
|
201
|
+
# * traveler
|
202
|
+
#
|
203
|
+
# This attribute is only available from the Insights web service and the
|
204
|
+
# GeoIP2 Enterprise database.
|
205
|
+
#
|
206
|
+
# @return [String, nil]
|
207
|
+
def user_type
|
208
|
+
get('user_type')
|
209
|
+
end
|
20
210
|
end
|
21
211
|
end
|
22
|
-
|
23
|
-
# The autonomous system number associated with the IP address. See
|
24
|
-
# Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
|
25
|
-
# This attribute is only available from the City and Insights web service
|
26
|
-
# and the GeoIP2 Enterprise database.
|
27
|
-
#
|
28
|
-
# @return [Integer, nil]
|
29
|
-
def autonomous_system_number
|
30
|
-
get('autonomous_system_number')
|
31
|
-
end
|
32
|
-
|
33
|
-
# The organization associated with the registered autonomous system number
|
34
|
-
# for the IP address. See
|
35
|
-
# Wikipedia[https://en.wikipedia.org/wiki/Autonomous_system_(Internet)].
|
36
|
-
# This attribute is only available from the City and Insights web service
|
37
|
-
# and the GeoIP2 Enterprise database.
|
38
|
-
#
|
39
|
-
# @return [String, nil]
|
40
|
-
def autonomous_system_organization
|
41
|
-
get('autonomous_system_organization')
|
42
|
-
end
|
43
|
-
|
44
|
-
# The connection type may take the following values: "Dialup",
|
45
|
-
# "Cable/DSL", "Corporate", "Cellular". Additional values may be added in
|
46
|
-
# the future. This attribute is only available in the GeoIP2 Enterprise
|
47
|
-
# database.
|
48
|
-
#
|
49
|
-
# @return [String, nil]
|
50
|
-
def connection_type
|
51
|
-
get('connection_type')
|
52
|
-
end
|
53
|
-
|
54
|
-
# The second level domain associated with the IP address. This will be
|
55
|
-
# something like "example.com" or "example.co.uk", not "foo.example.com".
|
56
|
-
# This attribute is only available from the City and Insights web service
|
57
|
-
# and the GeoIP2 Enterprise database.
|
58
|
-
#
|
59
|
-
# @return [String, nil]
|
60
|
-
def domain
|
61
|
-
get('domain')
|
62
|
-
end
|
63
|
-
|
64
|
-
# The IP address that the data in the model is for. If you performed a "me"
|
65
|
-
# lookup against the web service, this will be the externally routable IP
|
66
|
-
# address for the system the code is running on. If the system is behind a
|
67
|
-
# NAT, this may differ from the IP address locally assigned to it. This
|
68
|
-
# attribute is returned by all end points.
|
69
|
-
#
|
70
|
-
# @return [String]
|
71
|
-
def ip_address
|
72
|
-
get('ip_address')
|
73
|
-
end
|
74
|
-
|
75
|
-
# This is true if the IP address belongs to any sort of anonymous network.
|
76
|
-
# This property is only available from GeoIP2 Precision Insights.
|
77
|
-
#
|
78
|
-
# @return [Boolean]
|
79
|
-
def anonymous?
|
80
|
-
get('is_anonymous')
|
81
|
-
end
|
82
|
-
|
83
|
-
# This is true if the IP address is registered to an anonymous VPN
|
84
|
-
# provider. If a VPN provider does not register subnets under names
|
85
|
-
# associated with them, we will likely only flag their IP ranges using the
|
86
|
-
# hosting_provider? property. This property is only available from GeoIP2
|
87
|
-
# Precision Insights.
|
88
|
-
#
|
89
|
-
# @return [Boolean]
|
90
|
-
def anonymous_vpn?
|
91
|
-
get('is_anonymous_vpn')
|
92
|
-
end
|
93
|
-
|
94
|
-
# This is true if the IP address belongs to a hosting or VPN provider (see
|
95
|
-
# description of the anonymous_vpn? property). This property is only
|
96
|
-
# available from GeoIP2 Precision Insights.
|
97
|
-
#
|
98
|
-
# @return [Boolean]
|
99
|
-
def hosting_provider?
|
100
|
-
get('is_hosting_provider')
|
101
|
-
end
|
102
|
-
|
103
|
-
# This attribute is true if MaxMind believes this IP address to be a
|
104
|
-
# legitimate proxy, such as an internal VPN used by a corporation. This
|
105
|
-
# attribute is only available in the GeoIP2 Enterprise database.
|
106
|
-
#
|
107
|
-
# @return [Boolean]
|
108
|
-
def legitimate_proxy?
|
109
|
-
get('is_legitimate_proxy')
|
110
|
-
end
|
111
|
-
|
112
|
-
# This is true if the IP address belongs to a public proxy. This property
|
113
|
-
# is only available from GeoIP2 Precision Insights.
|
114
|
-
#
|
115
|
-
# @return [Boolean]
|
116
|
-
def public_proxy?
|
117
|
-
get('is_public_proxy')
|
118
|
-
end
|
119
|
-
|
120
|
-
# This is true if the IP address is a Tor exit node. This property is only
|
121
|
-
# available from GeoIP2 Precision Insights.
|
122
|
-
#
|
123
|
-
# @return [Boolean]
|
124
|
-
def tor_exit_node?
|
125
|
-
get('is_tor_exit_node')
|
126
|
-
end
|
127
|
-
|
128
|
-
# The name of the ISP associated with the IP address. This attribute is
|
129
|
-
# only available from the City and Insights web services and the GeoIP2
|
130
|
-
# Enterprise database.
|
131
|
-
#
|
132
|
-
# @return [String, nil]
|
133
|
-
def isp
|
134
|
-
get('isp')
|
135
|
-
end
|
136
|
-
|
137
|
-
# The network in CIDR notation associated with the record. In particular,
|
138
|
-
# this is the largest network where all of the fields besides ip_address
|
139
|
-
# have the same value.
|
140
|
-
#
|
141
|
-
# @return [String]
|
142
|
-
def network
|
143
|
-
get('network')
|
144
|
-
end
|
145
|
-
|
146
|
-
# The name of the organization associated with the IP address. This
|
147
|
-
# attribute is only available from the City and Insights web services and
|
148
|
-
# the GeoIP2 Enterprise database.
|
149
|
-
#
|
150
|
-
# @return [String, nil]
|
151
|
-
def organization
|
152
|
-
get('organization')
|
153
|
-
end
|
154
|
-
|
155
|
-
# An indicator of how static or dynamic an IP address is. This property is
|
156
|
-
# only available from GeoIP2 Precision Insights.
|
157
|
-
#
|
158
|
-
# @return [Float, nil]
|
159
|
-
def static_ip_score
|
160
|
-
get('static_ip_score')
|
161
|
-
end
|
162
|
-
|
163
|
-
# The estimated number of users sharing the IP/network during the past 24
|
164
|
-
# hours. For IPv4, the count is for the individual IP. For IPv6, the count
|
165
|
-
# is for the /64 network. This property is only available from GeoIP2
|
166
|
-
# Precision Insights.
|
167
|
-
#
|
168
|
-
# @return [Integer, nil]
|
169
|
-
def user_count
|
170
|
-
get('user_count')
|
171
|
-
end
|
172
|
-
|
173
|
-
# The user type associated with the IP address. This can be one of the
|
174
|
-
# following values:
|
175
|
-
#
|
176
|
-
# * business
|
177
|
-
# * cafe
|
178
|
-
# * cellular
|
179
|
-
# * college
|
180
|
-
# * content_delivery_network
|
181
|
-
# * dialup
|
182
|
-
# * government
|
183
|
-
# * hosting
|
184
|
-
# * library
|
185
|
-
# * military
|
186
|
-
# * residential
|
187
|
-
# * router
|
188
|
-
# * school
|
189
|
-
# * search_engine_spider
|
190
|
-
# * traveler
|
191
|
-
#
|
192
|
-
# This attribute is only available from the Insights web service and the
|
193
|
-
# GeoIP2 Enterprise database.
|
194
|
-
#
|
195
|
-
# @return [String, nil]
|
196
|
-
def user_type
|
197
|
-
get('user_type')
|
198
|
-
end
|
199
212
|
end
|
200
213
|
end
|