vpndetection 5.17.1 → 5.18.1

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -7
  3. data/lib/vpndetection/api/account_wire_api.rb +2 -2
  4. data/lib/vpndetection/api/api_keys_wire_api.rb +2 -2
  5. data/lib/vpndetection/api/authorization_wire_api.rb +2 -2
  6. data/lib/vpndetection/api/database_wire_api.rb +2 -2
  7. data/lib/vpndetection/api/entitlement_wire_api.rb +2 -2
  8. data/lib/vpndetection/api/lookup_wire_api.rb +4 -4
  9. data/lib/vpndetection/api/organization_wire_api.rb +2 -2
  10. data/lib/vpndetection/api_client.rb +2 -2
  11. data/lib/vpndetection/api_error.rb +2 -2
  12. data/lib/vpndetection/api_model_base.rb +2 -2
  13. data/lib/vpndetection/bogon.rb +11 -2
  14. data/lib/vpndetection/cache.rb +31 -2
  15. data/lib/vpndetection/client.rb +4 -3
  16. data/lib/vpndetection/configuration.rb +3 -3
  17. data/lib/vpndetection/models/abuse_contact.rb +236 -0
  18. data/lib/vpndetection/models/account_create_apikey_request.rb +2 -2
  19. data/lib/vpndetection/models/account_created_apikey.rb +2 -2
  20. data/lib/vpndetection/models/account_org.rb +2 -2
  21. data/lib/vpndetection/models/account_org_ref.rb +2 -2
  22. data/lib/vpndetection/models/account_org_wrap.rb +2 -2
  23. data/lib/vpndetection/models/account_rc.rb +2 -2
  24. data/lib/vpndetection/models/account_revealed_apikey.rb +2 -2
  25. data/lib/vpndetection/models/account_user.rb +2 -2
  26. data/lib/vpndetection/models/apikey_detail.rb +2 -2
  27. data/lib/vpndetection/models/apikey_list.rb +2 -2
  28. data/lib/vpndetection/models/asn.rb +26 -6
  29. data/lib/vpndetection/models/batch_lookup_error.rb +2 -2
  30. data/lib/vpndetection/models/batch_lookup_request.rb +2 -2
  31. data/lib/vpndetection/models/batch_lookup_response.rb +2 -2
  32. data/lib/vpndetection/models/bit_torrent_detail.rb +241 -0
  33. data/lib/vpndetection/models/carrier_detail.rb +189 -0
  34. data/lib/vpndetection/models/class_detail.rb +2 -2
  35. data/lib/vpndetection/models/client_registration.rb +2 -2
  36. data/lib/vpndetection/models/client_registration_request.rb +2 -2
  37. data/lib/vpndetection/models/company.rb +213 -0
  38. data/lib/vpndetection/models/database.rb +2 -2
  39. data/lib/vpndetection/models/database_checksums_response.rb +2 -2
  40. data/lib/vpndetection/models/database_format.rb +2 -2
  41. data/lib/vpndetection/models/database_format_size.rb +2 -2
  42. data/lib/vpndetection/models/database_list.rb +2 -2
  43. data/lib/vpndetection/models/database_metadata.rb +2 -2
  44. data/lib/vpndetection/models/database_metadata_column.rb +2 -2
  45. data/lib/vpndetection/models/database_version.rb +2 -2
  46. data/lib/vpndetection/models/db_checksums.rb +2 -2
  47. data/lib/vpndetection/models/device_authorization.rb +2 -2
  48. data/lib/vpndetection/models/dns_resolver_detail.rb +199 -0
  49. data/lib/vpndetection/models/download.rb +2 -2
  50. data/lib/vpndetection/models/download_list.rb +2 -2
  51. data/lib/vpndetection/models/entitlement.rb +2 -2
  52. data/lib/vpndetection/models/entitlement_apikey.rb +2 -2
  53. data/lib/vpndetection/models/entitlement_error.rb +2 -2
  54. data/lib/vpndetection/models/entitlement_plan.rb +3 -3
  55. data/lib/vpndetection/models/entitlement_usage.rb +2 -2
  56. data/lib/vpndetection/models/error_envelope.rb +2 -2
  57. data/lib/vpndetection/models/identity.rb +2 -2
  58. data/lib/vpndetection/models/location.rb +107 -7
  59. data/lib/vpndetection/models/lookup_error.rb +2 -2
  60. data/lib/vpndetection/models/lookup_response.rb +185 -5
  61. data/lib/vpndetection/models/oauth_error.rb +2 -2
  62. data/lib/vpndetection/models/oauth_metadata.rb +2 -2
  63. data/lib/vpndetection/models/proxy_detail.rb +2 -2
  64. data/lib/vpndetection/models/pubproxy_detail.rb +2 -2
  65. data/lib/vpndetection/models/satellite_detail.rb +209 -0
  66. data/lib/vpndetection/models/smtp_detail.rb +189 -0
  67. data/lib/vpndetection/models/ssh_detail.rb +199 -0
  68. data/lib/vpndetection/models/standing.rb +2 -2
  69. data/lib/vpndetection/models/token_response.rb +2 -2
  70. data/lib/vpndetection/models/vpn_detail.rb +2 -2
  71. data/lib/vpndetection/models/web_detail.rb +517 -0
  72. data/lib/vpndetection/result.rb +182 -12
  73. data/lib/vpndetection/transport.rb +10 -0
  74. data/lib/vpndetection/version.rb +1 -1
  75. metadata +10 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 344d9cd5881a7814b76ff8ce7e055f58817a16c55b76a2cb70e6d18632ea98fb
4
- data.tar.gz: 89d55171a8544ffeca8614964243d8a94dcc835b7e744d5990faa73178970c07
3
+ metadata.gz: 42773fd02336f3eda77e1f1c8dd81db0e5fbcd36462abd4f7f5b3a155cde7b06
4
+ data.tar.gz: 1d298a6165692e45c8b7c1486766345fc720f42cde6252588472c2a98ff7e10d
5
5
  SHA512:
6
- metadata.gz: ab4940fa39b96449a647677af59f038f2d2ce26e75751763a5f2bfceec7389bd91031796adcec3819d383aa4720d9cd64ec2187a23c8438f74e183dba908013d
7
- data.tar.gz: 3c0a2f9d92629f0cf191762aeb4c4e8ad4c175260abe8d01880e74fc0fcb286ef2d0ed9e2c81b47950c375ed28e375a9e3548d7de21a194c5f53e1a4b089b525
6
+ metadata.gz: 388a52a841e94c3d1aac73607625fbfb316c4d3f1a77ddd343d8acb91d45b212b3ae3ebbf165e03218853ffe341cb4c609032696adc82c9820f1fabd0bfb4be9
7
+ data.tar.gz: 6b9efb04efd64953b7ca16ce7f6b3fcb16f34445394c1b32877f64b6e1e04b12e025bfb35c1db64546a0a8067e6015fed0d4e43d862e05a42b9ab552cac23e2e
data/README.md CHANGED
@@ -19,11 +19,11 @@ Or add it to your Gemfile:
19
19
  gem 'vpndetection'
20
20
  ```
21
21
 
22
- Requires Ruby 3.3 or newer.
22
+ Requires Ruby 3.3 or newer, and libcurl at runtime, which the `curl` package brings on Debian and Alpine.
23
23
 
24
24
  ## Usage
25
25
 
26
- **No API key needed to start.** Unlimited, the free plan, answers `ip`, `is_vpn`, Tor and relay detection, `location` and `asn`, with no daily or monthly cap, with a key or without one.
26
+ **No API key needed to start.** Unlimited, the free plan, answers `ip`, `is_vpn`, Tor and relay detection, `is_anycast`, `hostname` (the reverse DNS name), country-level `location` and `asn` with the AS's country and RPKI status, with no daily or monthly cap, with a key or without one.
27
27
 
28
28
  ```ruby
29
29
  require 'vpndetection'
@@ -38,7 +38,7 @@ result.asn['name'] # who runs the announcing network
38
38
 
39
39
  ### With an API key
40
40
 
41
- Every paid plan answers every field: `is_hosting`, `is_cdn` and the four proxy flags as well, and the provider (its ID and its name), confidence and last-seen detail behind each flag. The plans differ only in how many lookups they include, and a free account tries every field, 100 lookups a day. Create a key in the [console](https://app.vpndetection.io), then pass it in:
41
+ Every paid plan answers every field: `is_hosting`, `is_cdn` and the four proxy flags as well, the carrier and satellite flags, the five service flags (SSH, SMTP, web, DNS resolver and BitTorrent), city-level `location`, the `company` and the `abuse` contact, and the provider (its ID and its name), confidence and last-seen detail behind each flag. The plans differ only in how many lookups they include, and a free account tries every field. Create a key in the [console](https://app.vpndetection.io), then pass it in:
42
42
 
43
43
  ```ruby
44
44
  client = VPNDetection::Client.new(api_key: ENV['VPNDETECTION_API_KEY'])
@@ -68,7 +68,7 @@ acct.usage.requests # => 580
68
68
  acct.usage.window_end # => when the allowance resets
69
69
  ```
70
70
 
71
- Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and against the UTC day on the free plan; it is the same number a lookup is gated on. `hard_limit` is `nil` on an uncapped plan, which is not the same as zero.
71
+ Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and on the free plan it counts the trial's lookups answered with every field; it is the same number a lookup is gated on. `hard_limit` is `nil` on an uncapped plan, which is not the same as zero.
72
72
 
73
73
  Show `plan.name` and compare against `plan.key`: a plan's name can change, and its key never does. A value the API adds later to a plan's `tier`, a database's `standing` or `license_type`, a format or a download's `outcome` comes back as the string it served (from 5.16.0), so check for the values you know rather than assuming the list is complete.
74
74
 
@@ -117,6 +117,8 @@ client = VPNDetection::Client.new(cache_max_size: 50_000, cache_ttl: 6 * 60 * 60
117
117
  client_no_cache = VPNDetection::Client.new(cache: false)
118
118
  ```
119
119
 
120
+ An answer with `trial_expired` or `cap_reached` true is cached for a minute at most, so a renewed trial or a raised cap reaches you within a minute.
121
+
120
122
  ### Private and reserved addresses
121
123
 
122
124
  Private, loopback, link-local, documentation and multicast addresses (and their IPv6 equivalents, including the 6to4 and Teredo ranges) can never be VPN or proxy infrastructure. The library answers them locally, so they cost no request and no quota:
@@ -212,7 +214,7 @@ raise 'no API key was picked' if token.apikey.nil?
212
214
  keyed = VPNDetection::Client.new(api_key: token.apikey)
213
215
  ```
214
216
 
215
- `poll_device_token` raises `VPNDetection::OauthAccessDeniedError` when the person refuses and `VPNDetection::OauthExpiredTokenError` when the code expires first. Client IDs are issued on request from support@vpndetection.io, and `client.oauth.revoke('your-client-id', token.refresh_token)` signs the machine out.
217
+ `poll_device_token` raises `VPNDetection::OauthAccessDeniedError` when the person refuses and `VPNDetection::OauthExpiredTokenError` when the code expires first. `client.oauth.revoke('your-client-id', token.refresh_token)` signs the machine out. Only a client we registered, such as our CLI, can use the device flow: an app of your own signs people in with the authorization code flow below.
216
218
 
217
219
  ### Sign in with OAuth (authorization code)
218
220
 
@@ -244,12 +246,12 @@ Each redirect URI must be https on a public host name, or http on a loopback add
244
246
 
245
247
  ### Absent is not false
246
248
 
247
- Unlimited leaves out `is_hosting`, `is_cdn` and the four proxy flags, and of the detail behind each flag it answers only Tor's and relay's; a free-plan key's answer carries `trial_expired`, true once its daily trial is spent, and a paid key's carries `cap_reached`, true once its organization's overage cap is reached and the answer has Unlimited's. A field is present when your plan includes it and `nil` when it does not. `nil` means "not in your plan"; `false` means "we checked, and no".
249
+ Unlimited leaves out `is_hosting`, `is_cdn`, the four proxy flags, the carrier, satellite and service flags, `company` and `abuse`, and of the detail behind each flag it answers only Tor's and relay's; a free-plan key's answer carries `trial_expired`, true once its trial is spent, and a paid key's carries `cap_reached`, true once its organization's overage cap is reached and the answer has Unlimited's. A field is present when your plan includes it and `nil` when it does not. `nil` means "not in your plan"; `false` means "we checked, and no".
248
250
 
249
251
  ```ruby
250
252
  result.hosting? # false when absent, for when you only want the flag
251
253
  result.included?(:is_hosting) # false on Unlimited: not in your plan
252
- result.trial_expired == true # a free-plan key's daily trial is spent
254
+ result.trial_expired == true # a free-plan key's trial is spent
253
255
  result.cap_reached == true # a paid key past its overage cap
254
256
  ```
255
257
 
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -88,7 +88,7 @@ module VPNDetection
88
88
  end
89
89
 
90
90
  # Lookup
91
- # Answers what is known about a single IPv4 or IPv6 address. Which fields come back is decided by the presented key; with no key, on Unlimited, the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members, `location` and `asn`.
91
+ # Answers what is known about a single IPv4 or IPv6 address. Which fields come back is decided by the presented key; with no key, on Unlimited, the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`, `location` and `asn`.
92
92
  # @param ip [String] The IPv4 or IPv6 address to classify.
93
93
  # @param [Hash] opts the optional parameters
94
94
  # @return [LookupResponse]
@@ -98,7 +98,7 @@ module VPNDetection
98
98
  end
99
99
 
100
100
  # Lookup
101
- # Answers what is known about a single IPv4 or IPv6 address. Which fields come back is decided by the presented key; with no key, on Unlimited, the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members, `location` and `asn`.
101
+ # Answers what is known about a single IPv4 or IPv6 address. Which fields come back is decided by the presented key; with no key, on Unlimited, the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`, `location` and `asn`.
102
102
  # @param ip [String] The IPv4 or IPv6 address to classify.
103
103
  # @param [Hash] opts the optional parameters
104
104
  # @return [Array<(LookupResponse, Integer, Hash)>] LookupResponse data, response status code and response headers
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -31,9 +31,14 @@ module VPNDetection
31
31
  addr&.ipv4_mapped? ? addr.native.to_s : ip
32
32
  end
33
33
 
34
+ # The location members a bogon answers 0 rather than an empty string, as the
35
+ # API does.
36
+ BOGON_ZEROS = { 'latitude' => 0, 'longitude' => 0, 'accuracy_radius' => 0 }.freeze
37
+
34
38
  # The answer a bogon gets, in the full shape the API serves at its widest
35
39
  # plan: every flag present and false, every detail object present and empty,
36
- # and a location and AS of empty strings and AS 0.
40
+ # `web` an empty list, an empty hostname, and a location, AS, company and
41
+ # abuse contact of empty strings, zeros and false.
37
42
  #
38
43
  # `is_bogon` marks it as computed rather than served. Note this is
39
44
  # deliberately the WIDEST shape regardless of your plan, so do not infer
@@ -42,8 +47,12 @@ module VPNDetection
42
47
  raw = { 'ip' => ip, 'is_bogon' => true }
43
48
  Result::FLAGS.each { |flag| raw[flag] = false }
44
49
  Result::DETAILS.each { |detail| raw[detail] = {} }
45
- raw['location'] = Result::LOCATION.to_h { |member| [member, ''] }
50
+ Result::DETAIL_LISTS.each { |detail| raw[detail] = [] }
51
+ raw['location'] = Result::LOCATION.to_h { |member| [member, BOGON_ZEROS.fetch(member, '')] }
46
52
  raw['asn'] = Result::ASN.to_h { |member| [member, member == 'asn' ? 0 : ''] }
53
+ raw['company'] = Result::COMPANY.to_h { |member| [member, ''] }
54
+ raw['hostname'] = ''
55
+ raw['abuse'] = Result::ABUSE.to_h { |member| [member, member == 'validated' ? false : ''] }
47
56
  Result.new(raw, bogon: true)
48
57
  end
49
58
 
@@ -9,19 +9,37 @@ module VPNDetection
9
9
  # different plans and entitled to different fields, so a shared cache would
10
10
  # serve one of them the other's shape. Errors are never stored and bogons
11
11
  # never reach it.
12
+ #
13
+ # A reduced answer, a spent trial's or a reached cap's, ends with the trial's
14
+ # renewal or a raised cap, so it stays a minute at most rather than the TTL. It
15
+ # is still cached, or a busy process would send every repeat to the API.
12
16
  class Cache
17
+ # The longest a spent trial's or a reached cap's answer is held, in seconds.
18
+ REDUCED_TTL = 60
19
+
13
20
  def initialize(max_size:, ttl:)
14
21
  raise ArgumentError, 'cache_max_size must be positive' unless max_size.to_i.positive?
15
22
 
23
+ @ttl = ttl
16
24
  @store = LruRedux::TTL::ThreadSafeCache.new(max_size.to_i, ttl)
17
25
  end
18
26
 
19
27
  def get(key)
20
- @store[key]
28
+ value, expires = @store[key]
29
+ return nil if expires.nil?
30
+ return value if now < expires
31
+
32
+ @store.delete(key)
33
+ nil
21
34
  end
22
35
 
23
36
  def set(key, value)
24
- @store[key] = value
37
+ @store[key] = [value, now + life_of(value)]
38
+ end
39
+
40
+ # When the answer held for `key` goes stale, on the monotonic clock, or nil.
41
+ def expiry(key)
42
+ @store[key]&.last
25
43
  end
26
44
 
27
45
  def clear
@@ -31,5 +49,16 @@ module VPNDetection
31
49
  def size
32
50
  @store.count
33
51
  end
52
+
53
+ private
54
+
55
+ def life_of(value)
56
+ reduced = value.respond_to?(:trial_expired?) && (value.trial_expired? || value.cap_reached?)
57
+ reduced ? [@ttl, REDUCED_TTL].min : @ttl
58
+ end
59
+
60
+ def now
61
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
62
+ end
34
63
  end
35
64
  end
@@ -24,10 +24,11 @@ module VPNDetection
24
24
  attr_reader :oauth
25
25
 
26
26
  # @param api_key [String, nil] without one a lookup is on Unlimited, the free
27
- # plan: `ip`, `is_vpn`, the Tor and relay members, `location` and `asn`, with
28
- # no daily or monthly cap. A batch needs a key on a paid plan. It is trimmed, and a key of blanks alone is no key.
27
+ # plan: `ip`, `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`,
28
+ # `location` and `asn`, with no daily or monthly cap. A batch needs a key on a paid plan. It is trimmed, and a key of blanks alone is no key.
29
29
  # @param cache [Boolean] pass false to disable caching.
30
- # @param cache_ttl [Numeric] how long an answer stays fresh, in seconds.
30
+ # @param cache_ttl [Numeric] how long an answer stays fresh, in seconds; an
31
+ # answer marked trial_expired or cap_reached stays a minute at most.
31
32
  # @param concurrency [Integer] batch requests - chunks of up to 1000 addresses - in flight during a batch, from 1.
32
33
  # @param retries [Integer] extra attempts for a transient failure, from 0. Each
33
34
  # waits the server's `Retry-After` when it sent one of at most about 24.8
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -177,7 +177,7 @@ module VPNDetection
177
177
  @ignore_operation_servers = false
178
178
  @inject_format = false
179
179
  @force_ending_format = false
180
- @logger = defined?(::Rails) ? ::Rails.logger : Logger.new(STDOUT)
180
+ @logger = defined?(::Rails) && ::Rails.respond_to?(:logger) ? ::Rails.logger : Logger.new(STDOUT)
181
181
 
182
182
  yield(self) if block_given?
183
183
  end
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
+
6
+ The version of the OpenAPI document: 2026.11.20
7
+ Contact: support@vpndetection.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VPNDetection
17
+ # Where to report abuse from the address, from our IP Abuse Contact database. Paid plans. Every key is present whenever the object is: empty strings where no record covers the address.
18
+ class AbuseContact < ApiModelBase
19
+ # Where to report abuse from the address.
20
+ attr_accessor :email
21
+
22
+ # The contact.
23
+ attr_accessor :name
24
+
25
+ # Its phone number.
26
+ attr_accessor :phone
27
+
28
+ # Its postal address.
29
+ attr_accessor :address
30
+
31
+ # ISO 3166 country code.
32
+ attr_accessor :country
33
+
34
+ # The registry block it was derived from.
35
+ attr_accessor :network
36
+
37
+ # ARIN reports the contact answered its yearly validation.
38
+ attr_accessor :validated
39
+
40
+ # Since when it has not.
41
+ attr_accessor :unvalidated_since
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'email' => :'email',
47
+ :'name' => :'name',
48
+ :'phone' => :'phone',
49
+ :'address' => :'address',
50
+ :'country' => :'country',
51
+ :'network' => :'network',
52
+ :'validated' => :'validated',
53
+ :'unvalidated_since' => :'unvalidated_since'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'email' => :'String',
71
+ :'name' => :'String',
72
+ :'phone' => :'String',
73
+ :'address' => :'String',
74
+ :'country' => :'String',
75
+ :'network' => :'String',
76
+ :'validated' => :'Boolean',
77
+ :'unvalidated_since' => :'String'
78
+ }
79
+ end
80
+
81
+ # List of attributes with nullable: true
82
+ def self.openapi_nullable
83
+ Set.new([
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AbuseContact` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!acceptable_attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AbuseContact`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'email')
104
+ self.email = attributes[:'email']
105
+ else
106
+ self.email = nil
107
+ end
108
+
109
+ if attributes.key?(:'name')
110
+ self.name = attributes[:'name']
111
+ end
112
+
113
+ if attributes.key?(:'phone')
114
+ self.phone = attributes[:'phone']
115
+ end
116
+
117
+ if attributes.key?(:'address')
118
+ self.address = attributes[:'address']
119
+ end
120
+
121
+ if attributes.key?(:'country')
122
+ self.country = attributes[:'country']
123
+ end
124
+
125
+ if attributes.key?(:'network')
126
+ self.network = attributes[:'network']
127
+ end
128
+
129
+ if attributes.key?(:'validated')
130
+ self.validated = attributes[:'validated']
131
+ end
132
+
133
+ if attributes.key?(:'unvalidated_since')
134
+ self.unvalidated_since = attributes[:'unvalidated_since']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
+ invalid_properties = Array.new
143
+ if @email.nil?
144
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @email.nil?
155
+ true
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] email Value to be assigned
160
+ def email=(email)
161
+ if email.nil?
162
+ fail ArgumentError, 'email cannot be nil'
163
+ end
164
+
165
+ @email = email
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ email == o.email &&
174
+ name == o.name &&
175
+ phone == o.phone &&
176
+ address == o.address &&
177
+ country == o.country &&
178
+ network == o.network &&
179
+ validated == o.validated &&
180
+ unvalidated_since == o.unvalidated_since
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [email, name, phone, address, country, network, validated, unvalidated_since].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ attributes = attributes.transform_keys(&:to_sym)
201
+ transformed_hash = {}
202
+ openapi_types.each_pair do |key, type|
203
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = nil
205
+ elsif type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[attribute_map[key]].is_a?(Array)
209
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
210
+ end
211
+ elsif !attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
213
+ end
214
+ end
215
+ new(transformed_hash)
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #VPNDetection API
3
3
 
4
- #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them, 100 lookups a day. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. Lookups need no API key: Unlimited, the free plan, answers any address with no daily or monthly cap, with a key or without one. Every paid plan answers every field, and a free account tries them. Unlimited's answers may be used commercially, but not redistributed or used in a competing service (https://vpndetection.io/terms#no-key). See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.11.18
6
+ The version of the OpenAPI document: 2026.11.20
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0