maxmind-geoip2 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +3 -3
  4. data/lib/maxmind/geoip2/client.rb +269 -267
  5. data/lib/maxmind/geoip2/errors.rb +0 -7
  6. data/lib/maxmind/geoip2/model/abstract.rb +19 -15
  7. data/lib/maxmind/geoip2/model/anonymous_ip.rb +54 -50
  8. data/lib/maxmind/geoip2/model/asn.rb +33 -29
  9. data/lib/maxmind/geoip2/model/city.rb +59 -55
  10. data/lib/maxmind/geoip2/model/connection_type.rb +27 -23
  11. data/lib/maxmind/geoip2/model/country.rb +57 -53
  12. data/lib/maxmind/geoip2/model/domain.rb +27 -23
  13. data/lib/maxmind/geoip2/model/enterprise.rb +13 -9
  14. data/lib/maxmind/geoip2/model/insights.rb +12 -8
  15. data/lib/maxmind/geoip2/model/isp.rb +45 -41
  16. data/lib/maxmind/geoip2/reader.rb +242 -240
  17. data/lib/maxmind/geoip2/record/abstract.rb +17 -13
  18. data/lib/maxmind/geoip2/record/city.rb +33 -29
  19. data/lib/maxmind/geoip2/record/continent.rb +32 -28
  20. data/lib/maxmind/geoip2/record/country.rb +47 -43
  21. data/lib/maxmind/geoip2/record/location.rb +64 -60
  22. data/lib/maxmind/geoip2/record/maxmind.rb +14 -10
  23. data/lib/maxmind/geoip2/record/place.rb +22 -18
  24. data/lib/maxmind/geoip2/record/postal.rb +26 -22
  25. data/lib/maxmind/geoip2/record/represented_country.rb +20 -16
  26. data/lib/maxmind/geoip2/record/subdivision.rb +42 -38
  27. data/lib/maxmind/geoip2/record/traits.rb +195 -191
  28. data/maxmind-geoip2.gemspec +1 -1
  29. data/test/data/LICENSE +4 -0
  30. data/test/data/MaxMind-DB-spec.md +570 -0
  31. data/test/data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  32. data/test/data/README.md +4 -0
  33. data/test/data/bad-data/README.md +7 -0
  34. data/test/data/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
  35. data/test/data/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
  36. data/test/data/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +1 -0
  37. data/test/data/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
  38. data/test/data/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
  39. data/test/data/bad-data/maxminddb-golang/invalid-string-length.mmdb +1 -0
  40. data/test/data/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +1 -0
  41. data/test/data/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
  42. data/test/data/perltidyrc +12 -0
  43. data/test/data/source-data/GeoIP2-Anonymous-IP-Test.json +48 -0
  44. data/test/data/source-data/GeoIP2-City-Test.json +12852 -0
  45. data/test/data/source-data/GeoIP2-Connection-Type-Test.json +102 -0
  46. data/test/data/source-data/GeoIP2-Country-Test.json +15916 -0
  47. data/test/data/source-data/GeoIP2-DensityIncome-Test.json +14 -0
  48. data/test/data/source-data/GeoIP2-Domain-Test.json +452 -0
  49. data/test/data/source-data/GeoIP2-Enterprise-Test.json +687 -0
  50. data/test/data/source-data/GeoIP2-ISP-Test.json +12593 -0
  51. data/test/data/source-data/GeoIP2-Precision-Enterprise-Test.json +2061 -0
  52. data/test/data/source-data/GeoIP2-Static-IP-Score-Test.json +2132 -0
  53. data/test/data/source-data/GeoIP2-User-Count-Test.json +2837 -0
  54. data/test/data/source-data/GeoLite2-ASN-Test.json +37 -0
  55. data/test/data/source-data/README +15 -0
  56. data/test/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  57. data/test/data/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  58. data/test/data/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  59. data/test/data/test-data/GeoIP2-City-Test.mmdb +0 -0
  60. data/test/data/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  61. data/test/data/test-data/GeoIP2-Country-Test.mmdb +0 -0
  62. data/test/data/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  63. data/test/data/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  64. data/test/data/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  65. data/test/data/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  66. data/test/data/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  67. data/test/data/test-data/GeoIP2-Static-IP-Score-Test.mmdb +0 -0
  68. data/test/data/test-data/GeoIP2-User-Count-Test.mmdb +0 -0
  69. data/test/data/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  70. data/test/data/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  71. data/test/data/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  72. data/test/data/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  73. data/test/data/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  74. data/test/data/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  75. data/test/data/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  76. data/test/data/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  77. data/test/data/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  78. data/test/data/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  79. data/test/data/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  80. data/test/data/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  81. data/test/data/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  82. data/test/data/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  83. data/test/data/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  84. data/test/data/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  85. data/test/data/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  86. data/test/data/test-data/README.md +26 -0
  87. data/test/data/test-data/maps-with-pointers.raw +0 -0
  88. data/test/data/test-data/write-test-data.pl +641 -0
  89. data/test/data/tidyall.ini +5 -0
  90. metadata +64 -3
@@ -2,27 +2,31 @@
2
2
 
3
3
  require 'maxmind/geoip2/record/abstract'
4
4
 
5
- module MaxMind::GeoIP2::Record
6
- # Location data common to different location types.
7
- class Place < Abstract
8
- # @!visibility private
9
- def initialize(record, locales)
10
- super(record)
11
- @locales = locales
12
- end
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
- # The first available localized name in order of preference.
15
- #
16
- # @return [String, nil]
17
- def name
18
- n = names
19
- return nil if n.nil?
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
- @locales.each do |locale|
22
- return n[locale] if n.key?(locale)
23
- end
23
+ @locales.each do |locale|
24
+ return n[locale] if n.key?(locale)
25
+ end
24
26
 
25
- nil
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::GeoIP2::Record
6
- # Contains data for the postal record associated with an IP address.
7
- #
8
- # This record is returned by all location services and databases besides
9
- # Country.
10
- class Postal < Abstract
11
- # The postal code of the location. Postal codes are not available for all
12
- # countries. In some countries, this will only contain part of the postal
13
- # code. This attribute is returned by all location databases and services
14
- # besides Country.
15
- #
16
- # @return [String, nil]
17
- def code
18
- get('code')
19
- end
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
- # A value from 0-100 indicating MaxMind's confidence that the postal code
22
- # is correct. This attribute is only available from the Insights service
23
- # and the GeoIP2 Enterprise database.
24
- #
25
- # @return [Integer, nil]
26
- def confidence
27
- get('confidence')
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::GeoIP2::Record
6
- # Contains data for the represented country associated with an IP address.
7
- #
8
- # This class contains the country-level data associated with an IP address
9
- # for the IP's represented country. The represented country is the country
10
- # represented by something like a military base.
11
- #
12
- # See {MaxMind::GeoIP2::Record::Country} for inherited methods.
13
- class RepresentedCountry < Country
14
- # A string indicating the type of entity that is representing the country.
15
- # Currently we only return +military+ but this could expand to include
16
- # other types in the future.
17
- #
18
- # @return [String, nil]
19
- def type
20
- get('type')
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::GeoIP2::Record
6
- # Contains data for the subdivisions associated with an IP address.
7
- #
8
- # This record is returned by all location databases and services besides
9
- # Country.
10
- #
11
- # See {MaxMind::GeoIP2::Record::Place} for inherited methods.
12
- class Subdivision < Place
13
- # This is a value from 0-100 indicating MaxMind's confidence that the
14
- # subdivision is correct. This attribute is only available from the
15
- # Insights service and the GeoIP2 Enterprise database.
16
- #
17
- # @return [Integer, nil]
18
- def confidence
19
- get('confidence')
20
- end
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
- # This is a GeoName ID for the subdivision. This attribute is returned by
23
- # all location databases and services besides Country.
24
- #
25
- # @return [Integer, nil]
26
- def geoname_id
27
- get('geoname_id')
28
- end
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
- # This is a string up to three characters long contain the subdivision
31
- # portion of the ISO 3166-2 code. See
32
- # https://en.wikipedia.org/wiki/ISO_3166-2. This attribute is returned by
33
- # all location databases and services except Country.
34
- #
35
- # @return [String, nil]
36
- def iso_code
37
- get('iso_code')
38
- end
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
- # A Hash where the keys are locale codes and the values are names. This attribute is returned by all location services and
41
- # databases besides country.
42
- #
43
- # @return [Hash<String, String>, nil]
44
- def names
45
- get('names')
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,202 @@
3
3
  require 'ipaddr'
4
4
  require 'maxmind/geoip2/record/abstract'
5
5
 
6
- module MaxMind::GeoIP2::Record
7
- # Contains data for the traits record associated with an IP address.
8
- #
9
- # This record is returned by all location services and databases.
10
- class Traits < Abstract
11
- # @!visibility private
12
- def initialize(record)
13
- super(record)
14
- if !record.key?('network') && record.key?('ip_address') &&
15
- record.key?('prefix_length')
16
- ip = IPAddr.new(record['ip_address']).mask(record['prefix_length'])
17
- # We could use ip.prefix instead of record['prefix_length'], but that
18
- # method only becomes available in Ruby 2.5+.
19
- record['network'] = format('%s/%d', ip.to_s, record['prefix_length'])
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.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]
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 a Tor exit node. This property is only
123
+ # available from GeoIP2 Precision Insights.
124
+ #
125
+ # @return [Boolean]
126
+ def tor_exit_node?
127
+ get('is_tor_exit_node')
128
+ end
129
+
130
+ # The name of the ISP associated with the IP address. This attribute is
131
+ # only available from the City and Insights web services and the GeoIP2
132
+ # Enterprise database.
133
+ #
134
+ # @return [String, nil]
135
+ def isp
136
+ get('isp')
137
+ end
138
+
139
+ # The network in CIDR notation associated with the record. In particular,
140
+ # this is the largest network where all of the fields besides ip_address
141
+ # have the same value.
142
+ #
143
+ # @return [String]
144
+ def network
145
+ get('network')
146
+ end
147
+
148
+ # The name of the organization associated with the IP address. This
149
+ # attribute is only available from the City and Insights web services and
150
+ # the GeoIP2 Enterprise database.
151
+ #
152
+ # @return [String, nil]
153
+ def organization
154
+ get('organization')
155
+ end
156
+
157
+ # An indicator of how static or dynamic an IP address is. This property is
158
+ # only available from GeoIP2 Precision Insights.
159
+ #
160
+ # @return [Float, nil]
161
+ def static_ip_score
162
+ get('static_ip_score')
163
+ end
164
+
165
+ # The estimated number of users sharing the IP/network during the past 24
166
+ # hours. For IPv4, the count is for the individual IP. For IPv6, the count
167
+ # is for the /64 network. This property is only available from GeoIP2
168
+ # Precision Insights.
169
+ #
170
+ # @return [Integer, nil]
171
+ def user_count
172
+ get('user_count')
173
+ end
174
+
175
+ # The user type associated with the IP address. This can be one of the
176
+ # following values:
177
+ #
178
+ # * business
179
+ # * cafe
180
+ # * cellular
181
+ # * college
182
+ # * content_delivery_network
183
+ # * dialup
184
+ # * government
185
+ # * hosting
186
+ # * library
187
+ # * military
188
+ # * residential
189
+ # * router
190
+ # * school
191
+ # * search_engine_spider
192
+ # * traveler
193
+ #
194
+ # This attribute is only available from the Insights web service and the
195
+ # GeoIP2 Enterprise database.
196
+ #
197
+ # @return [String, nil]
198
+ def user_type
199
+ get('user_type')
200
+ end
20
201
  end
21
202
  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
203
  end
200
204
  end