vpndetection 5.18.1 → 5.20.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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -2
  3. data/lib/vpndetection/api/account_wire_api.rb +3 -3
  4. data/lib/vpndetection/api/api_keys_wire_api.rb +9 -9
  5. data/lib/vpndetection/api/authorization_wire_api.rb +1 -1
  6. data/lib/vpndetection/api/database_wire_api.rb +1 -1
  7. data/lib/vpndetection/api/entitlement_wire_api.rb +1 -1
  8. data/lib/vpndetection/api/lookup_wire_api.rb +15 -1
  9. data/lib/vpndetection/api/organization_wire_api.rb +5 -5
  10. data/lib/vpndetection/api_client.rb +1 -1
  11. data/lib/vpndetection/api_error.rb +1 -1
  12. data/lib/vpndetection/api_model_base.rb +1 -1
  13. data/lib/vpndetection/client.rb +78 -41
  14. data/lib/vpndetection/configuration.rb +1 -1
  15. data/lib/vpndetection/middleware/core.rb +61 -5
  16. data/lib/vpndetection/models/abuse_contact.rb +1 -1
  17. data/lib/vpndetection/models/account_create_apikey_request.rb +1 -1
  18. data/lib/vpndetection/models/account_created_apikey.rb +1 -1
  19. data/lib/vpndetection/models/account_org.rb +1 -1
  20. data/lib/vpndetection/models/account_org_ref.rb +1 -1
  21. data/lib/vpndetection/models/account_org_wrap.rb +1 -1
  22. data/lib/vpndetection/models/account_rc.rb +1 -1
  23. data/lib/vpndetection/models/account_revealed_apikey.rb +1 -1
  24. data/lib/vpndetection/models/account_user.rb +1 -1
  25. data/lib/vpndetection/models/apikey_detail.rb +1 -1
  26. data/lib/vpndetection/models/apikey_list.rb +1 -1
  27. data/lib/vpndetection/models/asn.rb +35 -1
  28. data/lib/vpndetection/models/batch_lookup_error.rb +1 -1
  29. data/lib/vpndetection/models/batch_lookup_request.rb +17 -5
  30. data/lib/vpndetection/models/batch_lookup_response.rb +1 -1
  31. data/lib/vpndetection/models/bit_torrent_detail.rb +1 -1
  32. data/lib/vpndetection/models/bot_detail.rb +243 -0
  33. data/lib/vpndetection/models/carrier_detail.rb +1 -1
  34. data/lib/vpndetection/models/class_detail.rb +1 -1
  35. data/lib/vpndetection/models/client_registration.rb +1 -1
  36. data/lib/vpndetection/models/client_registration_request.rb +1 -1
  37. data/lib/vpndetection/models/company.rb +1 -1
  38. data/lib/vpndetection/models/database.rb +1 -1
  39. data/lib/vpndetection/models/database_checksums_response.rb +1 -1
  40. data/lib/vpndetection/models/database_format.rb +1 -1
  41. data/lib/vpndetection/models/database_format_size.rb +1 -1
  42. data/lib/vpndetection/models/database_list.rb +1 -1
  43. data/lib/vpndetection/models/database_metadata.rb +1 -1
  44. data/lib/vpndetection/models/database_metadata_column.rb +1 -1
  45. data/lib/vpndetection/models/database_version.rb +1 -1
  46. data/lib/vpndetection/models/db_checksums.rb +1 -1
  47. data/lib/vpndetection/models/device_authorization.rb +1 -1
  48. data/lib/vpndetection/models/dns_resolver_detail.rb +1 -1
  49. data/lib/vpndetection/models/download.rb +1 -1
  50. data/lib/vpndetection/models/download_list.rb +1 -1
  51. data/lib/vpndetection/models/entitlement.rb +1 -1
  52. data/lib/vpndetection/models/entitlement_apikey.rb +1 -1
  53. data/lib/vpndetection/models/entitlement_error.rb +1 -1
  54. data/lib/vpndetection/models/entitlement_plan.rb +1 -1
  55. data/lib/vpndetection/models/entitlement_usage.rb +1 -1
  56. data/lib/vpndetection/models/error_envelope.rb +1 -1
  57. data/lib/vpndetection/models/identity.rb +1 -1
  58. data/lib/vpndetection/models/location.rb +1 -1
  59. data/lib/vpndetection/models/lookup_error.rb +1 -1
  60. data/lib/vpndetection/models/lookup_response.rb +32 -2
  61. data/lib/vpndetection/models/oauth_error.rb +1 -1
  62. data/lib/vpndetection/models/oauth_metadata.rb +1 -1
  63. data/lib/vpndetection/models/proxy_detail.rb +1 -1
  64. data/lib/vpndetection/models/pubproxy_detail.rb +1 -1
  65. data/lib/vpndetection/models/satellite_detail.rb +1 -1
  66. data/lib/vpndetection/models/smtp_detail.rb +1 -1
  67. data/lib/vpndetection/models/ssh_detail.rb +1 -1
  68. data/lib/vpndetection/models/standing.rb +1 -1
  69. data/lib/vpndetection/models/token_response.rb +1 -1
  70. data/lib/vpndetection/models/user_agent_verdict.rb +239 -0
  71. data/lib/vpndetection/models/vpn_detail.rb +1 -1
  72. data/lib/vpndetection/models/web_detail.rb +1 -1
  73. data/lib/vpndetection/result.rb +38 -3
  74. data/lib/vpndetection/transport.rb +29 -6
  75. data/lib/vpndetection/version.rb +1 -1
  76. metadata +3 -1
@@ -27,14 +27,29 @@ module VPNDetection
27
27
  DEFAULT_TIMEOUT = 2.5
28
28
  DEFAULT_RETRIES = 0
29
29
 
30
+ # Reads a request's `User-Agent` where the adapter names no reader: Rack's
31
+ # request has `user_agent`, and so do Sinatra's and Hanami's.
32
+ DEFAULT_USER_AGENT = ->(request) { request.user_agent if request.respond_to?(:user_agent) }
33
+
30
34
  # Resolve, classify, decide.
31
35
  class Core
32
36
  # @param default_ip_selector [#call] the framework's own accessor, used
33
37
  # when the caller named none.
34
- def initialize(default_ip_selector, **options)
38
+ # @param user_agent_of [#call] reads the request's own `User-Agent`, which
39
+ # `allow_bots: true` sends with the lookup.
40
+ # @option options [Boolean] :allow_bots (false) send the request's own
41
+ # `User-Agent` with its lookup, and never refuse a request whose answer
42
+ # says `user_agent.verdict` is `verified`, whatever the condition
43
+ # matches; the answer is still attached. An absent or empty header sends
44
+ # none. A keyless client, or a free key past its trial, never gets a
45
+ # verdict, so nothing is let through there, and that is warned of once
46
+ # under `on_missing_field`.
47
+ def initialize(default_ip_selector, user_agent_of = DEFAULT_USER_AGENT, **options)
35
48
  Condition.validate!(options[:block_condition])
36
49
  @condition = options[:block_condition]
37
50
  @selector = options[:ip_selector] || default_ip_selector
51
+ @allow_bots = options.fetch(:allow_bots, false) == true
52
+ @user_agent_of = user_agent_of
38
53
  @fail_closed = options.fetch(:fail_closed, false)
39
54
  @on_missing_field = options.fetch(:on_missing_field, :warn)
40
55
  @skip = options[:skip]
@@ -76,12 +91,14 @@ module VPNDetection
76
91
  )
77
92
  end
78
93
 
94
+ # A bogon is answered locally, so nothing is sent for it.
95
+ agent = @allow_bots && !Bogon.bogon?(ip) ? user_agent(request) : nil
79
96
  begin
80
- result = @client.lookup(ip, retries: @retries)
97
+ result = @client.lookup(ip, retries: @retries, **(agent ? { user_agent: agent } : {}))
81
98
  rescue VPNDetection::Error => e
82
99
  return Lookup.new(blocked: @fail_closed, ip: ip, error: e)
83
100
  end
84
- decide(ip, result)
101
+ decide(ip, result, agent)
85
102
  end
86
103
 
87
104
  private
@@ -97,19 +114,35 @@ module VPNDetection
97
114
  )
98
115
  end
99
116
 
100
- def decide(ip, result)
117
+ # The request's own `User-Agent`, or nil when it sent none or an empty one.
118
+ def user_agent(request)
119
+ agent = @user_agent_of.call(request)
120
+ agent.is_a?(String) && !agent.empty? ? agent : nil
121
+ end
122
+
123
+ def decide(ip, result, agent)
124
+ report_unanswered_agent(result) unless agent.nil?
101
125
  return Lookup.new(blocked: false, ip: ip, result: result) if @condition.nil?
102
126
 
103
127
  report_missing(result)
104
128
  Lookup.new(
105
- blocked: Condition.matches?(@condition, result),
129
+ blocked: Condition.matches?(@condition, result) && !verified?(result),
106
130
  ip: ip,
107
131
  result: result
108
132
  )
109
133
  end
110
134
 
135
+ # Whether `allow_bots` lets this answer through: its agent's operator
136
+ # vouches for the address.
137
+ def verified?(result)
138
+ @allow_bots && result.user_agent.is_a?(Hash) && result.user_agent['verdict'] == 'verified'
139
+ end
140
+
111
141
  def report_missing(result)
112
142
  return if @on_missing_field == :ignore
143
+ # A bogon is answered locally in the widest shape, which carries every
144
+ # member but `user_agent`, and no agent is sent for it.
145
+ return if result.bogon?
113
146
 
114
147
  missing = Condition.missing_members(@condition, result)
115
148
  return if missing.empty?
@@ -117,6 +150,24 @@ module VPNDetection
117
150
  message = "block_condition names #{missing.join(', ')}, which your plan does not " \
118
151
  'include, so those terms can never match. An absent member means "not in ' \
119
152
  'your plan", not "checked, and no".'
153
+ if missing.include?('user_agent') && !@allow_bots
154
+ message += ' user_agent is answered only to a lookup that sends one, which allow_bots does.'
155
+ end
156
+ report(message)
157
+ end
158
+
159
+ # An agent went with the lookup and the served answer carries no verdict:
160
+ # a keyless client, or a free key past its trial, is never answered one,
161
+ # so allow_bots lets no crawler through.
162
+ def report_unanswered_agent(result)
163
+ return if @on_missing_field == :ignore || result.included?(:user_agent)
164
+
165
+ report('allow_bots sends the request\'s User-Agent, but the answer carries no user_agent ' \
166
+ 'verdict, which your plan does not include, so no crawler is let through. A key on ' \
167
+ 'a paid plan, or on its trial, is answered one.')
168
+ end
169
+
170
+ def report(message)
120
171
  raise ArgumentError, "vpndetection: #{message}" if @on_missing_field == :raise
121
172
 
122
173
  warn_once(message)
@@ -147,6 +198,11 @@ module VPNDetection
147
198
  ->(request) { @view.call(request).framework_ip.call }
148
199
  end
149
200
 
201
+ # The request's own `User-Agent` header, which `allow_bots` sends.
202
+ def user_agent
203
+ ->(request) { @view.call(request).header.call('User-Agent') }
204
+ end
205
+
150
206
  # An address from `X-Forwarded-For`.
151
207
  #
152
208
  # The LEFT-MOST entry (depth 0) is whatever the caller sent, because
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -127,10 +127,14 @@ module VPNDetection
127
127
 
128
128
  if attributes.key?(:'country')
129
129
  self.country = attributes[:'country']
130
+ else
131
+ self.country = nil
130
132
  end
131
133
 
132
134
  if attributes.key?(:'rpki_status')
133
135
  self.rpki_status = attributes[:'rpki_status']
136
+ else
137
+ self.rpki_status = nil
134
138
  end
135
139
  end
136
140
 
@@ -159,6 +163,14 @@ module VPNDetection
159
163
  invalid_properties.push('invalid value for "prefix", prefix cannot be nil.')
160
164
  end
161
165
 
166
+ if @country.nil?
167
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
168
+ end
169
+
170
+ if @rpki_status.nil?
171
+ invalid_properties.push('invalid value for "rpki_status", rpki_status cannot be nil.')
172
+ end
173
+
162
174
  invalid_properties
163
175
  end
164
176
 
@@ -171,6 +183,8 @@ module VPNDetection
171
183
  return false if @domain.nil?
172
184
  return false if @type.nil?
173
185
  return false if @prefix.nil?
186
+ return false if @country.nil?
187
+ return false if @rpki_status.nil?
174
188
  true
175
189
  end
176
190
 
@@ -224,6 +238,26 @@ module VPNDetection
224
238
  @prefix = prefix
225
239
  end
226
240
 
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] country Value to be assigned
243
+ def country=(country)
244
+ if country.nil?
245
+ fail ArgumentError, 'country cannot be nil'
246
+ end
247
+
248
+ @country = country
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] rpki_status Value to be assigned
253
+ def rpki_status=(rpki_status)
254
+ if rpki_status.nil?
255
+ fail ArgumentError, 'rpki_status cannot be nil'
256
+ end
257
+
258
+ @rpki_status = rpki_status
259
+ end
260
+
227
261
  # Checks equality by comparing each attribute.
228
262
  # @param [Object] Object to be compared
229
263
  def ==(o)
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -18,10 +18,14 @@ module VPNDetection
18
18
  # The addresses to classify, 1 to 1000 per call, counted before duplicates collapse. Each distinct string is one lookup.
19
19
  attr_accessor :ips
20
20
 
21
+ # Each address's `User-Agent`, keyed by the string it is sent as in `ips`. With every field, that address's answer then carries `user_agent`, as a single lookup's does. Never kept.
22
+ attr_accessor :user_agents
23
+
21
24
  # Attribute mapping from ruby-style variable name to JSON key.
22
25
  def self.attribute_map
23
26
  {
24
- :'ips' => :'ips'
27
+ :'ips' => :'ips',
28
+ :'user_agents' => :'user_agents'
25
29
  }
26
30
  end
27
31
 
@@ -38,7 +42,8 @@ module VPNDetection
38
42
  # Attribute type mapping.
39
43
  def self.openapi_types
40
44
  {
41
- :'ips' => :'Array<String>'
45
+ :'ips' => :'Array<String>',
46
+ :'user_agents' => :'Hash<String, String>'
42
47
  }
43
48
  end
44
49
 
@@ -71,6 +76,12 @@ module VPNDetection
71
76
  else
72
77
  self.ips = nil
73
78
  end
79
+
80
+ if attributes.key?(:'user_agents')
81
+ if (value = attributes[:'user_agents']).is_a?(Hash)
82
+ self.user_agents = value
83
+ end
84
+ end
74
85
  end
75
86
 
76
87
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -126,7 +137,8 @@ module VPNDetection
126
137
  def ==(o)
127
138
  return true if self.equal?(o)
128
139
  self.class == o.class &&
129
- ips == o.ips
140
+ ips == o.ips &&
141
+ user_agents == o.user_agents
130
142
  end
131
143
 
132
144
  # @see the `==` method
@@ -138,7 +150,7 @@ module VPNDetection
138
150
  # Calculates hash code according to all attributes.
139
151
  # @return [Integer] Hash code
140
152
  def hash
141
- [ips].hash
153
+ [ips, user_agents].hash
142
154
  end
143
155
 
144
156
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -0,0 +1,243 @@
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.22
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
+ # Bot IP's row: whose bot uses the address, the bots it serves or claimed to be, what they do, and how that is known.
18
+ class BotDetail < ApiModelBase
19
+ # The bot operator's ID; for an address that is not verified, the operator its claim named. Empty where no operator is known.
20
+ attr_accessor :provider
21
+
22
+ # That operator's name, empty where no operator is known.
23
+ attr_accessor :provider_name
24
+
25
+ # The bots the address serves, as their user agents name them (`Googlebot`, `GPTBot`); for an address that is not verified, the bots it claimed to be. One address can serve several, and `[]` means none is named.
26
+ attr_accessor :agents
27
+
28
+ # What those bots do: `search_engine`, `ai_training`, `ai_search`, `ai_assistant`, `ai_agent`, `seo`, `ads`, `preview`, `feed`, `monitoring`, `archiver`, `scanner`, `link_security`, `webhook` or `other`; `[]` where unknown.
29
+ attr_accessor :categories
30
+
31
+ # Whether the operator vouches for the address, so the bots in `agents` really are its.
32
+ attr_accessor :verified
33
+
34
+ # `verified` (the operator vouches for the address), `declared` (it names itself a bot that cannot be verified), `spoofed` (it claimed a bot whose operator vouches for other addresses) or `undeclared` (it hides as a browser and behaves as automation).
35
+ attr_accessor :identity
36
+
37
+ # How a verified address verified: `list` (the operator publishes it), `rdns` (its reverse DNS name ends in a suffix the operator documents and resolves back) or `owner` (the operator's own space, seen claiming its bot); empty when not verified.
38
+ attr_accessor :verified_by
39
+
40
+ # `high`, `medium` or `low`: how sure we are the address is what the row says.
41
+ attr_accessor :confidence
42
+
43
+ # The first day the address was seen as such.
44
+ attr_accessor :first_seen
45
+
46
+ # The last day it was.
47
+ attr_accessor :last_seen
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'provider' => :'provider',
53
+ :'provider_name' => :'provider_name',
54
+ :'agents' => :'agents',
55
+ :'categories' => :'categories',
56
+ :'verified' => :'verified',
57
+ :'identity' => :'identity',
58
+ :'verified_by' => :'verified_by',
59
+ :'confidence' => :'confidence',
60
+ :'first_seen' => :'first_seen',
61
+ :'last_seen' => :'last_seen'
62
+ }
63
+ end
64
+
65
+ # Returns attribute mapping this model knows about
66
+ def self.acceptable_attribute_map
67
+ attribute_map
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ acceptable_attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'provider' => :'String',
79
+ :'provider_name' => :'String',
80
+ :'agents' => :'Array<String>',
81
+ :'categories' => :'Array<String>',
82
+ :'verified' => :'Boolean',
83
+ :'identity' => :'String',
84
+ :'verified_by' => :'String',
85
+ :'confidence' => :'String',
86
+ :'first_seen' => :'String',
87
+ :'last_seen' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ ])
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::BotDetail` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ acceptable_attribute_map = self.class.acceptable_attribute_map
106
+ attributes = attributes.each_with_object({}) { |(k, v), h|
107
+ if (!acceptable_attribute_map.key?(k.to_sym))
108
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::BotDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
109
+ end
110
+ h[k.to_sym] = v
111
+ }
112
+
113
+ if attributes.key?(:'provider')
114
+ self.provider = attributes[:'provider']
115
+ end
116
+
117
+ if attributes.key?(:'provider_name')
118
+ self.provider_name = attributes[:'provider_name']
119
+ end
120
+
121
+ if attributes.key?(:'agents')
122
+ if (value = attributes[:'agents']).is_a?(Array)
123
+ self.agents = value
124
+ end
125
+ end
126
+
127
+ if attributes.key?(:'categories')
128
+ if (value = attributes[:'categories']).is_a?(Array)
129
+ self.categories = value
130
+ end
131
+ end
132
+
133
+ if attributes.key?(:'verified')
134
+ self.verified = attributes[:'verified']
135
+ end
136
+
137
+ if attributes.key?(:'identity')
138
+ self.identity = attributes[:'identity']
139
+ end
140
+
141
+ if attributes.key?(:'verified_by')
142
+ self.verified_by = attributes[:'verified_by']
143
+ end
144
+
145
+ if attributes.key?(:'confidence')
146
+ self.confidence = attributes[:'confidence']
147
+ end
148
+
149
+ if attributes.key?(:'first_seen')
150
+ self.first_seen = attributes[:'first_seen']
151
+ end
152
+
153
+ if attributes.key?(:'last_seen')
154
+ self.last_seen = attributes[:'last_seen']
155
+ end
156
+ end
157
+
158
+ # Show invalid properties with the reasons. Usually used together with valid?
159
+ # @return Array for valid properties with the reasons
160
+ def list_invalid_properties
161
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
162
+ invalid_properties = Array.new
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ warn '[DEPRECATED] the `valid?` method is obsolete'
170
+ true
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ provider == o.provider &&
179
+ provider_name == o.provider_name &&
180
+ agents == o.agents &&
181
+ categories == o.categories &&
182
+ verified == o.verified &&
183
+ identity == o.identity &&
184
+ verified_by == o.verified_by &&
185
+ confidence == o.confidence &&
186
+ first_seen == o.first_seen &&
187
+ last_seen == o.last_seen
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(o)
193
+ self == o
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Integer] Hash code
198
+ def hash
199
+ [provider, provider_name, agents, categories, verified, identity, verified_by, confidence, first_seen, last_seen].hash
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def self.build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ transformed_hash = {}
209
+ openapi_types.each_pair do |key, type|
210
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = nil
212
+ elsif type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[attribute_map[key]].is_a?(Array)
216
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
217
+ end
218
+ elsif !attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
220
+ end
221
+ end
222
+ new(transformed_hash)
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -3,7 +3,7 @@
3
3
 
4
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.20
6
+ The version of the OpenAPI document: 2026.11.22
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0