vpndetection 5.9.0 → 5.10.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/README.md +7 -6
- data/lib/vpndetection/api/account_wire_api.rb +1 -1
- data/lib/vpndetection/api/api_keys_wire_api.rb +1 -1
- data/lib/vpndetection/api/authorization_wire_api.rb +1 -1
- data/lib/vpndetection/api/database_wire_api.rb +1 -1
- data/lib/vpndetection/api/entitlement_wire_api.rb +1 -1
- data/lib/vpndetection/api/lookup_wire_api.rb +5 -5
- data/lib/vpndetection/api/organization_wire_api.rb +1 -1
- data/lib/vpndetection/api_client.rb +1 -1
- data/lib/vpndetection/api_error.rb +1 -1
- data/lib/vpndetection/api_model_base.rb +1 -1
- data/lib/vpndetection/bogon.rb +4 -1
- data/lib/vpndetection/client.rb +2 -2
- data/lib/vpndetection/configuration.rb +1 -1
- data/lib/vpndetection/models/account_create_apikey_request.rb +1 -1
- data/lib/vpndetection/models/account_created_apikey.rb +1 -1
- data/lib/vpndetection/models/account_org.rb +1 -1
- data/lib/vpndetection/models/account_org_ref.rb +1 -1
- data/lib/vpndetection/models/account_org_wrap.rb +1 -1
- data/lib/vpndetection/models/account_rc.rb +1 -1
- data/lib/vpndetection/models/account_revealed_apikey.rb +1 -1
- data/lib/vpndetection/models/account_user.rb +1 -1
- data/lib/vpndetection/models/apikey_detail.rb +1 -1
- data/lib/vpndetection/models/apikey_list.rb +1 -1
- data/lib/vpndetection/models/asn.rb +274 -0
- data/lib/vpndetection/models/batch_lookup_error.rb +1 -1
- data/lib/vpndetection/models/batch_lookup_request.rb +1 -1
- data/lib/vpndetection/models/batch_lookup_response.rb +1 -1
- data/lib/vpndetection/models/class_detail.rb +1 -1
- data/lib/vpndetection/models/client_registration.rb +1 -1
- data/lib/vpndetection/models/client_registration_request.rb +1 -1
- data/lib/vpndetection/models/database.rb +29 -2
- data/lib/vpndetection/models/database_checksums_response.rb +1 -1
- data/lib/vpndetection/models/database_format.rb +1 -1
- data/lib/vpndetection/models/database_format_size.rb +1 -1
- data/lib/vpndetection/models/database_list.rb +1 -1
- data/lib/vpndetection/models/database_metadata.rb +1 -1
- data/lib/vpndetection/models/database_metadata_column.rb +1 -1
- data/lib/vpndetection/models/database_version.rb +1 -1
- data/lib/vpndetection/models/db_checksums.rb +1 -1
- data/lib/vpndetection/models/device_authorization.rb +1 -1
- data/lib/vpndetection/models/download.rb +29 -2
- data/lib/vpndetection/models/download_list.rb +1 -1
- data/lib/vpndetection/models/entitlement.rb +1 -1
- data/lib/vpndetection/models/entitlement_apikey.rb +1 -1
- data/lib/vpndetection/models/entitlement_error.rb +1 -1
- data/lib/vpndetection/models/entitlement_plan.rb +1 -1
- data/lib/vpndetection/models/entitlement_usage.rb +1 -1
- data/lib/vpndetection/models/error_envelope.rb +1 -1
- data/lib/vpndetection/models/identity.rb +1 -1
- data/lib/vpndetection/models/location.rb +409 -0
- data/lib/vpndetection/models/lookup_error.rb +1 -1
- data/lib/vpndetection/models/lookup_response.rb +40 -22
- data/lib/vpndetection/models/oauth_error.rb +1 -1
- data/lib/vpndetection/models/oauth_metadata.rb +1 -1
- data/lib/vpndetection/models/proxy_detail.rb +1 -1
- data/lib/vpndetection/models/pubproxy_detail.rb +1 -1
- data/lib/vpndetection/models/standing.rb +1 -1
- data/lib/vpndetection/models/token_response.rb +1 -1
- data/lib/vpndetection/models/vpn_detail.rb +4 -4
- data/lib/vpndetection/result.rb +41 -17
- data/lib/vpndetection/transport.rb +103 -9
- data/lib/vpndetection/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dedd11823619c5d0503009b84e5b77acf1975d5e1f0a4f3484683543b5b48554
|
|
4
|
+
data.tar.gz: eab3545e7200ff9939caae8a5e42394d7973c92147b59d7e148a9ad8cbdccf41
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 880e2eab30ca0651db6ae6954272ace94c3b3e6986824dc28a6498b40dce87a800513c037a1d6904a7040d5920d2ba7b55146e22d21bc7a69de96d4c4d4f6c77
|
|
7
|
+
data.tar.gz: a832c58a56fb28b0d6637a4b0fb5b64459e2d23d369ccfd31034afb03407edf520a170e4d9cfb021b0bc55dfcb0b352f5045d06cd8ab8d1fc85502d8f39978e9
|
data/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Requires Ruby 3.3 or newer.
|
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
|
-
**No API key needed to start.**
|
|
26
|
+
**No API key needed to start.** Without a key, a lookup answers `ip` and `is_vpn`, up to 1000 a day per source address.
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
29
|
require 'vpndetection'
|
|
@@ -36,16 +36,17 @@ result.is_vpn # => true
|
|
|
36
36
|
|
|
37
37
|
### With an API key
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
A free key adds Tor and relay detection, where the address is and the AS that announces it. Every paid plan answers every field, the same on each, and the plans differ only in how many lookups they include. Create a key in the [console](https://app.vpndetection.io), then pass it in:
|
|
40
40
|
|
|
41
41
|
```ruby
|
|
42
42
|
client = VPNDetection::Client.new(api_key: ENV['VPNDETECTION_API_KEY'])
|
|
43
43
|
|
|
44
44
|
result = client.lookup('45.83.91.1')
|
|
45
45
|
result.is_vpn # => true
|
|
46
|
-
result.
|
|
47
|
-
result.
|
|
48
|
-
result.
|
|
46
|
+
result.location['country'] # the ISO 3166 country code
|
|
47
|
+
result.asn['name'] # who runs the announcing network
|
|
48
|
+
result.vpn['provider'] # => "nordvpn", on a paid plan
|
|
49
|
+
result.is_hosting # => true, on a paid plan
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
### Your own address
|
|
@@ -222,7 +223,7 @@ Check that `state` came back as you sent it before you exchange `code`, which wo
|
|
|
222
223
|
|
|
223
224
|
### Absent is not false
|
|
224
225
|
|
|
225
|
-
|
|
226
|
+
Without a key only `ip` and `is_vpn` come back, and a free key adds Tor, relay, `location` and `asn`. Every other 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".
|
|
226
227
|
|
|
227
228
|
```ruby
|
|
228
229
|
result.hosting? # false when absent, for when you only want the flag
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#The VPNDetection API: classify any IP address, and download the databases behind the answers. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.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
|
|
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 the answer is `ip` and `is_vpn`.
|
|
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
|
|
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 the answer is `ip` and `is_vpn`.
|
|
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
|
|
@@ -151,7 +151,7 @@ module VPNDetection
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
# My IP
|
|
154
|
-
# Answers what is known about the address this request came from, which is the same answer `GET /{ip}` gives for that address: the
|
|
154
|
+
# Answers what is known about the address this request came from, which is the same answer `GET /{ip}` gives for that address: the presented key decides which fields come back, and the request counts against the same allowance. The address is the one our edge observed, so a request through a proxy or a VPN reports the exit it left through rather than the machine that made it. That is usually the point of asking.
|
|
155
155
|
# @param [Hash] opts the optional parameters
|
|
156
156
|
# @return [LookupResponse]
|
|
157
157
|
def lookup_my_ip(opts = {})
|
|
@@ -160,7 +160,7 @@ module VPNDetection
|
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
# My IP
|
|
163
|
-
# Answers what is known about the address this request came from, which is the same answer `GET /{ip}` gives for that address: the
|
|
163
|
+
# Answers what is known about the address this request came from, which is the same answer `GET /{ip}` gives for that address: the presented key decides which fields come back, and the request counts against the same allowance. The address is the one our edge observed, so a request through a proxy or a VPN reports the exit it left through rather than the machine that made it. That is usually the point of asking.
|
|
164
164
|
# @param [Hash] opts the optional parameters
|
|
165
165
|
# @return [Array<(LookupResponse, Integer, Hash)>] LookupResponse data, response status code and response headers
|
|
166
166
|
def lookup_my_ip_with_http_info(opts = {})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#The VPNDetection API: classify any IP address, and download the databases behind the answers. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
data/lib/vpndetection/bogon.rb
CHANGED
|
@@ -32,7 +32,8 @@ module VPNDetection
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# The answer a bogon gets, in the full shape the API serves at its widest
|
|
35
|
-
# plan: every flag present and false, every detail object present and empty
|
|
35
|
+
# plan: every flag present and false, every detail object present and empty,
|
|
36
|
+
# and a location and AS of empty strings and AS 0.
|
|
36
37
|
#
|
|
37
38
|
# `is_bogon` marks it as computed rather than served. Note this is
|
|
38
39
|
# deliberately the WIDEST shape regardless of your plan, so do not infer
|
|
@@ -41,6 +42,8 @@ module VPNDetection
|
|
|
41
42
|
raw = { 'ip' => ip, 'is_bogon' => true }
|
|
42
43
|
Result::FLAGS.each { |flag| raw[flag] = false }
|
|
43
44
|
Result::DETAILS.each { |detail| raw[detail] = {} }
|
|
45
|
+
raw['location'] = Result::LOCATION.to_h { |member| [member, ''] }
|
|
46
|
+
raw['asn'] = Result::ASN.to_h { |member| [member, member == 'asn' ? 0 : ''] }
|
|
44
47
|
Result.new(raw, bogon: true)
|
|
45
48
|
end
|
|
46
49
|
|
data/lib/vpndetection/client.rb
CHANGED
|
@@ -345,9 +345,9 @@ module VPNDetection
|
|
|
345
345
|
def batch_answer(ip, body)
|
|
346
346
|
served = body['results'][ip]
|
|
347
347
|
failed = body['errors'][ip]
|
|
348
|
-
if Transport.
|
|
348
|
+
if Transport.conforms?(served, 'LookupResponse')
|
|
349
349
|
Result.new(served)
|
|
350
|
-
elsif
|
|
350
|
+
elsif Transport.conforms?(failed, 'BatchLookupError')
|
|
351
351
|
Error.from_entry(failed['status'], failed['error'])
|
|
352
352
|
else
|
|
353
353
|
Error.new(:server_error, "the batch answer carried no readable entry for #{ip}", status: 200)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#The VPNDetection API: classify any IP address, and download the databases behind the answers. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#VPNDetection API
|
|
3
|
+
|
|
4
|
+
#The VPNDetection API: classify any IP address, and download the databases behind the answers. 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.10.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
|
+
# The autonomous system that announces the address. Free and paid plans. Each field is present whenever the object is: `asn` is 0 and the rest empty where no announcement covers the address.
|
|
18
|
+
class Asn < ApiModelBase
|
|
19
|
+
# The AS number, 0 when no announcement covers the address.
|
|
20
|
+
attr_accessor :asn
|
|
21
|
+
|
|
22
|
+
# Name of the organization that operates the AS.
|
|
23
|
+
attr_accessor :name
|
|
24
|
+
|
|
25
|
+
# The AS operator's own registrable domain.
|
|
26
|
+
attr_accessor :domain
|
|
27
|
+
|
|
28
|
+
# The kind of network the AS runs: isp, hosting, education, government or business.
|
|
29
|
+
attr_accessor :type
|
|
30
|
+
|
|
31
|
+
# The announced BGP prefix that covers the address, the most specific when several do.
|
|
32
|
+
attr_accessor :prefix
|
|
33
|
+
|
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
|
+
def self.attribute_map
|
|
36
|
+
{
|
|
37
|
+
:'asn' => :'asn',
|
|
38
|
+
:'name' => :'name',
|
|
39
|
+
:'domain' => :'domain',
|
|
40
|
+
:'type' => :'type',
|
|
41
|
+
:'prefix' => :'prefix'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns attribute mapping this model knows about
|
|
46
|
+
def self.acceptable_attribute_map
|
|
47
|
+
attribute_map
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all the JSON keys this model knows about
|
|
51
|
+
def self.acceptable_attributes
|
|
52
|
+
acceptable_attribute_map.values
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
:'asn' => :'Integer',
|
|
59
|
+
:'name' => :'String',
|
|
60
|
+
:'domain' => :'String',
|
|
61
|
+
:'type' => :'String',
|
|
62
|
+
:'prefix' => :'String'
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# List of attributes with nullable: true
|
|
67
|
+
def self.openapi_nullable
|
|
68
|
+
Set.new([
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Initializes the object
|
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
74
|
+
def initialize(attributes = {})
|
|
75
|
+
if (!attributes.is_a?(Hash))
|
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::Asn` initialize method"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
80
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
82
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::Asn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
84
|
+
end
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'asn')
|
|
89
|
+
self.asn = attributes[:'asn']
|
|
90
|
+
else
|
|
91
|
+
self.asn = nil
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'name')
|
|
95
|
+
self.name = attributes[:'name']
|
|
96
|
+
else
|
|
97
|
+
self.name = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'domain')
|
|
101
|
+
self.domain = attributes[:'domain']
|
|
102
|
+
else
|
|
103
|
+
self.domain = nil
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'type')
|
|
107
|
+
self.type = attributes[:'type']
|
|
108
|
+
else
|
|
109
|
+
self.type = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'prefix')
|
|
113
|
+
self.prefix = attributes[:'prefix']
|
|
114
|
+
else
|
|
115
|
+
self.prefix = nil
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
120
|
+
# @return Array for valid properties with the reasons
|
|
121
|
+
def list_invalid_properties
|
|
122
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
123
|
+
invalid_properties = Array.new
|
|
124
|
+
if @asn.nil?
|
|
125
|
+
invalid_properties.push('invalid value for "asn", asn cannot be nil.')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if @name.nil?
|
|
129
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if @domain.nil?
|
|
133
|
+
invalid_properties.push('invalid value for "domain", domain cannot be nil.')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if @type.nil?
|
|
137
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if @prefix.nil?
|
|
141
|
+
invalid_properties.push('invalid value for "prefix", prefix cannot be nil.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
invalid_properties
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Check to see if the all the properties in the model are valid
|
|
148
|
+
# @return true if the model is valid
|
|
149
|
+
def valid?
|
|
150
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
151
|
+
return false if @asn.nil?
|
|
152
|
+
return false if @name.nil?
|
|
153
|
+
return false if @domain.nil?
|
|
154
|
+
return false if @type.nil?
|
|
155
|
+
return false if @prefix.nil?
|
|
156
|
+
true
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Custom attribute writer method with validation
|
|
160
|
+
# @param [Object] asn Value to be assigned
|
|
161
|
+
def asn=(asn)
|
|
162
|
+
if asn.nil?
|
|
163
|
+
fail ArgumentError, 'asn cannot be nil'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
@asn = asn
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Custom attribute writer method with validation
|
|
170
|
+
# @param [Object] name Value to be assigned
|
|
171
|
+
def name=(name)
|
|
172
|
+
if name.nil?
|
|
173
|
+
fail ArgumentError, 'name cannot be nil'
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
@name = name
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Custom attribute writer method with validation
|
|
180
|
+
# @param [Object] domain Value to be assigned
|
|
181
|
+
def domain=(domain)
|
|
182
|
+
if domain.nil?
|
|
183
|
+
fail ArgumentError, 'domain cannot be nil'
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
@domain = domain
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Custom attribute writer method with validation
|
|
190
|
+
# @param [Object] type Value to be assigned
|
|
191
|
+
def type=(type)
|
|
192
|
+
if type.nil?
|
|
193
|
+
fail ArgumentError, 'type cannot be nil'
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
@type = type
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Custom attribute writer method with validation
|
|
200
|
+
# @param [Object] prefix Value to be assigned
|
|
201
|
+
def prefix=(prefix)
|
|
202
|
+
if prefix.nil?
|
|
203
|
+
fail ArgumentError, 'prefix cannot be nil'
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
@prefix = prefix
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Checks equality by comparing each attribute.
|
|
210
|
+
# @param [Object] Object to be compared
|
|
211
|
+
def ==(o)
|
|
212
|
+
return true if self.equal?(o)
|
|
213
|
+
self.class == o.class &&
|
|
214
|
+
asn == o.asn &&
|
|
215
|
+
name == o.name &&
|
|
216
|
+
domain == o.domain &&
|
|
217
|
+
type == o.type &&
|
|
218
|
+
prefix == o.prefix
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# @see the `==` method
|
|
222
|
+
# @param [Object] Object to be compared
|
|
223
|
+
def eql?(o)
|
|
224
|
+
self == o
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Calculates hash code according to all attributes.
|
|
228
|
+
# @return [Integer] Hash code
|
|
229
|
+
def hash
|
|
230
|
+
[asn, name, domain, type, prefix].hash
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# Builds the object from hash
|
|
234
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
235
|
+
# @return [Object] Returns the model itself
|
|
236
|
+
def self.build_from_hash(attributes)
|
|
237
|
+
return nil unless attributes.is_a?(Hash)
|
|
238
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
239
|
+
transformed_hash = {}
|
|
240
|
+
openapi_types.each_pair do |key, type|
|
|
241
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
242
|
+
transformed_hash["#{key}"] = nil
|
|
243
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
244
|
+
# check to ensure the input is an array given that the attribute
|
|
245
|
+
# is documented as an array but the input is not
|
|
246
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
247
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
248
|
+
end
|
|
249
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
250
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
new(transformed_hash)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Returns the object in the form of hash
|
|
257
|
+
# @return [Hash] Returns the object in the form of hash
|
|
258
|
+
def to_hash
|
|
259
|
+
hash = {}
|
|
260
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
261
|
+
value = self.send(attr)
|
|
262
|
+
if value.nil?
|
|
263
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
264
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
hash[param] = _to_hash(value)
|
|
268
|
+
end
|
|
269
|
+
hash
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#The VPNDetection API: classify any IP address, and download the databases behind the answers. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
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. 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.10.
|
|
6
|
+
The version of the OpenAPI document: 2026.10.20
|
|
7
7
|
Contact: support@vpndetection.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|