vpndetection 5.13.0 → 5.13.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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/vpndetection/client.rb +1 -1
- data/lib/vpndetection/errors.rb +4 -5
- data/lib/vpndetection/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19f67b3d99978bf48bc57ce35856bb63f9fb694c84cefcf6a5fafb6d0947cbce
|
|
4
|
+
data.tar.gz: 5edf4e4d3097810bf3d01ca9d4e7c50da761f7796bc10d7d5983f73262e90a36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 854befe2839b82a145d776e357f85ea819470f2474b7e1431141722fec1c64a85cc438b6b6957c9f32edd0fbcd26a3f6aa23e00305e18486f7d62c40c0acfda3
|
|
7
|
+
data.tar.gz: b2bdccc3fb59c98eb863db25e167b17cd6076f5bdd9f98da13eecb38bcd48d5fa9deb5432c43184c2e5093959096046c6036a23a31c6ac363c96eae6c96f49b1
|
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.** Without a key a lookup answers `ip`, `is_vpn`, Tor and relay detection, `location` and `asn`, with no daily or monthly cap
|
|
26
|
+
**No API key needed to start.** Without a key a lookup answers `ip`, `is_vpn`, Tor and relay detection, `location` and `asn`, unlimited, with no daily or monthly cap.
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
29
|
require 'vpndetection'
|
|
@@ -151,7 +151,7 @@ end
|
|
|
151
151
|
|
|
152
152
|
`kind` is one of `:bad_request`, `:unauthorized`, `:forbidden`, `:rate_limited`, `:quota_exceeded`, `:server_error` or `:network`.
|
|
153
153
|
|
|
154
|
-
Note that `:rate_limited` and `:quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is when the API faces extreme traffic bursts
|
|
154
|
+
Note that `:rate_limited` and `:quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is when the API faces extreme traffic bursts and so retrying later works; but a spent quota needs your allowance raised or the window to roll over. The library retries rate limits for you, but not if your quota is exceeded. It waits the `Retry-After` the API sent, or its own backoff from 250 ms when that's past about 24.8 days.
|
|
155
155
|
|
|
156
156
|
### Timeouts and retries
|
|
157
157
|
|
data/lib/vpndetection/client.rb
CHANGED
|
@@ -25,7 +25,7 @@ module VPNDetection
|
|
|
25
25
|
|
|
26
26
|
# @param api_key [String, nil] omit it to look up without one: a lookup then
|
|
27
27
|
# answers `ip`, `is_vpn`, the Tor and relay members, `location` and `asn`,
|
|
28
|
-
#
|
|
28
|
+
# with no daily or monthly cap, and a batch is refused as
|
|
29
29
|
# `:unauthorized`. It is trimmed, and a key of blanks alone is no key.
|
|
30
30
|
# @param cache [Boolean] pass false to disable caching.
|
|
31
31
|
# @param cache_ttl [Numeric] how long an answer stays fresh, in seconds.
|
data/lib/vpndetection/errors.rb
CHANGED
|
@@ -7,11 +7,10 @@ module VPNDetection
|
|
|
7
7
|
# Everything this library raises.
|
|
8
8
|
#
|
|
9
9
|
# `:rate_limited` and `:quota_exceeded` both arrive as HTTP 429 and are NOT the
|
|
10
|
-
# same thing. A rate limit is the API protecting itself
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
# distinguishes them.
|
|
10
|
+
# same thing. A rate limit is the API protecting itself and carries
|
|
11
|
+
# `Retry-After`; retrying works. A spent quota carries no such header and
|
|
12
|
+
# retrying will not help until the window rolls over or the limit is raised.
|
|
13
|
+
# The header is the only thing that distinguishes them.
|
|
15
14
|
class Error < StandardError
|
|
16
15
|
KINDS = %i[
|
|
17
16
|
bad_request unauthorized forbidden rate_limited quota_exceeded server_error network
|
data/lib/vpndetection/version.rb
CHANGED