vpndetection-web 1.2.0 → 1.2.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.
- package/README.md +5 -5
- package/dist/client.d.ts +2 -2
- package/dist/client.js +2 -2
- package/dist/generated/sdk.gen.d.ts +3 -3
- package/dist/generated/sdk.gen.js +3 -3
- package/dist/generated/types.gen.d.ts +9 -9
- package/dist/types.d.ts +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ It runs in Chrome and Edge 109, Firefox 115 ESR and Safari 16.4 or newer. TypeSc
|
|
|
30
30
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
|
-
**No API key needed to start.**
|
|
33
|
+
**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. In a page the address calling is the visitor's, so `myIp` tells you about the visitor:
|
|
34
34
|
|
|
35
35
|
```js
|
|
36
36
|
import { VPNDetection } from 'vpndetection-web';
|
|
@@ -48,7 +48,7 @@ console.log(result.asn?.name); // who runs the announcing network
|
|
|
48
48
|
|
|
49
49
|
### With an API key
|
|
50
50
|
|
|
51
|
-
Where the key stays private (see above), every paid plan answers every field: `is_hosting`, `is_cdn` and the four proxy flags as well, and the provider, confidence and last-seen detail behind each flag. The plans differ only in how many lookups they include, and a
|
|
51
|
+
Where the key stays private (see above), every paid plan answers every field: `is_hosting`, `is_cdn` and the four proxy flags as well, and the provider, 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:
|
|
52
52
|
|
|
53
53
|
```js
|
|
54
54
|
const client = new VPNDetection({ apiKey: 'your-api-key' });
|
|
@@ -79,7 +79,7 @@ console.log(ent.usage.requests); // 580
|
|
|
79
79
|
console.log(ent.usage.window_end); // when the allowance resets
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
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
|
|
82
|
+
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 null on an uncapped plan, which is not the same as zero. It needs a key, so it belongs where a key does.
|
|
83
83
|
|
|
84
84
|
### Batch lookup
|
|
85
85
|
|
|
@@ -246,12 +246,12 @@ The library is ES2022 and needs only what a browser has, `fetch` and, for PKCE,
|
|
|
246
246
|
|
|
247
247
|
### Absent is not false
|
|
248
248
|
|
|
249
|
-
The Unlimited tier leaves out `isHosting`, `isCdn` and the four proxy flags, and of the detail behind each flag it answers only Tor's and relay's; a
|
|
249
|
+
The Unlimited tier leaves out `isHosting`, `isCdn` 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 `trialExpired`, true once its daily trial is spent. A field your key does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
|
|
250
250
|
|
|
251
251
|
```js
|
|
252
252
|
result.isHosting ?? false // when you only want the flag
|
|
253
253
|
result.isHosting === undefined // on the Unlimited tier: not in your plan
|
|
254
|
-
result.trialExpired === true // a
|
|
254
|
+
result.trialExpired === true // a free-plan key's daily trial is spent
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
## Other Libraries
|
package/dist/client.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ export declare class VPNDetection {
|
|
|
123
123
|
*
|
|
124
124
|
* Usage counts against the ALLOWANCE WINDOW - on a paid plan the
|
|
125
125
|
* anniversary of the subscription, not the calendar month and not the
|
|
126
|
-
* billing period, and on
|
|
126
|
+
* billing period, and on the free plan the UTC day - and it is the same
|
|
127
127
|
* number a lookup is gated on. It can lag by a few seconds, because
|
|
128
128
|
* requests are counted in memory and flushed in aggregate.
|
|
129
129
|
*
|
|
@@ -149,7 +149,7 @@ export declare class VPNDetection {
|
|
|
149
149
|
* An IPv4-mapped address is looked up as the IPv4 address it carries, and its
|
|
150
150
|
* answer keyed as you passed it. The batch endpoint needs a paid plan:
|
|
151
151
|
* without a key every address sent to it carries an `unauthorized` error,
|
|
152
|
-
* and a
|
|
152
|
+
* and a free-plan key's batch of two or more a `bad_request` (HTTP 402).
|
|
153
153
|
*/
|
|
154
154
|
lookupBatch(ips: Iterable<string>, options?: BatchOptions): Promise<Map<string, Result | VPNDetectionError>>;
|
|
155
155
|
private unstored;
|
package/dist/client.js
CHANGED
|
@@ -163,7 +163,7 @@ export class VPNDetection {
|
|
|
163
163
|
*
|
|
164
164
|
* Usage counts against the ALLOWANCE WINDOW - on a paid plan the
|
|
165
165
|
* anniversary of the subscription, not the calendar month and not the
|
|
166
|
-
* billing period, and on
|
|
166
|
+
* billing period, and on the free plan the UTC day - and it is the same
|
|
167
167
|
* number a lookup is gated on. It can lag by a few seconds, because
|
|
168
168
|
* requests are counted in memory and flushed in aggregate.
|
|
169
169
|
*
|
|
@@ -197,7 +197,7 @@ export class VPNDetection {
|
|
|
197
197
|
* An IPv4-mapped address is looked up as the IPv4 address it carries, and its
|
|
198
198
|
* answer keyed as you passed it. The batch endpoint needs a paid plan:
|
|
199
199
|
* without a key every address sent to it carries an `unauthorized` error,
|
|
200
|
-
* and a
|
|
200
|
+
* and a free-plan key's batch of two or more a `bad_request` (HTTP 402).
|
|
201
201
|
*/
|
|
202
202
|
async lookupBatch(ips, options = {}) {
|
|
203
203
|
const concurrency = checkConcurrency(options.concurrency);
|
|
@@ -59,9 +59,9 @@ export declare const lookupMyIp: <ThrowOnError extends boolean = false>(options?
|
|
|
59
59
|
* and never a throttle.
|
|
60
60
|
*
|
|
61
61
|
* A batch needs a paid plan: without a key the call is refused with `401`,
|
|
62
|
-
* and with a
|
|
63
|
-
* answered as `GET /{ip}` would answer it. Unlimited
|
|
64
|
-
*
|
|
62
|
+
* and with a key on the free plan with `402`, unless it names one address,
|
|
63
|
+
* which is answered as `GET /{ip}` would answer it. Unlimited looks up one
|
|
64
|
+
* address at a time.
|
|
65
65
|
*
|
|
66
66
|
*/
|
|
67
67
|
export declare const lookupBatch: <ThrowOnError extends boolean = false>(options: Options<LookupBatchData, ThrowOnError>) => RequestResult<LookupBatchResponses, LookupBatchErrors, ThrowOnError>;
|
|
@@ -71,9 +71,9 @@ export const lookupMyIp = (options) => (options?.client ?? client).get({
|
|
|
71
71
|
* and never a throttle.
|
|
72
72
|
*
|
|
73
73
|
* A batch needs a paid plan: without a key the call is refused with `401`,
|
|
74
|
-
* and with a
|
|
75
|
-
* answered as `GET /{ip}` would answer it. Unlimited
|
|
76
|
-
*
|
|
74
|
+
* and with a key on the free plan with `402`, unless it names one address,
|
|
75
|
+
* which is answered as `GET /{ip}` would answer it. Unlimited looks up one
|
|
76
|
+
* address at a time.
|
|
77
77
|
*
|
|
78
78
|
*/
|
|
79
79
|
export const lookupBatch = (options) => (options.client ?? client).post({
|
|
@@ -96,9 +96,9 @@ export type LookupResponse = {
|
|
|
96
96
|
location?: Location;
|
|
97
97
|
asn?: Asn;
|
|
98
98
|
/**
|
|
99
|
-
* On every answer to a
|
|
100
|
-
*
|
|
101
|
-
*
|
|
99
|
+
* On every answer to a key on the free plan, and on no other: `false`
|
|
100
|
+
* while its organization's daily trial lasts (every field for the first
|
|
101
|
+
* 100 lookups each UTC day), `true` once the answer has Unlimited's.
|
|
102
102
|
*
|
|
103
103
|
*/
|
|
104
104
|
trial_expired?: boolean;
|
|
@@ -409,15 +409,15 @@ export type EntitlementApikey = {
|
|
|
409
409
|
};
|
|
410
410
|
export type EntitlementPlan = {
|
|
411
411
|
/**
|
|
412
|
-
* The plan the organization is on
|
|
413
|
-
*
|
|
414
|
-
*
|
|
412
|
+
* The plan the organization is on: `free` for the free plan,
|
|
413
|
+
* Unlimited, or a paid plan's key. On `free`, usage counts the
|
|
414
|
+
* day's lookups answered with every field, its daily trial.
|
|
415
415
|
*
|
|
416
416
|
*/
|
|
417
417
|
key: string;
|
|
418
418
|
/**
|
|
419
419
|
* The field tier, which decides how much of a lookup answer comes
|
|
420
|
-
* back; `free` is
|
|
420
|
+
* back; `free` is the free plan's. What each tier includes is documented
|
|
421
421
|
* on the lookup endpoint rather than repeated here, so there is one
|
|
422
422
|
* place it can be wrong.
|
|
423
423
|
*
|
|
@@ -675,8 +675,8 @@ export type LookupBatchErrors = {
|
|
|
675
675
|
*/
|
|
676
676
|
401: LookupError;
|
|
677
677
|
/**
|
|
678
|
-
* The key is
|
|
679
|
-
*
|
|
678
|
+
* The key is on the free plan and the batch names more than one
|
|
679
|
+
* address: a batch needs a paid plan.
|
|
680
680
|
*
|
|
681
681
|
*/
|
|
682
682
|
402: LookupError;
|
package/dist/types.d.ts
CHANGED
|
@@ -27,8 +27,9 @@ export interface Result {
|
|
|
27
27
|
isMobproxy?: boolean;
|
|
28
28
|
isPubproxy?: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* On a
|
|
31
|
-
* UTC day
|
|
30
|
+
* On answers to a key on the free plan only: `false` while its organization's daily trial
|
|
31
|
+
* lasts (every field for the first 100 lookups each UTC day), `true` once the answer has
|
|
32
|
+
* Unlimited's.
|
|
32
33
|
*/
|
|
33
34
|
trialExpired?: boolean;
|
|
34
35
|
vpn?: VpnDetail;
|
package/package.json
CHANGED