vpndetection-web 1.2.1 → 1.3.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.
- package/README.md +3 -3
- package/dist/bogon.d.ts +1 -2
- package/dist/bogon.js +1 -2
- package/dist/client.d.ts +5 -3
- package/dist/client.js +4 -2
- package/dist/generated/sdk.gen.d.ts +4 -4
- package/dist/generated/sdk.gen.js +4 -4
- package/dist/generated/types.gen.d.ts +35 -8
- package/dist/shapes.js +5 -5
- package/dist/types.d.ts +4 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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 free account tries every field, 100 lookups a day. Create a key in the [console](https://app.vpndetection.io), then pass it in:
|
|
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 (its ID and its name), 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' });
|
|
@@ -246,11 +246,11 @@ 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
|
-
|
|
249
|
+
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".
|
|
250
250
|
|
|
251
251
|
```js
|
|
252
252
|
result.isHosting ?? false // when you only want the flag
|
|
253
|
-
result.isHosting === undefined // on
|
|
253
|
+
result.isHosting === undefined // on Unlimited: not in your plan
|
|
254
254
|
result.trialExpired === true // a free-plan key's daily trial is spent
|
|
255
255
|
```
|
|
256
256
|
|
package/dist/bogon.d.ts
CHANGED
|
@@ -21,8 +21,7 @@ export declare function unmapped(ip: string): string;
|
|
|
21
21
|
* every flag present and false, every detail object present and empty, and
|
|
22
22
|
* `location` and `asn` with every key empty, as the API answers a bogon.
|
|
23
23
|
*
|
|
24
|
-
* `isBogon` is
|
|
25
|
-
* served one. Note this is deliberately the WIDEST shape regardless of your
|
|
24
|
+
* `isBogon` is true, as the API answers reserved space. Note this is deliberately the WIDEST shape regardless of your
|
|
26
25
|
* plan, so do not infer which fields your plan includes from a bogon answer.
|
|
27
26
|
*/
|
|
28
27
|
export declare function bogonResult(ip: string): Result;
|
package/dist/bogon.js
CHANGED
|
@@ -39,8 +39,7 @@ export function unmapped(ip) {
|
|
|
39
39
|
* every flag present and false, every detail object present and empty, and
|
|
40
40
|
* `location` and `asn` with every key empty, as the API answers a bogon.
|
|
41
41
|
*
|
|
42
|
-
* `isBogon` is
|
|
43
|
-
* served one. Note this is deliberately the WIDEST shape regardless of your
|
|
42
|
+
* `isBogon` is true, as the API answers reserved space. Note this is deliberately the WIDEST shape regardless of your
|
|
44
43
|
* plan, so do not infer which fields your plan includes from a bogon answer.
|
|
45
44
|
*/
|
|
46
45
|
export function bogonResult(ip) {
|
package/dist/client.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface CacheOptions {
|
|
|
18
18
|
}
|
|
19
19
|
export interface Options {
|
|
20
20
|
/**
|
|
21
|
-
* Your API key. Without one a lookup is on the
|
|
21
|
+
* Your API key. Without one a lookup is on Unlimited, the free plan: `ip`,
|
|
22
22
|
* `is_vpn`, the Tor and relay members, `location` and `asn`, with no daily
|
|
23
23
|
* or monthly cap. A batch needs a key on a paid plan.
|
|
24
24
|
* A key in a web page is readable by anyone who opens the page.
|
|
@@ -148,8 +148,10 @@ export declare class VPNDetection {
|
|
|
148
148
|
* `concurrency` below 1 is refused as `bad_request` before anything is sent.
|
|
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
|
-
* without a key every address
|
|
152
|
-
* and a free-plan key's
|
|
151
|
+
* without a key every address in a request of two or more carries an
|
|
152
|
+
* `unauthorized` error, and a free-plan key's request of two or more a
|
|
153
|
+
* `bad_request` (HTTP 402). A request of one address is answered as its
|
|
154
|
+
* lookup would be.
|
|
153
155
|
*/
|
|
154
156
|
lookupBatch(ips: Iterable<string>, options?: BatchOptions): Promise<Map<string, Result | VPNDetectionError>>;
|
|
155
157
|
private unstored;
|
package/dist/client.js
CHANGED
|
@@ -196,8 +196,10 @@ export class VPNDetection {
|
|
|
196
196
|
* `concurrency` below 1 is refused as `bad_request` before anything is sent.
|
|
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
|
-
* without a key every address
|
|
200
|
-
* and a free-plan key's
|
|
199
|
+
* without a key every address in a request of two or more carries an
|
|
200
|
+
* `unauthorized` error, and a free-plan key's request of two or more a
|
|
201
|
+
* `bad_request` (HTTP 402). A request of one address is answered as its
|
|
202
|
+
* lookup would be.
|
|
201
203
|
*/
|
|
202
204
|
async lookupBatch(ips, options = {}) {
|
|
203
205
|
const concurrency = checkConcurrency(options.concurrency);
|
|
@@ -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
|
*/
|
|
@@ -60,8 +60,8 @@ export declare const lookupMyIp: <ThrowOnError extends boolean = false>(options?
|
|
|
60
60
|
*
|
|
61
61
|
* A batch needs a paid plan: without a key the call is refused with `401`,
|
|
62
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
|
|
64
|
-
* address at a time.
|
|
63
|
+
* which is answered as `GET /{ip}` would answer it, under the same rate
|
|
64
|
+
* limit. Unlimited looks up one 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
|
*/
|
|
@@ -72,8 +72,8 @@ export const lookupMyIp = (options) => (options?.client ?? client).get({
|
|
|
72
72
|
*
|
|
73
73
|
* A batch needs a paid plan: without a key the call is refused with `401`,
|
|
74
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
|
|
76
|
-
* address at a time.
|
|
75
|
+
* which is answered as `GET /{ip}` would answer it, under the same rate
|
|
76
|
+
* limit. Unlimited looks up one address at a time.
|
|
77
77
|
*
|
|
78
78
|
*/
|
|
79
79
|
export const lookupBatch = (options) => (options.client ?? client).post({
|
|
@@ -2,8 +2,8 @@ export type ClientOptions = {
|
|
|
2
2
|
baseUrl: 'https://api.vpndetection.io' | (string & {});
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
|
-
* The union of every tier's answer. Every answer carries `ip`, `
|
|
6
|
-
* the Tor and relay members, `location` and `asn`, with or without a key;
|
|
5
|
+
* The union of every tier's answer. Every answer carries `ip`, `is_bogon`,
|
|
6
|
+
* `is_vpn`, the Tor and relay members, `location` and `asn`, with or without a key;
|
|
7
7
|
* each remaining field is present when your tier includes it, and absent
|
|
8
8
|
* otherwise. A client that must work across plans should treat an absent
|
|
9
9
|
* flag as unknown rather than as `false`.
|
|
@@ -14,6 +14,13 @@ export type LookupResponse = {
|
|
|
14
14
|
* The address that was looked up, normalized.
|
|
15
15
|
*/
|
|
16
16
|
ip: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the address is reserved space (RFC 1918, loopback, link-local,
|
|
19
|
+
* documentation ranges and their IPv6 equivalents), answered from the
|
|
20
|
+
* address alone. Every answer, with or without a key.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
is_bogon?: boolean;
|
|
17
24
|
/**
|
|
18
25
|
* Whether the address is VPN infrastructure. Keys off presence in the
|
|
19
26
|
* VPN dataset, so an unattributed range with no provider is still
|
|
@@ -68,8 +75,8 @@ export type LookupResponse = {
|
|
|
68
75
|
relay?: ClassDetail;
|
|
69
76
|
/**
|
|
70
77
|
* Detail for `is_tor`. Empty when false. Every answer, with or without a
|
|
71
|
-
* key. The tor dataset carries no provider, so `provider`
|
|
72
|
-
* empty
|
|
78
|
+
* key. The tor dataset carries no provider, so `provider` and
|
|
79
|
+
* `provider_name` are always empty strings.
|
|
73
80
|
*
|
|
74
81
|
*/
|
|
75
82
|
tor?: ClassDetail;
|
|
@@ -155,9 +162,15 @@ export type BatchLookupError = {
|
|
|
155
162
|
*/
|
|
156
163
|
export type VpnDetail = {
|
|
157
164
|
/**
|
|
158
|
-
* The VPN provider, or an empty string for an unattributed range.
|
|
165
|
+
* The VPN provider's ID, or an empty string for an unattributed range.
|
|
159
166
|
*/
|
|
160
167
|
provider?: string;
|
|
168
|
+
/**
|
|
169
|
+
* The name the provider catalog gives the provider, beside the ID to key on;
|
|
170
|
+
* an empty string where the catalog names none or the range is unattributed.
|
|
171
|
+
*
|
|
172
|
+
*/
|
|
173
|
+
provider_name?: string;
|
|
161
174
|
/**
|
|
162
175
|
* The most recent date this address was observed as VPN infrastructure.
|
|
163
176
|
*/
|
|
@@ -184,9 +197,15 @@ export type VpnDetail = {
|
|
|
184
197
|
*/
|
|
185
198
|
export type ClassDetail = {
|
|
186
199
|
/**
|
|
187
|
-
* The provider, or an empty string where the dataset has none.
|
|
200
|
+
* The provider's ID, or an empty string where the dataset has none.
|
|
188
201
|
*/
|
|
189
202
|
provider?: string;
|
|
203
|
+
/**
|
|
204
|
+
* The name the provider catalog gives the provider; an empty string where the
|
|
205
|
+
* catalog names none or the dataset has no provider.
|
|
206
|
+
*
|
|
207
|
+
*/
|
|
208
|
+
provider_name?: string;
|
|
190
209
|
/**
|
|
191
210
|
* How strongly the classification is supported.
|
|
192
211
|
*/
|
|
@@ -206,9 +225,15 @@ export type ClassDetail = {
|
|
|
206
225
|
*/
|
|
207
226
|
export type ProxyDetail = {
|
|
208
227
|
/**
|
|
209
|
-
* The proxy network, or an empty string where unattributed.
|
|
228
|
+
* The proxy network's ID, or an empty string where unattributed.
|
|
210
229
|
*/
|
|
211
230
|
provider?: string;
|
|
231
|
+
/**
|
|
232
|
+
* The name the provider catalog gives the proxy network; an empty string where
|
|
233
|
+
* the catalog names none or the address is unattributed.
|
|
234
|
+
*
|
|
235
|
+
*/
|
|
236
|
+
provider_name?: string;
|
|
212
237
|
/**
|
|
213
238
|
* The earliest date within the window this address was seen in the
|
|
214
239
|
* pool, as of its last day in the window once it has left.
|
|
@@ -671,7 +696,9 @@ export type LookupBatchErrors = {
|
|
|
671
696
|
*/
|
|
672
697
|
400: LookupError;
|
|
673
698
|
/**
|
|
674
|
-
* No API key was presented
|
|
699
|
+
* No API key was presented for more than one address, or the one
|
|
700
|
+
* presented is unknown, revoked, or expired.
|
|
701
|
+
*
|
|
675
702
|
*/
|
|
676
703
|
401: LookupError;
|
|
677
704
|
/**
|
package/dist/shapes.js
CHANGED
|
@@ -15,21 +15,21 @@ export const ENTITLEMENT_APIKEY_MEMBERS = ['id', 'allowed_cidrs'];
|
|
|
15
15
|
export const ENTITLEMENT_PLAN_MEMBERS = ['key', 'tier'];
|
|
16
16
|
export const ENTITLEMENT_USAGE_MEMBERS = ['requests', 'quota', 'window_start', 'window_end'];
|
|
17
17
|
export const LOOKUP_TYPES = {
|
|
18
|
-
ip: 'string', is_vpn: 'boolean', is_hosting: 'boolean', is_relay: 'boolean', is_tor: 'boolean',
|
|
18
|
+
ip: 'string', is_bogon: 'boolean', is_vpn: 'boolean', is_hosting: 'boolean', is_relay: 'boolean', is_tor: 'boolean',
|
|
19
19
|
is_cdn: 'boolean', is_resproxy: 'boolean', is_dcproxy: 'boolean', is_mobproxy: 'boolean',
|
|
20
20
|
is_pubproxy: 'boolean', vpn: 'object', hosting: 'object', relay: 'object', tor: 'object', cdn: 'object',
|
|
21
21
|
resproxy: 'object', dcproxy: 'object', mobproxy: 'object', pubproxy: 'object', location: 'object',
|
|
22
22
|
asn: 'object', trial_expired: 'boolean',
|
|
23
23
|
};
|
|
24
24
|
export const VPN_DETAIL_TYPES = {
|
|
25
|
-
provider: 'string', last_seen: 'date', confidence: 'string', method: 'string',
|
|
25
|
+
provider: 'string', provider_name: 'string', last_seen: 'date', confidence: 'string', method: 'string',
|
|
26
26
|
};
|
|
27
27
|
export const CLASS_DETAIL_TYPES = {
|
|
28
|
-
provider: 'string', confidence: 'string', last_seen: 'date',
|
|
28
|
+
provider: 'string', provider_name: 'string', confidence: 'string', last_seen: 'date',
|
|
29
29
|
};
|
|
30
30
|
export const PROXY_DETAIL_TYPES = {
|
|
31
|
-
provider: 'string',
|
|
32
|
-
providers_num: 'integer',
|
|
31
|
+
provider: 'string', provider_name: 'string', first_seen: 'date', last_seen: 'date', hits: 'integer',
|
|
32
|
+
hits_days_pct: 'integer', providers_num: 'integer',
|
|
33
33
|
};
|
|
34
34
|
export const PUBPROXY_DETAIL_TYPES = {
|
|
35
35
|
entry: 'boolean', exit: 'boolean', protocols: 'array', num_ports: 'integer', num_proxies: 'integer',
|
package/dist/types.d.ts
CHANGED
|
@@ -16,7 +16,10 @@ export interface Result {
|
|
|
16
16
|
ip: string;
|
|
17
17
|
/** Whether the address is VPN infrastructure. Every plan includes this. */
|
|
18
18
|
isVpn: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Whether the address is reserved space (private, loopback, documentation and the like), which
|
|
21
|
+
* this package answers locally without a request. A served answer carries the API's own `is_bogon`.
|
|
22
|
+
*/
|
|
20
23
|
isBogon: boolean;
|
|
21
24
|
isHosting?: boolean;
|
|
22
25
|
isRelay?: boolean;
|
package/dist/types.js
CHANGED
package/package.json
CHANGED