vpndetection 5.13.0 → 5.13.2
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 +6 -6
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/generated/sdk.gen.d.ts +5 -5
- package/dist/generated/sdk.gen.js +5 -5
- package/dist/generated/types.gen.d.ts +9 -9
- package/dist/types.d.ts +3 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Requires Node.js 22 or newer. TypeScript types are included.
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
**No API key needed to start.**
|
|
20
|
+
**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.
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
23
|
import { VPNDetection } from 'vpndetection';
|
|
@@ -32,7 +32,7 @@ console.log(result.asn?.name); // who runs the announcing network
|
|
|
32
32
|
|
|
33
33
|
### With an API key
|
|
34
34
|
|
|
35
|
-
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
|
|
35
|
+
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:
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
const client = new VPNDetection({ apiKey: process.env.VPNDETECTION_API_KEY });
|
|
@@ -59,7 +59,7 @@ console.log(ent.usage.requests); // 580
|
|
|
59
59
|
console.log(ent.usage.window_end); // when the allowance resets
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
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
|
|
62
|
+
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.
|
|
63
63
|
|
|
64
64
|
### Batch lookup
|
|
65
65
|
|
|
@@ -254,12 +254,12 @@ Each redirect URI must be https on a public host name, or http on a loopback add
|
|
|
254
254
|
|
|
255
255
|
### Absent is not false
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
Unlimited 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".
|
|
258
258
|
|
|
259
259
|
```js
|
|
260
260
|
result.isHosting ?? false // when you only want the flag
|
|
261
|
-
result.isHosting === undefined // on
|
|
262
|
-
result.trialExpired === true // a
|
|
261
|
+
result.isHosting === undefined // on Unlimited: not in your plan
|
|
262
|
+
result.trialExpired === true // a free-plan key's daily trial is spent
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
## Other Libraries
|
package/dist/client.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface DownloadOptions {
|
|
|
36
36
|
}
|
|
37
37
|
export interface Options {
|
|
38
38
|
/**
|
|
39
|
-
* Your API key. Without one a lookup is on the
|
|
39
|
+
* Your API key. Without one a lookup is on Unlimited, the free plan: `ip`,
|
|
40
40
|
* `is_vpn`, the Tor and relay members, `location` and `asn`, with no daily
|
|
41
41
|
* or monthly cap. A batch needs a key on a paid plan.
|
|
42
42
|
*/
|
|
@@ -141,7 +141,7 @@ export declare class VPNDetection {
|
|
|
141
141
|
*
|
|
142
142
|
* Usage counts against the ALLOWANCE WINDOW - on a paid plan the
|
|
143
143
|
* anniversary of the subscription, not the calendar month and not the
|
|
144
|
-
* billing period, and on
|
|
144
|
+
* billing period, and on the free plan the UTC day - and it is the same
|
|
145
145
|
* number a lookup is gated on. It can lag by a few seconds, because
|
|
146
146
|
* requests are counted in memory and flushed in aggregate.
|
|
147
147
|
*
|
|
@@ -166,7 +166,7 @@ export declare class VPNDetection {
|
|
|
166
166
|
* is refused as `bad_request` before anything is sent. An IPv4-mapped address is looked
|
|
167
167
|
* up as the IPv4 address it carries, and its answer keyed as you passed it.
|
|
168
168
|
* The batch endpoint needs a paid plan: without a key every address sent to
|
|
169
|
-
* it carries an `unauthorized` error, and a
|
|
169
|
+
* it carries an `unauthorized` error, and a free-plan key's batch of two or more
|
|
170
170
|
* a `bad_request` (HTTP 402).
|
|
171
171
|
*/
|
|
172
172
|
lookupBatch(ips: Iterable<string>, options?: BatchOptions): Promise<Map<string, Result | VPNDetectionError>>;
|
package/dist/client.js
CHANGED
|
@@ -146,7 +146,7 @@ export class VPNDetection {
|
|
|
146
146
|
*
|
|
147
147
|
* Usage counts against the ALLOWANCE WINDOW - on a paid plan the
|
|
148
148
|
* anniversary of the subscription, not the calendar month and not the
|
|
149
|
-
* billing period, and on
|
|
149
|
+
* billing period, and on the free plan the UTC day - and it is the same
|
|
150
150
|
* number a lookup is gated on. It can lag by a few seconds, because
|
|
151
151
|
* requests are counted in memory and flushed in aggregate.
|
|
152
152
|
*
|
|
@@ -179,7 +179,7 @@ export class VPNDetection {
|
|
|
179
179
|
* is refused as `bad_request` before anything is sent. An IPv4-mapped address is looked
|
|
180
180
|
* up as the IPv4 address it carries, and its answer keyed as you passed it.
|
|
181
181
|
* The batch endpoint needs a paid plan: without a key every address sent to
|
|
182
|
-
* it carries an `unauthorized` error, and a
|
|
182
|
+
* it carries an `unauthorized` error, and a free-plan key's batch of two or more
|
|
183
183
|
* a `bad_request` (HTTP 402).
|
|
184
184
|
*/
|
|
185
185
|
async lookupBatch(ips, options = {}) {
|
|
@@ -17,8 +17,8 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
17
17
|
* Lookup
|
|
18
18
|
*
|
|
19
19
|
* Answers what is known about a single IPv4 or IPv6 address. Which fields
|
|
20
|
-
* come back is decided by the presented key; with no key,
|
|
21
|
-
*
|
|
20
|
+
* come back is decided by the presented key; with no key, on Unlimited,
|
|
21
|
+
* the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members,
|
|
22
22
|
* `location` and `asn`.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
@@ -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>;
|
|
@@ -5,8 +5,8 @@ import { urlSearchParamsBodySerializer } from './client/index.js';
|
|
|
5
5
|
* Lookup
|
|
6
6
|
*
|
|
7
7
|
* Answers what is known about a single IPv4 or IPv6 address. Which fields
|
|
8
|
-
* come back is decided by the presented key; with no key,
|
|
9
|
-
*
|
|
8
|
+
* come back is decided by the presented key; with no key, on Unlimited,
|
|
9
|
+
* the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members,
|
|
10
10
|
* `location` and `asn`.
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
@@ -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;
|
|
@@ -593,15 +593,15 @@ export type EntitlementApikey = {
|
|
|
593
593
|
};
|
|
594
594
|
export type EntitlementPlan = {
|
|
595
595
|
/**
|
|
596
|
-
* The plan the organization is on
|
|
597
|
-
*
|
|
598
|
-
*
|
|
596
|
+
* The plan the organization is on: `free` for the free plan,
|
|
597
|
+
* Unlimited, or a paid plan's key. On `free`, usage counts the
|
|
598
|
+
* day's lookups answered with every field, its daily trial.
|
|
599
599
|
*
|
|
600
600
|
*/
|
|
601
601
|
key: string;
|
|
602
602
|
/**
|
|
603
603
|
* The field tier, which decides how much of a lookup answer comes
|
|
604
|
-
* back; `free` is
|
|
604
|
+
* back; `free` is the free plan's. What each tier includes is documented
|
|
605
605
|
* on the lookup endpoint rather than repeated here, so there is one
|
|
606
606
|
* place it can be wrong.
|
|
607
607
|
*
|
|
@@ -1033,8 +1033,8 @@ export type LookupBatchErrors = {
|
|
|
1033
1033
|
*/
|
|
1034
1034
|
401: LookupError;
|
|
1035
1035
|
/**
|
|
1036
|
-
* The key is
|
|
1037
|
-
*
|
|
1036
|
+
* The key is on the free plan and the batch names more than one
|
|
1037
|
+
* address: a batch needs a paid plan.
|
|
1038
1038
|
*
|
|
1039
1039
|
*/
|
|
1040
1040
|
402: LookupError;
|
package/dist/types.d.ts
CHANGED
|
@@ -30,8 +30,9 @@ export interface Result {
|
|
|
30
30
|
isMobproxy?: boolean;
|
|
31
31
|
isPubproxy?: boolean;
|
|
32
32
|
/**
|
|
33
|
-
* On a
|
|
34
|
-
* UTC day
|
|
33
|
+
* On answers to a key on the free plan only: `false` while its organization's daily trial
|
|
34
|
+
* lasts (every field for the first 100 lookups each UTC day), `true` once the answer has
|
|
35
|
+
* Unlimited's.
|
|
35
36
|
*/
|
|
36
37
|
trialExpired?: boolean;
|
|
37
38
|
vpn?: VpnDetail;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAOA,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,8BAA8B;AAC9B,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,SAAS,GAAwB,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,aAAa,GAAqD;IAC3E,YAAY,EAAE,UAAU,EAAE,cAAc;CAC3C,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAOA,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,8BAA8B;AAC9B,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,SAAS,GAAwB,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AAEpF,MAAM,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