maxmind-geoip2 1.5.1 → 1.6.0
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/CHANGELOG.md +8 -0
- data/README.md +15 -15
- data/lib/maxmind/geoip2/client.rb +56 -44
- data/lib/maxmind/geoip2/model/anonymous_plus.rb +1 -0
- data/lib/maxmind/geoip2/model/asn.rb +1 -1
- data/lib/maxmind/geoip2/model/city.rb +3 -3
- data/lib/maxmind/geoip2/model/connection_type.rb +1 -1
- data/lib/maxmind/geoip2/model/country.rb +2 -2
- data/lib/maxmind/geoip2/model/domain.rb +1 -1
- data/lib/maxmind/geoip2/model/enterprise.rb +2 -2
- data/lib/maxmind/geoip2/model/insights.rb +2 -2
- data/lib/maxmind/geoip2/model/isp.rb +1 -1
- data/lib/maxmind/geoip2/reader.rb +21 -21
- data/lib/maxmind/geoip2/record/anonymizer.rb +17 -1
- data/lib/maxmind/geoip2/record/anonymizer_feed.rb +53 -0
- data/lib/maxmind/geoip2/record/city.rb +1 -1
- data/lib/maxmind/geoip2/record/country.rb +1 -1
- data/lib/maxmind/geoip2/record/location.rb +1 -1
- data/lib/maxmind/geoip2/record/postal.rb +1 -1
- data/lib/maxmind/geoip2/record/subdivision.rb +1 -1
- data/lib/maxmind/geoip2/record/traits.rb +5 -6
- data/lib/maxmind/geoip2/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e92b6c665a97ca75e8f8a8481758d9969b09bca5f186d6b54891ffdecd840fcd
|
|
4
|
+
data.tar.gz: c05a9af0e3d2d2520b55da9ac2b3dace158407c810ed6a26db457c2f72d0ad06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a38c006f285a1f5029c9385f4d44fd2e2a15366964eb601ddeff07779598b9ee5b9375e3684c9d66c816591515a8a0baed5bfec47263348c23c94ac0618b8193
|
|
7
|
+
data.tar.gz: a217f1653b3c0acd622d1236b95f221afac74d9b73a65e30c7bff824a4e2cd57b54f99d6669d62f94d7db6c733d0b1f5d4e0b20a25380ef8a74b92097e74a9b7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.0 (2026-07-16)
|
|
4
|
+
|
|
5
|
+
* A new `residential` object has been added to the `anonymizer` object on
|
|
6
|
+
`MaxMind::GeoIP2::Model::Insights`. This object contains residential
|
|
7
|
+
proxy data for the network, including a confidence score, the provider
|
|
8
|
+
name, and the date the network was last seen. This is only available
|
|
9
|
+
from the GeoIP2 Insights web service.
|
|
10
|
+
|
|
3
11
|
## 1.5.1 (2026-01-19)
|
|
4
12
|
|
|
5
13
|
* Re-release with a fix to the release process. This includes a bump of the
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# GeoIP Ruby API
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
|
-
This is the Ruby API for the
|
|
6
|
-
[webservices](https://dev.maxmind.com/geoip/docs/web-services
|
|
7
|
-
and [databases](https://dev.maxmind.com/geoip/docs/databases
|
|
5
|
+
This is the Ruby API for the GeoIP and GeoLite
|
|
6
|
+
[webservices](https://dev.maxmind.com/geoip/docs/web-services/?lang=en)
|
|
7
|
+
and [databases](https://dev.maxmind.com/geoip/docs/databases/?lang=en).
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ gem install maxmind-geoip2
|
|
|
15
15
|
## IP Geolocation Usage
|
|
16
16
|
|
|
17
17
|
IP geolocation is inherently imprecise. Locations are often near the center
|
|
18
|
-
of the population. Any location provided by a
|
|
18
|
+
of the population. Any location provided by a GeoIP database or web
|
|
19
19
|
service should not be used to identify a particular address or household.
|
|
20
20
|
|
|
21
21
|
## Database Reader
|
|
@@ -217,7 +217,7 @@ puts record.organization # University of Minnesota
|
|
|
217
217
|
### Usage
|
|
218
218
|
|
|
219
219
|
To use this API, you must create a new `MaxMind::GeoIP2::Client` object
|
|
220
|
-
with your account ID and license key. To use the
|
|
220
|
+
with your account ID and license key. To use the GeoLite web service, you
|
|
221
221
|
may also set the `host` parameter to `geolite.info`. You may then you call
|
|
222
222
|
the method corresponding to a specific end point, passing it the IP address
|
|
223
223
|
you want to look up.
|
|
@@ -243,18 +243,18 @@ client = MaxMind::GeoIP2::Client.new(
|
|
|
243
243
|
account_id: 42,
|
|
244
244
|
license_key: 'license_key',
|
|
245
245
|
|
|
246
|
-
# To use the
|
|
246
|
+
# To use the GeoLite web service instead of the GeoIP web service, set
|
|
247
247
|
# the host parameter to "geolite.info":
|
|
248
248
|
# host: 'geolite.info',
|
|
249
249
|
|
|
250
|
-
# To use the Sandbox
|
|
250
|
+
# To use the Sandbox GeoIP web service instead of the production GeoIP
|
|
251
251
|
# web service, set the host parameter to "sandbox.maxmind.com":
|
|
252
252
|
# host: 'sandbox.maxmind.com',
|
|
253
253
|
)
|
|
254
254
|
|
|
255
255
|
# Replace "city" with the method corresponding to the web service that
|
|
256
256
|
# you are using, e.g., "country", "insights". Please note that Insights
|
|
257
|
-
# is only supported by the
|
|
257
|
+
# is only supported by the GeoIP web service and not the GeoLite web
|
|
258
258
|
# service.
|
|
259
259
|
record = client.city('128.101.101.101')
|
|
260
260
|
|
|
@@ -299,8 +299,8 @@ which can be populated vary between end points. In addition, while an end
|
|
|
299
299
|
point may offer a particular piece of data, MaxMind does not always have
|
|
300
300
|
every piece of data for any given IP address.
|
|
301
301
|
|
|
302
|
-
See the [
|
|
303
|
-
documentation](https://dev.maxmind.com/geoip/docs/web-services
|
|
302
|
+
See the [GeoIP web service
|
|
303
|
+
documentation](https://dev.maxmind.com/geoip/docs/web-services/?lang=en) for details on
|
|
304
304
|
what data each end point may return.
|
|
305
305
|
|
|
306
306
|
The only piece of data which is always returned is the `ip_address`
|
|
@@ -313,7 +313,7 @@ databases with data on geographical features around the world, including
|
|
|
313
313
|
populated places. They offer both free and paid premium data. Each feature
|
|
314
314
|
is unique identified by a `geoname_id`, which is an integer.
|
|
315
315
|
|
|
316
|
-
Many of the records returned by the
|
|
316
|
+
Many of the records returned by the GeoIP web services and databases
|
|
317
317
|
include a `geoname_id` property. This is the ID of a geographical feature
|
|
318
318
|
(city, region, country, etc.) in the GeoNames database.
|
|
319
319
|
|
|
@@ -324,7 +324,7 @@ GeoNames premium data set.
|
|
|
324
324
|
## Reporting data problems
|
|
325
325
|
|
|
326
326
|
If the problem you find is that an IP address is incorrectly mapped, please
|
|
327
|
-
[submit your correction to MaxMind](https://www.maxmind.com/en/correction).
|
|
327
|
+
[submit your correction to MaxMind](https://www.maxmind.com/en/geoip-data-correction-request).
|
|
328
328
|
|
|
329
329
|
If you find some other sort of mistake, like an incorrect spelling, please
|
|
330
330
|
check the [GeoNames site](https://www.geonames.org/) first. Once you've
|
|
@@ -335,7 +335,7 @@ will be automatically incorporated into future MaxMind releases.
|
|
|
335
335
|
|
|
336
336
|
If you are a paying MaxMind customer and you're not sure where to submit a
|
|
337
337
|
correction, please [contact MaxMind
|
|
338
|
-
support](https://
|
|
338
|
+
support](https://support.maxmind.com/knowledge-base) for help.
|
|
339
339
|
|
|
340
340
|
## Support
|
|
341
341
|
|
|
@@ -343,7 +343,7 @@ Please report all issues with this code using the [GitHub issue
|
|
|
343
343
|
tracker](https://github.com/maxmind/GeoIP2-ruby/issues).
|
|
344
344
|
|
|
345
345
|
If you are having an issue with a MaxMind service that is not specific to the
|
|
346
|
-
client API, please see [our support page](https://
|
|
346
|
+
client API, please see [our support page](https://support.maxmind.com/knowledge-base).
|
|
347
347
|
|
|
348
348
|
## Requirements
|
|
349
349
|
|
|
@@ -13,7 +13,7 @@ require 'resolv'
|
|
|
13
13
|
module MaxMind
|
|
14
14
|
module GeoIP2
|
|
15
15
|
# This class provides a client API for all the
|
|
16
|
-
# {https://dev.maxmind.com/geoip/docs/web-services
|
|
16
|
+
# {https://dev.maxmind.com/geoip/docs/web-services/?lang=en GeoIP web
|
|
17
17
|
# services}. The services are Country, City Plus, and Insights. Each service
|
|
18
18
|
# returns a different set of data about an IP address, with Country returning
|
|
19
19
|
# the least data and Insights the most.
|
|
@@ -60,7 +60,7 @@ module MaxMind
|
|
|
60
60
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
61
61
|
# rubocop:disable Metrics/PerceivedComplexity
|
|
62
62
|
|
|
63
|
-
# Create a Client that may be used to query a
|
|
63
|
+
# Create a Client that may be used to query a GeoIP web service.
|
|
64
64
|
#
|
|
65
65
|
# Once created, the Client is safe to use for lookups from multiple
|
|
66
66
|
# threads.
|
|
@@ -73,8 +73,8 @@ module MaxMind
|
|
|
73
73
|
# property from most preferred to least preferred.
|
|
74
74
|
#
|
|
75
75
|
# @param host [String] the host to use when querying the web service. Set
|
|
76
|
-
# this to "geolite.info" to use the
|
|
77
|
-
#
|
|
76
|
+
# this to "geolite.info" to use the GeoLite web service instead of the
|
|
77
|
+
# GeoIP web service. Set this to "sandbox.maxmind.com" to use the
|
|
78
78
|
# Sandbox environment. The sandbox allows you to experiment with the
|
|
79
79
|
# API without affecting your production data.
|
|
80
80
|
#
|
|
@@ -132,26 +132,30 @@ module MaxMind
|
|
|
132
132
|
#
|
|
133
133
|
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
|
134
134
|
#
|
|
135
|
-
# @raise [HTTPError] if there was a problem with the HTTP
|
|
136
|
-
# an unexpected HTTP status code.
|
|
135
|
+
# @raise [MaxMind::GeoIP2::HTTPError] if there was a problem with the HTTP
|
|
136
|
+
# response, such as an unexpected HTTP status code.
|
|
137
137
|
#
|
|
138
|
-
# @raise [AddressInvalidError] if the web service believes
|
|
139
|
-
# to be invalid or missing.
|
|
138
|
+
# @raise [MaxMind::GeoIP2::AddressInvalidError] if the web service believes
|
|
139
|
+
# the IP address to be invalid or missing.
|
|
140
140
|
#
|
|
141
|
-
# @raise [AddressNotFoundError] if the IP address was not
|
|
141
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address was not
|
|
142
|
+
# found.
|
|
142
143
|
#
|
|
143
|
-
# @raise [AddressReservedError] if the IP address is
|
|
144
|
+
# @raise [MaxMind::GeoIP2::AddressReservedError] if the IP address is
|
|
145
|
+
# reserved.
|
|
144
146
|
#
|
|
145
|
-
# @raise [AuthenticationError] if there was a problem
|
|
146
|
-
# web service, such as an invalid or missing
|
|
147
|
+
# @raise [MaxMind::GeoIP2::AuthenticationError] if there was a problem
|
|
148
|
+
# authenticating to the web service, such as an invalid or missing
|
|
149
|
+
# license key.
|
|
147
150
|
#
|
|
148
|
-
# @raise [InsufficientFundsError] if your account is out
|
|
151
|
+
# @raise [MaxMind::GeoIP2::InsufficientFundsError] if your account is out
|
|
152
|
+
# of credit.
|
|
149
153
|
#
|
|
150
|
-
# @raise [PermissionRequiredError] if your account does
|
|
151
|
-
# to use the web service.
|
|
154
|
+
# @raise [MaxMind::GeoIP2::PermissionRequiredError] if your account does
|
|
155
|
+
# not have permission to use the web service.
|
|
152
156
|
#
|
|
153
|
-
# @raise [InvalidRequestError] if the web service
|
|
154
|
-
# and there is no more specific error to raise.
|
|
157
|
+
# @raise [MaxMind::GeoIP2::InvalidRequestError] if the web service
|
|
158
|
+
# responded with an error and there is no more specific error to raise.
|
|
155
159
|
#
|
|
156
160
|
# @return [MaxMind::GeoIP2::Model::City]
|
|
157
161
|
def city(ip_address = 'me')
|
|
@@ -169,26 +173,30 @@ module MaxMind
|
|
|
169
173
|
#
|
|
170
174
|
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
|
171
175
|
#
|
|
172
|
-
# @raise [HTTPError] if there was a problem with the HTTP
|
|
173
|
-
# an unexpected HTTP status code.
|
|
176
|
+
# @raise [MaxMind::GeoIP2::HTTPError] if there was a problem with the HTTP
|
|
177
|
+
# response, such as an unexpected HTTP status code.
|
|
174
178
|
#
|
|
175
|
-
# @raise [AddressInvalidError] if the web service believes
|
|
176
|
-
# to be invalid or missing.
|
|
179
|
+
# @raise [MaxMind::GeoIP2::AddressInvalidError] if the web service believes
|
|
180
|
+
# the IP address to be invalid or missing.
|
|
177
181
|
#
|
|
178
|
-
# @raise [AddressNotFoundError] if the IP address was not
|
|
182
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address was not
|
|
183
|
+
# found.
|
|
179
184
|
#
|
|
180
|
-
# @raise [AddressReservedError] if the IP address is
|
|
185
|
+
# @raise [MaxMind::GeoIP2::AddressReservedError] if the IP address is
|
|
186
|
+
# reserved.
|
|
181
187
|
#
|
|
182
|
-
# @raise [AuthenticationError] if there was a problem
|
|
183
|
-
# web service, such as an invalid or missing
|
|
188
|
+
# @raise [MaxMind::GeoIP2::AuthenticationError] if there was a problem
|
|
189
|
+
# authenticating to the web service, such as an invalid or missing
|
|
190
|
+
# license key.
|
|
184
191
|
#
|
|
185
|
-
# @raise [InsufficientFundsError] if your account is out
|
|
192
|
+
# @raise [MaxMind::GeoIP2::InsufficientFundsError] if your account is out
|
|
193
|
+
# of credit.
|
|
186
194
|
#
|
|
187
|
-
# @raise [PermissionRequiredError] if your account does
|
|
188
|
-
# to use the web service.
|
|
195
|
+
# @raise [MaxMind::GeoIP2::PermissionRequiredError] if your account does
|
|
196
|
+
# not have permission to use the web service.
|
|
189
197
|
#
|
|
190
|
-
# @raise [InvalidRequestError] if the web service
|
|
191
|
-
# and there is no more specific error to raise.
|
|
198
|
+
# @raise [MaxMind::GeoIP2::InvalidRequestError] if the web service
|
|
199
|
+
# responded with an error and there is no more specific error to raise.
|
|
192
200
|
#
|
|
193
201
|
# @return [MaxMind::GeoIP2::Model::Country]
|
|
194
202
|
def country(ip_address = 'me')
|
|
@@ -197,7 +205,7 @@ module MaxMind
|
|
|
197
205
|
|
|
198
206
|
# This method calls the Insights web service.
|
|
199
207
|
#
|
|
200
|
-
# Insights is only supported by the
|
|
208
|
+
# Insights is only supported by the GeoIP web service. The GeoLite web
|
|
201
209
|
# service does not support it.
|
|
202
210
|
#
|
|
203
211
|
# @param ip_address [String] IPv4 or IPv6 address as a string. If no
|
|
@@ -209,26 +217,30 @@ module MaxMind
|
|
|
209
217
|
#
|
|
210
218
|
# @raise [JSON::ParserError] if there was invalid JSON in the response.
|
|
211
219
|
#
|
|
212
|
-
# @raise [HTTPError] if there was a problem with the HTTP
|
|
213
|
-
# an unexpected HTTP status code.
|
|
220
|
+
# @raise [MaxMind::GeoIP2::HTTPError] if there was a problem with the HTTP
|
|
221
|
+
# response, such as an unexpected HTTP status code.
|
|
214
222
|
#
|
|
215
|
-
# @raise [AddressInvalidError] if the web service believes
|
|
216
|
-
# to be invalid or missing.
|
|
223
|
+
# @raise [MaxMind::GeoIP2::AddressInvalidError] if the web service believes
|
|
224
|
+
# the IP address to be invalid or missing.
|
|
217
225
|
#
|
|
218
|
-
# @raise [AddressNotFoundError] if the IP address was not
|
|
226
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address was not
|
|
227
|
+
# found.
|
|
219
228
|
#
|
|
220
|
-
# @raise [AddressReservedError] if the IP address is
|
|
229
|
+
# @raise [MaxMind::GeoIP2::AddressReservedError] if the IP address is
|
|
230
|
+
# reserved.
|
|
221
231
|
#
|
|
222
|
-
# @raise [AuthenticationError] if there was a problem
|
|
223
|
-
# web service, such as an invalid or missing
|
|
232
|
+
# @raise [MaxMind::GeoIP2::AuthenticationError] if there was a problem
|
|
233
|
+
# authenticating to the web service, such as an invalid or missing
|
|
234
|
+
# license key.
|
|
224
235
|
#
|
|
225
|
-
# @raise [InsufficientFundsError] if your account is out
|
|
236
|
+
# @raise [MaxMind::GeoIP2::InsufficientFundsError] if your account is out
|
|
237
|
+
# of credit.
|
|
226
238
|
#
|
|
227
|
-
# @raise [PermissionRequiredError] if your account does
|
|
228
|
-
# to use the web service.
|
|
239
|
+
# @raise [MaxMind::GeoIP2::PermissionRequiredError] if your account does
|
|
240
|
+
# not have permission to use the web service.
|
|
229
241
|
#
|
|
230
|
-
# @raise [InvalidRequestError] if the web service
|
|
231
|
-
# and there is no more specific error to raise.
|
|
242
|
+
# @raise [MaxMind::GeoIP2::InvalidRequestError] if the web service
|
|
243
|
+
# responded with an error and there is no more specific error to raise.
|
|
232
244
|
#
|
|
233
245
|
# @return [MaxMind::GeoIP2::Model::Insights]
|
|
234
246
|
def insights(ip_address = 'me')
|
|
@@ -5,7 +5,7 @@ require 'maxmind/geoip2/model/abstract'
|
|
|
5
5
|
module MaxMind
|
|
6
6
|
module GeoIP2
|
|
7
7
|
module Model
|
|
8
|
-
# Model class for the
|
|
8
|
+
# Model class for the GeoLite ASN database.
|
|
9
9
|
class ASN < Abstract
|
|
10
10
|
# The autonomous system number associated with the IP address.
|
|
11
11
|
#
|
|
@@ -9,10 +9,10 @@ require 'maxmind/geoip2/record/subdivision'
|
|
|
9
9
|
module MaxMind
|
|
10
10
|
module GeoIP2
|
|
11
11
|
module Model
|
|
12
|
-
# Model class for the data returned by the
|
|
13
|
-
# and the City database. It is also used for
|
|
12
|
+
# Model class for the data returned by the GeoIP City Plus web service
|
|
13
|
+
# and the City database. It is also used for GeoLite City lookups.
|
|
14
14
|
#
|
|
15
|
-
# See https://dev.maxmind.com/geoip/docs/web-services
|
|
15
|
+
# See https://dev.maxmind.com/geoip/docs/web-services/?lang=en for more
|
|
16
16
|
# details.
|
|
17
17
|
#
|
|
18
18
|
# See {MaxMind::GeoIP2::Model::Country} for inherited methods.
|
|
@@ -5,7 +5,7 @@ require 'maxmind/geoip2/model/abstract'
|
|
|
5
5
|
module MaxMind
|
|
6
6
|
module GeoIP2
|
|
7
7
|
module Model
|
|
8
|
-
# Model class for the
|
|
8
|
+
# Model class for the GeoIP Connection Type database.
|
|
9
9
|
class ConnectionType < Abstract
|
|
10
10
|
# The connection type may take the following values: "Dialup",
|
|
11
11
|
# "Cable/DSL", "Corporate", "Cellular", and "Satellite". Additional
|
|
@@ -9,8 +9,8 @@ require 'maxmind/geoip2/record/traits'
|
|
|
9
9
|
module MaxMind
|
|
10
10
|
module GeoIP2
|
|
11
11
|
module Model
|
|
12
|
-
# Model class for the data returned by the
|
|
13
|
-
# database. It is also used for
|
|
12
|
+
# Model class for the data returned by the GeoIP Country web service and
|
|
13
|
+
# database. It is also used for GeoLite Country lookups.
|
|
14
14
|
class Country
|
|
15
15
|
# Continent data for the IP address.
|
|
16
16
|
#
|
|
@@ -5,7 +5,7 @@ require 'maxmind/geoip2/model/abstract'
|
|
|
5
5
|
module MaxMind
|
|
6
6
|
module GeoIP2
|
|
7
7
|
module Model
|
|
8
|
-
# Model class for the
|
|
8
|
+
# Model class for the GeoIP Domain database.
|
|
9
9
|
class Domain < Abstract
|
|
10
10
|
# The second level domain associated with the IP address. This will be
|
|
11
11
|
# something like "example.com" or "example.co.uk", not "foo.example.com".
|
|
@@ -5,9 +5,9 @@ require 'maxmind/geoip2/model/city'
|
|
|
5
5
|
module MaxMind
|
|
6
6
|
module GeoIP2
|
|
7
7
|
module Model
|
|
8
|
-
# Model class for the data returned by
|
|
8
|
+
# Model class for the data returned by GeoIP Enterprise database lookups.
|
|
9
9
|
#
|
|
10
|
-
# See https://dev.maxmind.com/geoip/docs/web-services
|
|
10
|
+
# See https://dev.maxmind.com/geoip/docs/web-services/?lang=en for more
|
|
11
11
|
# details.
|
|
12
12
|
#
|
|
13
13
|
# See {MaxMind::GeoIP2::Model::City} for inherited methods.
|
|
@@ -6,9 +6,9 @@ require 'maxmind/geoip2/record/anonymizer'
|
|
|
6
6
|
module MaxMind
|
|
7
7
|
module GeoIP2
|
|
8
8
|
module Model
|
|
9
|
-
# Model class for the data returned by the
|
|
9
|
+
# Model class for the data returned by the GeoIP Insights web service.
|
|
10
10
|
#
|
|
11
|
-
# See https://dev.maxmind.com/geoip/docs/web-services
|
|
11
|
+
# See https://dev.maxmind.com/geoip/docs/web-services/?lang=en for more
|
|
12
12
|
# details.
|
|
13
13
|
class Insights < City
|
|
14
14
|
# Data indicating whether the IP address is part of an anonymizing
|
|
@@ -5,7 +5,7 @@ require 'maxmind/geoip2/model/abstract'
|
|
|
5
5
|
module MaxMind
|
|
6
6
|
module GeoIP2
|
|
7
7
|
module Model
|
|
8
|
-
# Model class for the
|
|
8
|
+
# Model class for the GeoIP ISP database.
|
|
9
9
|
class ISP < Abstract
|
|
10
10
|
# The autonomous system number associated with the IP address.
|
|
11
11
|
#
|
|
@@ -14,7 +14,7 @@ require 'maxmind/geoip2/model/isp'
|
|
|
14
14
|
|
|
15
15
|
module MaxMind
|
|
16
16
|
module GeoIP2
|
|
17
|
-
# Reader is a reader for the
|
|
17
|
+
# Reader is a reader for the GeoIP/GeoLite database format. IP addresses
|
|
18
18
|
# can be looked up using the database specific methods.
|
|
19
19
|
#
|
|
20
20
|
# == Example
|
|
@@ -31,7 +31,7 @@ module MaxMind
|
|
|
31
31
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
32
32
|
# rubocop:disable Metrics/PerceivedComplexity
|
|
33
33
|
|
|
34
|
-
# Create a Reader for looking up IP addresses in a
|
|
34
|
+
# Create a Reader for looking up IP addresses in a GeoIP/GeoLite database
|
|
35
35
|
# file.
|
|
36
36
|
#
|
|
37
37
|
# If you're performing multiple lookups, it's most efficient to create one
|
|
@@ -41,7 +41,7 @@ module MaxMind
|
|
|
41
41
|
# threads. It is safe to use after forking.
|
|
42
42
|
#
|
|
43
43
|
# @overload initialize(database:, locales: ['en'], mode: MaxMind::DB::MODE_AUTO)
|
|
44
|
-
# @param database [String] a path to a
|
|
44
|
+
# @param database [String] a path to a GeoIP/GeoLite database file.
|
|
45
45
|
# @param locales [Array<String>] a list of locale codes to use in the name
|
|
46
46
|
# property from most preferred to least preferred.
|
|
47
47
|
# @param mode [Symbol] Defines how to open the database. It may be one of
|
|
@@ -97,8 +97,8 @@ module MaxMind
|
|
|
97
97
|
# @raise [ArgumentError] if used against a non-Anonymous IP database or if
|
|
98
98
|
# you attempt to look up an IPv6 address in an IPv4 only database.
|
|
99
99
|
#
|
|
100
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
101
|
-
# database.
|
|
100
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
101
|
+
# found in the database.
|
|
102
102
|
#
|
|
103
103
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
104
104
|
# corrupt.
|
|
@@ -121,8 +121,8 @@ module MaxMind
|
|
|
121
121
|
# @raise [ArgumentError] if used against a non-Anonymous Plus database
|
|
122
122
|
# or if you attempt to look up an IPv6 address in an IPv4 only database.
|
|
123
123
|
#
|
|
124
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
125
|
-
# database.
|
|
124
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
125
|
+
# found in the database.
|
|
126
126
|
#
|
|
127
127
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
128
128
|
# corrupt.
|
|
@@ -145,8 +145,8 @@ module MaxMind
|
|
|
145
145
|
# @raise [ArgumentError] if used against a non-ASN database or if you
|
|
146
146
|
# attempt to look up an IPv6 address in an IPv4 only database.
|
|
147
147
|
#
|
|
148
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
149
|
-
# database.
|
|
148
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
149
|
+
# found in the database.
|
|
150
150
|
#
|
|
151
151
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
152
152
|
# corrupt.
|
|
@@ -164,8 +164,8 @@ module MaxMind
|
|
|
164
164
|
# @raise [ArgumentError] if used against a non-City database or if you
|
|
165
165
|
# attempt to look up an IPv6 address in an IPv4 only database.
|
|
166
166
|
#
|
|
167
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
168
|
-
# database.
|
|
167
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
168
|
+
# found in the database.
|
|
169
169
|
#
|
|
170
170
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
171
171
|
# corrupt.
|
|
@@ -183,8 +183,8 @@ module MaxMind
|
|
|
183
183
|
# @raise [ArgumentError] if used against a non-Connection Type database or if
|
|
184
184
|
# you attempt to look up an IPv6 address in an IPv4 only database.
|
|
185
185
|
#
|
|
186
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
187
|
-
# database.
|
|
186
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
187
|
+
# found in the database.
|
|
188
188
|
#
|
|
189
189
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
190
190
|
# corrupt.
|
|
@@ -207,8 +207,8 @@ module MaxMind
|
|
|
207
207
|
# @raise [ArgumentError] if used against a non-Country database or if you
|
|
208
208
|
# attempt to look up an IPv6 address in an IPv4 only database.
|
|
209
209
|
#
|
|
210
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
211
|
-
# database.
|
|
210
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
211
|
+
# found in the database.
|
|
212
212
|
#
|
|
213
213
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
214
214
|
# corrupt.
|
|
@@ -226,8 +226,8 @@ module MaxMind
|
|
|
226
226
|
# @raise [ArgumentError] if used against a non-Domain database or if you
|
|
227
227
|
# attempt to look up an IPv6 address in an IPv4 only database.
|
|
228
228
|
#
|
|
229
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
230
|
-
# database.
|
|
229
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
230
|
+
# found in the database.
|
|
231
231
|
#
|
|
232
232
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
233
233
|
# corrupt.
|
|
@@ -245,8 +245,8 @@ module MaxMind
|
|
|
245
245
|
# @raise [ArgumentError] if used against a non-Enterprise database or if
|
|
246
246
|
# you attempt to look up an IPv6 address in an IPv4 only database.
|
|
247
247
|
#
|
|
248
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
249
|
-
# database.
|
|
248
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
249
|
+
# found in the database.
|
|
250
250
|
#
|
|
251
251
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
252
252
|
# corrupt.
|
|
@@ -264,8 +264,8 @@ module MaxMind
|
|
|
264
264
|
# @raise [ArgumentError] if used against a non-ISP database or if you
|
|
265
265
|
# attempt to look up an IPv6 address in an IPv4 only database.
|
|
266
266
|
#
|
|
267
|
-
# @raise [AddressNotFoundError] if the IP address is not
|
|
268
|
-
# database.
|
|
267
|
+
# @raise [MaxMind::GeoIP2::AddressNotFoundError] if the IP address is not
|
|
268
|
+
# found in the database.
|
|
269
269
|
#
|
|
270
270
|
# @raise [MaxMind::DB::InvalidDatabaseError] if the database appears
|
|
271
271
|
# corrupt.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'date'
|
|
4
4
|
require 'maxmind/geoip2/record/abstract'
|
|
5
|
+
require 'maxmind/geoip2/record/anonymizer_feed'
|
|
5
6
|
|
|
6
7
|
module MaxMind
|
|
7
8
|
module GeoIP2
|
|
@@ -11,6 +12,20 @@ module MaxMind
|
|
|
11
12
|
#
|
|
12
13
|
# This record is returned by the Insights web service.
|
|
13
14
|
class Anonymizer < Abstract
|
|
15
|
+
# Residential proxy data for the network. This may be populated even
|
|
16
|
+
# when no other anonymizer attributes are set. This property is only
|
|
17
|
+
# available from Insights.
|
|
18
|
+
#
|
|
19
|
+
# @return [MaxMind::GeoIP2::Record::AnonymizerFeed]
|
|
20
|
+
attr_reader :residential
|
|
21
|
+
|
|
22
|
+
# @!visibility private
|
|
23
|
+
def initialize(record)
|
|
24
|
+
super
|
|
25
|
+
|
|
26
|
+
@residential = AnonymizerFeed.new(record.nil? ? nil : record['residential'])
|
|
27
|
+
end
|
|
28
|
+
|
|
14
29
|
# A score ranging from 1 to 99 that represents our percent confidence
|
|
15
30
|
# that the network is currently part of an actively used VPN service.
|
|
16
31
|
# This property is only available from Insights.
|
|
@@ -85,13 +100,14 @@ module MaxMind
|
|
|
85
100
|
date_string = get('network_last_seen')
|
|
86
101
|
|
|
87
102
|
if !date_string
|
|
103
|
+
@network_last_seen = nil
|
|
88
104
|
return nil
|
|
89
105
|
end
|
|
90
106
|
|
|
91
107
|
@network_last_seen = Date.parse(date_string)
|
|
92
108
|
end
|
|
93
109
|
|
|
94
|
-
# The name of the VPN provider (e.g.,
|
|
110
|
+
# The name of the VPN provider (e.g., nordvpn, surfshark)
|
|
95
111
|
# associated with the network. This property is only available from
|
|
96
112
|
# Insights.
|
|
97
113
|
#
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'date'
|
|
4
|
+
require 'maxmind/geoip2/record/abstract'
|
|
5
|
+
|
|
6
|
+
module MaxMind
|
|
7
|
+
module GeoIP2
|
|
8
|
+
module Record
|
|
9
|
+
# Contains data for one type of anonymizer detection, currently
|
|
10
|
+
# residential proxies. Additional feeds may be added in the future.
|
|
11
|
+
#
|
|
12
|
+
# This record is returned by the anonymizer object of the Insights web
|
|
13
|
+
# service.
|
|
14
|
+
class AnonymizerFeed < Abstract
|
|
15
|
+
# A score ranging from 1 to 99 that represents our percent confidence
|
|
16
|
+
# that the network is currently part of this anonymizer feed. This
|
|
17
|
+
# property is only available from Insights.
|
|
18
|
+
#
|
|
19
|
+
# @return [Integer, nil]
|
|
20
|
+
def confidence
|
|
21
|
+
get('confidence')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# The last day that the network was sighted in our analysis of this
|
|
25
|
+
# anonymizer feed. This value is parsed lazily. This property is only
|
|
26
|
+
# available from Insights.
|
|
27
|
+
#
|
|
28
|
+
# @return [Date, nil] A Date object representing the last seen date,
|
|
29
|
+
# or nil if the date is not available.
|
|
30
|
+
def network_last_seen
|
|
31
|
+
return @network_last_seen if defined?(@network_last_seen)
|
|
32
|
+
|
|
33
|
+
date_string = get('network_last_seen')
|
|
34
|
+
|
|
35
|
+
if !date_string
|
|
36
|
+
@network_last_seen = nil
|
|
37
|
+
return nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
@network_last_seen = Date.parse(date_string)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# The name of the provider associated with the network in this
|
|
44
|
+
# anonymizer feed. This property is only available from Insights.
|
|
45
|
+
#
|
|
46
|
+
# @return [String, nil]
|
|
47
|
+
def provider_name
|
|
48
|
+
get('provider_name')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -14,7 +14,7 @@ module MaxMind
|
|
|
14
14
|
class City < Place
|
|
15
15
|
# A value from 0-100 indicating MaxMind's confidence that the city is
|
|
16
16
|
# correct. This attribute is only available from the Insights service and
|
|
17
|
-
# the
|
|
17
|
+
# the GeoIP Enterprise database.
|
|
18
18
|
#
|
|
19
19
|
# @return [Integer, nil]
|
|
20
20
|
def confidence
|
|
@@ -13,7 +13,7 @@ module MaxMind
|
|
|
13
13
|
class Country < Place
|
|
14
14
|
# A value from 0-100 indicating MaxMind's confidence that the country is
|
|
15
15
|
# correct. This attribute is only available from the Insights service and
|
|
16
|
-
# the
|
|
16
|
+
# the GeoIP Enterprise database.
|
|
17
17
|
#
|
|
18
18
|
# @return [Integer, nil]
|
|
19
19
|
def confidence
|
|
@@ -63,7 +63,7 @@ module MaxMind
|
|
|
63
63
|
get('population_density')
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
# The time zone associated with location, as specified by the IANA Time
|
|
66
|
+
# The time zone associated with the location, as specified by the IANA Time
|
|
67
67
|
# Zone Database, e.g., "America/New_York". See
|
|
68
68
|
# https://www.iana.org/time-zones.
|
|
69
69
|
#
|
|
@@ -22,7 +22,7 @@ module MaxMind
|
|
|
22
22
|
|
|
23
23
|
# A value from 0-100 indicating MaxMind's confidence that the postal code
|
|
24
24
|
# is correct. This attribute is only available from the Insights service
|
|
25
|
-
# and the
|
|
25
|
+
# and the GeoIP Enterprise database.
|
|
26
26
|
#
|
|
27
27
|
# @return [Integer, nil]
|
|
28
28
|
def confidence
|
|
@@ -14,7 +14,7 @@ module MaxMind
|
|
|
14
14
|
class Subdivision < Place
|
|
15
15
|
# This is a value from 0-100 indicating MaxMind's confidence that the
|
|
16
16
|
# subdivision is correct. This attribute is only available from the
|
|
17
|
-
# Insights service and the
|
|
17
|
+
# Insights service and the GeoIP Enterprise database.
|
|
18
18
|
#
|
|
19
19
|
# @return [Integer, nil]
|
|
20
20
|
def confidence
|
|
@@ -41,9 +41,9 @@ module MaxMind
|
|
|
41
41
|
get('autonomous_system_organization')
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
# The connection type may take the following
|
|
45
|
-
# "
|
|
46
|
-
#
|
|
44
|
+
# The connection type may take the following values: "Cable/DSL",
|
|
45
|
+
# "Corporate", "Cellular", and "Satellite". Additional values may be
|
|
46
|
+
# added in the future. This attribute is only available
|
|
47
47
|
# from the City Plus and Insights web services and the Enterprise
|
|
48
48
|
# database.
|
|
49
49
|
#
|
|
@@ -52,7 +52,7 @@ module MaxMind
|
|
|
52
52
|
get('connection_type')
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
# The second
|
|
55
|
+
# The second-level domain associated with the IP address. This will be
|
|
56
56
|
# something like "example.com" or "example.co.uk", not "foo.example.com".
|
|
57
57
|
# This attribute is only available from the City Plus and Insights web
|
|
58
58
|
# services and the Enterprise database.
|
|
@@ -103,7 +103,7 @@ module MaxMind
|
|
|
103
103
|
# {https://en.wikipedia.org/wiki/Anycast anycast network}.
|
|
104
104
|
#
|
|
105
105
|
# This property is only available from the Country, City Plus, and
|
|
106
|
-
# Insights web services and the
|
|
106
|
+
# Insights web services and the GeoIP Country, City, and Enterprise
|
|
107
107
|
# databases.
|
|
108
108
|
#
|
|
109
109
|
# @return [Boolean]
|
|
@@ -266,7 +266,6 @@ module MaxMind
|
|
|
266
266
|
# * college
|
|
267
267
|
# * consumer_privacy_network
|
|
268
268
|
# * content_delivery_network
|
|
269
|
-
# * dialup
|
|
270
269
|
# * government
|
|
271
270
|
# * hosting
|
|
272
271
|
# * library
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maxmind-geoip2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- William Storey
|
|
@@ -38,7 +38,7 @@ dependencies:
|
|
|
38
38
|
version: '4.3'
|
|
39
39
|
- - "<"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
41
|
+
version: '7.0'
|
|
42
42
|
type: :runtime
|
|
43
43
|
prerelease: false
|
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -48,7 +48,7 @@ dependencies:
|
|
|
48
48
|
version: '4.3'
|
|
49
49
|
- - "<"
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: '
|
|
51
|
+
version: '7.0'
|
|
52
52
|
- !ruby/object:Gem::Dependency
|
|
53
53
|
name: maxmind-db
|
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -175,7 +175,7 @@ dependencies:
|
|
|
175
175
|
- - ">="
|
|
176
176
|
- !ruby/object:Gem::Version
|
|
177
177
|
version: '0'
|
|
178
|
-
description: A gem for interacting with the
|
|
178
|
+
description: A gem for interacting with the GeoIP webservices and databases. MaxMind
|
|
179
179
|
provides geolocation data as downloadable databases as well as through a webservice.
|
|
180
180
|
email: support@maxmind.com
|
|
181
181
|
executables: []
|
|
@@ -203,6 +203,7 @@ files:
|
|
|
203
203
|
- lib/maxmind/geoip2/reader.rb
|
|
204
204
|
- lib/maxmind/geoip2/record/abstract.rb
|
|
205
205
|
- lib/maxmind/geoip2/record/anonymizer.rb
|
|
206
|
+
- lib/maxmind/geoip2/record/anonymizer_feed.rb
|
|
206
207
|
- lib/maxmind/geoip2/record/city.rb
|
|
207
208
|
- lib/maxmind/geoip2/record/continent.rb
|
|
208
209
|
- lib/maxmind/geoip2/record/country.rb
|
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
239
240
|
- !ruby/object:Gem::Version
|
|
240
241
|
version: '0'
|
|
241
242
|
requirements: []
|
|
242
|
-
rubygems_version:
|
|
243
|
+
rubygems_version: 4.0.10
|
|
243
244
|
specification_version: 4
|
|
244
|
-
summary: A gem for interacting with the
|
|
245
|
+
summary: A gem for interacting with the GeoIP webservices and databases.
|
|
245
246
|
test_files: []
|