vpndetection-web 1.6.0 → 1.7.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 +5 -5
- package/dist/bogon.js +2 -0
- package/dist/client.d.ts +3 -3
- package/dist/client.js +18 -3
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/types.gen.d.ts +112 -4
- package/dist/index.d.ts +1 -1
- package/dist/shapes.d.ts +2 -1
- package/dist/shapes.js +8 -2
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/types.d.ts +21 -2
- package/dist/types.js +1 -1
- 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.** Unlimited, the free plan, answers `ip`, `is_vpn`, Tor and relay detection, `is_anycast`, `hostname` (the reverse DNS name), country-level `location` and `asn` with the AS's country and RPKI status, 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:
|
|
33
|
+
**No API key needed to start.** Unlimited, the free plan, answers `ip`, `is_vpn`, Tor and relay detection, `is_bot` (whether a bot such as a crawler uses the address), `is_anycast`, `hostname` (the reverse DNS name), country-level `location` and `asn` with the AS's country and RPKI status, 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, the carrier and satellite flags, the five service flags (SSH, SMTP, web, DNS resolver and BitTorrent), city-level `location`, the `company` and the `abuse` contact, 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. 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, the carrier and satellite flags, the five service flags (SSH, SMTP, web, DNS resolver and BitTorrent), `bot` (whose bot it is and whether its operator vouches for the address), city-level `location`, the `company` and the `abuse` contact, 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. 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' });
|
|
@@ -80,7 +80,7 @@ console.log(ent.usage.requests); // 580
|
|
|
80
80
|
console.log(ent.usage.window_end); // when the allowance resets
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and against the
|
|
83
|
+
Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and against the trial 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.
|
|
84
84
|
|
|
85
85
|
Show `plan.name` and compare against `plan.key`: a plan's name can change, and its key never does. A `tier` the API adds later comes back as the string it served, so check for the values you know rather than assuming the list is complete.
|
|
86
86
|
|
|
@@ -122,7 +122,7 @@ const result2 = await client.lookup('45.83.91.1');
|
|
|
122
122
|
console.log(result2.isVpn); // true, no API request, result was cached
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
You can change the default cache variables (max size, TTL, etc) on initialization, or even disable it:
|
|
125
|
+
You can change the default cache variables (max size, TTL, etc) on initialization, or even disable it. Each is a whole number from 1:
|
|
126
126
|
|
|
127
127
|
```js
|
|
128
128
|
const client = new VPNDetection({ cache: { max: 50_000, ttlMs: 6 * 60 * 60 * 1000 } });
|
|
@@ -251,7 +251,7 @@ The library is ES2022 and needs only what a browser has, `fetch` and, for PKCE,
|
|
|
251
251
|
|
|
252
252
|
### Absent is not false
|
|
253
253
|
|
|
254
|
-
Unlimited leaves out `isHosting`, `isCdn`, the four proxy flags, the carrier, satellite and service flags, `company` and `abuse`, 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 trial is spent, and a paid key's carries `capReached`, true once its organization's overage cap is reached and the answer has Unlimited's. A field your key does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
|
|
254
|
+
Unlimited leaves out `isHosting`, `isCdn`, the four proxy flags, the carrier, satellite and service flags, `bot`, `company` and `abuse`, 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 trial is spent, and a paid key's carries `capReached`, true once its organization's overage cap is reached and the answer has Unlimited's. A field your key does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
|
|
255
255
|
|
|
256
256
|
```js
|
|
257
257
|
result.isHosting ?? false // when you only want the flag
|
package/dist/bogon.js
CHANGED
|
@@ -64,6 +64,7 @@ export function bogonResult(ip) {
|
|
|
64
64
|
isWeb: false,
|
|
65
65
|
isDnsResolver: false,
|
|
66
66
|
isBittorrent: false,
|
|
67
|
+
isBot: false,
|
|
67
68
|
vpn: {},
|
|
68
69
|
hosting: {},
|
|
69
70
|
relay: {},
|
|
@@ -80,6 +81,7 @@ export function bogonResult(ip) {
|
|
|
80
81
|
web: [],
|
|
81
82
|
dnsResolver: {},
|
|
82
83
|
bittorrent: {},
|
|
84
|
+
bot: {},
|
|
83
85
|
location: {
|
|
84
86
|
continent: '',
|
|
85
87
|
continent_name: '',
|
package/dist/client.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { type CacheStore } from './store.js';
|
|
|
5
5
|
import { type Result } from './types.js';
|
|
6
6
|
export declare const DEFAULT_BASE_URL = "https://api.vpndetection.io";
|
|
7
7
|
export interface CacheOptions {
|
|
8
|
-
/** Maximum number of addresses held in memory. Default 10000. */
|
|
8
|
+
/** Maximum number of addresses held in memory, a whole number from 1. Default 10000. */
|
|
9
9
|
max?: number;
|
|
10
10
|
/**
|
|
11
|
-
* How long an answer stays fresh, in milliseconds. Default 1 hour. An answer
|
|
11
|
+
* How long an answer stays fresh, in whole milliseconds from 1. Default 1 hour. An answer
|
|
12
12
|
* marked `trialExpired` or `capReached` stays a minute at most.
|
|
13
13
|
*/
|
|
14
14
|
ttlMs?: number;
|
|
@@ -126,7 +126,7 @@ export declare class VPNDetection {
|
|
|
126
126
|
*
|
|
127
127
|
* Usage counts against the ALLOWANCE WINDOW - on a paid plan the
|
|
128
128
|
* anniversary of the subscription, not the calendar month and not the
|
|
129
|
-
* billing period, and on the free plan the
|
|
129
|
+
* billing period, and on the free plan the trial - and it is the same
|
|
130
130
|
* number a lookup is gated on. It can lag by a few seconds, because
|
|
131
131
|
* requests are counted in memory and flushed in aggregate.
|
|
132
132
|
*
|
package/dist/client.js
CHANGED
|
@@ -54,9 +54,9 @@ export class VPNDetection {
|
|
|
54
54
|
this.timeoutMs = checkTimeout(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS;
|
|
55
55
|
this.limit = pLimit(checkConcurrency(options.concurrency) ?? 8);
|
|
56
56
|
const cache = options.cache === false ? null : (options.cache ?? {});
|
|
57
|
-
const ttlMs = cache?.ttlMs ?? 60 * 60 * 1000;
|
|
57
|
+
const ttlMs = checkCacheOption('ttlMs', cache?.ttlMs) ?? 60 * 60 * 1000;
|
|
58
58
|
this.cache = cache === null ? null : new LRUCache({
|
|
59
|
-
max: cache.max ?? 10_000,
|
|
59
|
+
max: checkCacheOption('max', cache.max) ?? 10_000,
|
|
60
60
|
ttl: ttlMs,
|
|
61
61
|
// Concurrent misses for one address share one request: every
|
|
62
62
|
// `fetch()` while it is in flight gets the same promise, and a
|
|
@@ -167,7 +167,7 @@ export class VPNDetection {
|
|
|
167
167
|
*
|
|
168
168
|
* Usage counts against the ALLOWANCE WINDOW - on a paid plan the
|
|
169
169
|
* anniversary of the subscription, not the calendar month and not the
|
|
170
|
-
* billing period, and on the free plan the
|
|
170
|
+
* billing period, and on the free plan the trial - and it is the same
|
|
171
171
|
* number a lookup is gated on. It can lag by a few seconds, because
|
|
172
172
|
* requests are counted in memory and flushed in aggregate.
|
|
173
173
|
*
|
|
@@ -373,6 +373,21 @@ function checkApiKey(apiKey) {
|
|
|
373
373
|
}
|
|
374
374
|
return key === '' ? undefined : key;
|
|
375
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* A cache size or TTL refused where it is set, `null` reading as unset. lru-cache
|
|
378
|
+
* reads a zero or NaN TTL as none, which would keep every answer for good, a spent
|
|
379
|
+
* trial's included, and a zero size as no bound; anything else not whole it throws
|
|
380
|
+
* a bare TypeError for.
|
|
381
|
+
*/
|
|
382
|
+
function checkCacheOption(name, value) {
|
|
383
|
+
if (value === undefined || value === null) {
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
if (!(typeof value === 'number' && Number.isSafeInteger(value) && value >= 1)) {
|
|
387
|
+
throw new VPNDetectionError('bad_request', `cache.${name} must be a whole number from 1, got ${String(value)}`);
|
|
388
|
+
}
|
|
389
|
+
return value;
|
|
390
|
+
}
|
|
376
391
|
function unreadableEntry(ip) {
|
|
377
392
|
return new VPNDetectionError('server_error', `unreadable batch answer for ${ip}, status 200`, 200);
|
|
378
393
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { lookupBatch, lookupIp, lookupMyIp, myEntitlement, oauthMetadata, oauthRevoke, oauthToken, type Options } from './sdk.gen.js';
|
|
2
|
-
export type { AbuseContact, Asn, BatchLookupError, BatchLookupRequest, BatchLookupResponse, BitTorrentDetail, CarrierDetail, ClassDetail, ClientOptions, Company, DnsResolverDetail, Entitlement, EntitlementApikey, EntitlementError, EntitlementPlan, EntitlementUsage, Location, LookupBatchData, LookupBatchError, LookupBatchErrors, LookupBatchResponse, LookupBatchResponses, LookupError, LookupIpData, LookupIpError, LookupIpErrors, LookupIpResponse, LookupIpResponses, LookupMyIpData, LookupMyIpError, LookupMyIpErrors, LookupMyIpResponse, LookupMyIpResponses, LookupResponse, MyEntitlementData, MyEntitlementError, MyEntitlementErrors, MyEntitlementResponse, MyEntitlementResponses, OauthError, OauthMetadata, OauthMetadataData, OauthMetadataResponse, OauthMetadataResponses, OauthRevokeData, OauthRevokeResponse, OauthRevokeResponses, OauthTokenData, OauthTokenError, OauthTokenErrors, OauthTokenResponse, OauthTokenResponses, ProxyDetail, PubproxyDetail, RevokeRequest, SatelliteDetail, SmtpDetail, SshDetail, TokenRequest, TokenResponse, VpnDetail, WebDetail } from './types.gen.js';
|
|
2
|
+
export type { AbuseContact, Asn, BatchLookupError, BatchLookupRequest, BatchLookupResponse, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, ClientOptions, Company, DnsResolverDetail, Entitlement, EntitlementApikey, EntitlementError, EntitlementPlan, EntitlementUsage, Location, LookupBatchData, LookupBatchError, LookupBatchErrors, LookupBatchResponse, LookupBatchResponses, LookupError, LookupIpData, LookupIpError, LookupIpErrors, LookupIpResponse, LookupIpResponses, LookupMyIpData, LookupMyIpError, LookupMyIpErrors, LookupMyIpResponse, LookupMyIpResponses, LookupResponse, MyEntitlementData, MyEntitlementError, MyEntitlementErrors, MyEntitlementResponse, MyEntitlementResponses, OauthError, OauthMetadata, OauthMetadataData, OauthMetadataResponse, OauthMetadataResponses, OauthRevokeData, OauthRevokeResponse, OauthRevokeResponses, OauthTokenData, OauthTokenError, OauthTokenErrors, OauthTokenResponse, OauthTokenResponses, ProxyDetail, PubproxyDetail, RevokeRequest, SatelliteDetail, SmtpDetail, SshDetail, TokenRequest, TokenResponse, UserAgentVerdict, VpnDetail, WebDetail } from './types.gen.js';
|
|
@@ -45,6 +45,10 @@ export type LookupResponse = {
|
|
|
45
45
|
* Whether the address belongs to a CDN. Paid plans.
|
|
46
46
|
*/
|
|
47
47
|
is_cdn?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether an automated client uses the address, such as a search engine's or an AI company's crawler, an uptime monitor, an internet scanner or a webhook sender. `bot` says whose, what it does and whether its operator vouches for the address. Every answer, with or without a key.
|
|
50
|
+
*/
|
|
51
|
+
is_bot?: boolean;
|
|
48
52
|
/**
|
|
49
53
|
* Whether the address was seen in a residential proxy pool. Paid plans.
|
|
50
54
|
*/
|
|
@@ -117,6 +121,10 @@ export type LookupResponse = {
|
|
|
117
121
|
* Detail for `is_cdn`. Empty when false. Paid plans.
|
|
118
122
|
*/
|
|
119
123
|
cdn?: ClassDetail;
|
|
124
|
+
/**
|
|
125
|
+
* Detail for `is_bot`. Empty when false. Paid plans.
|
|
126
|
+
*/
|
|
127
|
+
bot?: BotDetail;
|
|
120
128
|
/**
|
|
121
129
|
* Detail for `is_resproxy`. Empty when false. Paid plans.
|
|
122
130
|
*/
|
|
@@ -169,6 +177,12 @@ export type LookupResponse = {
|
|
|
169
177
|
*/
|
|
170
178
|
hostname?: string;
|
|
171
179
|
abuse?: AbuseContact;
|
|
180
|
+
/**
|
|
181
|
+
* When the request sent `user_agent`, with every field: the agent it
|
|
182
|
+
* names and whether this address bears it out. Absent otherwise.
|
|
183
|
+
*
|
|
184
|
+
*/
|
|
185
|
+
user_agent?: UserAgentVerdict;
|
|
172
186
|
/**
|
|
173
187
|
* On every answer to a key on the free plan, and on no other: `false`
|
|
174
188
|
* while its organization's trial of every field lasts, `true` once the
|
|
@@ -193,6 +207,15 @@ export type BatchLookupRequest = {
|
|
|
193
207
|
*
|
|
194
208
|
*/
|
|
195
209
|
ips: Array<string>;
|
|
210
|
+
/**
|
|
211
|
+
* Each address's `User-Agent`, keyed by the string it is sent as in
|
|
212
|
+
* `ips`. With every field, that address's answer then carries
|
|
213
|
+
* `user_agent`, as a single lookup's does. Never kept.
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
user_agents?: {
|
|
217
|
+
[key: string]: string;
|
|
218
|
+
};
|
|
196
219
|
};
|
|
197
220
|
export type BatchLookupResponse = {
|
|
198
221
|
/**
|
|
@@ -514,11 +537,78 @@ export type Asn = {
|
|
|
514
537
|
/**
|
|
515
538
|
* The country the AS's registry assigned it to.
|
|
516
539
|
*/
|
|
517
|
-
country
|
|
540
|
+
country: string;
|
|
518
541
|
/**
|
|
519
542
|
* The announcement's RPKI status: valid, invalid or not_found.
|
|
520
543
|
*/
|
|
521
|
-
rpki_status
|
|
544
|
+
rpki_status: string;
|
|
545
|
+
};
|
|
546
|
+
export type UserAgentVerdict = {
|
|
547
|
+
/**
|
|
548
|
+
* The agent the user agent names, such as `Googlebot` or `Chrome`; `Unknown` where it names none.
|
|
549
|
+
*/
|
|
550
|
+
agent: string;
|
|
551
|
+
/**
|
|
552
|
+
* `browser`, `inapp`, `automation`, `bot`, `ai-bot`, `http-client` or
|
|
553
|
+
* `unknown`: what kind of client the user agent says it is.
|
|
554
|
+
*
|
|
555
|
+
*/
|
|
556
|
+
kind: string;
|
|
557
|
+
/**
|
|
558
|
+
* `verified`: the agent's operator vouches for this address as it.
|
|
559
|
+
* `spoofed`: the operator of a bot that publishes its addresses, or
|
|
560
|
+
* whose registered space it uses, does not vouch for this one, or this
|
|
561
|
+
* address posed as the bot before. `unverifiable`: a bot no published
|
|
562
|
+
* list or registered space can confirm. `not_bot`: a browser, an app or
|
|
563
|
+
* a script.
|
|
564
|
+
*
|
|
565
|
+
*/
|
|
566
|
+
verdict: 'verified' | 'spoofed' | 'unverifiable' | 'not_bot';
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* Bot IP's row: whose bot uses the address, the bots it serves or claimed to be, what they do, and how that is known.
|
|
570
|
+
*/
|
|
571
|
+
export type BotDetail = {
|
|
572
|
+
/**
|
|
573
|
+
* The bot operator's ID; for an address that is not verified, the operator its claim named. Empty where no operator is known.
|
|
574
|
+
*/
|
|
575
|
+
provider?: string;
|
|
576
|
+
/**
|
|
577
|
+
* That operator's name, empty where no operator is known.
|
|
578
|
+
*/
|
|
579
|
+
provider_name?: string;
|
|
580
|
+
/**
|
|
581
|
+
* The bots the address serves, as their user agents name them (`Googlebot`, `GPTBot`); for an address that is not verified, the bots it claimed to be. One address can serve several, and `[]` means none is named.
|
|
582
|
+
*/
|
|
583
|
+
agents?: Array<string>;
|
|
584
|
+
/**
|
|
585
|
+
* What those bots do: `search_engine`, `ai_training`, `ai_search`, `ai_assistant`, `ai_agent`, `seo`, `ads`, `preview`, `feed`, `monitoring`, `archiver`, `scanner`, `link_security`, `webhook` or `other`; `[]` where unknown.
|
|
586
|
+
*/
|
|
587
|
+
categories?: Array<string>;
|
|
588
|
+
/**
|
|
589
|
+
* Whether the operator vouches for the address, so the bots in `agents` really are its.
|
|
590
|
+
*/
|
|
591
|
+
verified?: boolean;
|
|
592
|
+
/**
|
|
593
|
+
* `verified` (the operator vouches for the address), `declared` (it names itself a bot that cannot be verified), `spoofed` (it claimed a bot whose operator vouches for other addresses) or `undeclared` (it hides as a browser and behaves as automation).
|
|
594
|
+
*/
|
|
595
|
+
identity?: string;
|
|
596
|
+
/**
|
|
597
|
+
* How a verified address verified: `list` (the operator publishes it), `rdns` (its reverse DNS name ends in a suffix the operator documents and resolves back) or `owner` (the operator's own space, seen claiming its bot); empty when not verified.
|
|
598
|
+
*/
|
|
599
|
+
verified_by?: string;
|
|
600
|
+
/**
|
|
601
|
+
* `high`, `medium` or `low`: how sure we are the address is what the row says.
|
|
602
|
+
*/
|
|
603
|
+
confidence?: string;
|
|
604
|
+
/**
|
|
605
|
+
* The first day the address was seen as such.
|
|
606
|
+
*/
|
|
607
|
+
first_seen?: string;
|
|
608
|
+
/**
|
|
609
|
+
* The last day it was.
|
|
610
|
+
*/
|
|
611
|
+
last_seen?: string;
|
|
522
612
|
};
|
|
523
613
|
/**
|
|
524
614
|
* The mobile network whose space the address is, from our Carrier IP
|
|
@@ -1066,7 +1156,16 @@ export type LookupIpData = {
|
|
|
1066
1156
|
*/
|
|
1067
1157
|
ip: string;
|
|
1068
1158
|
};
|
|
1069
|
-
query?:
|
|
1159
|
+
query?: {
|
|
1160
|
+
/**
|
|
1161
|
+
* The `User-Agent` header of the request you are deciding on. With
|
|
1162
|
+
* every field, on a paid plan or the trial, the answer then carries
|
|
1163
|
+
* `user_agent`: the agent it names, and whether this address bears
|
|
1164
|
+
* that out. Never kept, and nothing sent with a lookup feeds our data.
|
|
1165
|
+
*
|
|
1166
|
+
*/
|
|
1167
|
+
user_agent?: string;
|
|
1168
|
+
};
|
|
1070
1169
|
url: '/{ip}';
|
|
1071
1170
|
};
|
|
1072
1171
|
export type LookupIpErrors = {
|
|
@@ -1112,7 +1211,16 @@ export type LookupIpResponse = LookupIpResponses[keyof LookupIpResponses];
|
|
|
1112
1211
|
export type LookupMyIpData = {
|
|
1113
1212
|
body?: never;
|
|
1114
1213
|
path?: never;
|
|
1115
|
-
query?:
|
|
1214
|
+
query?: {
|
|
1215
|
+
/**
|
|
1216
|
+
* The `User-Agent` header of the request you are deciding on. With
|
|
1217
|
+
* every field, on a paid plan or the trial, the answer then carries
|
|
1218
|
+
* `user_agent`: the agent it names, and whether this address bears
|
|
1219
|
+
* that out. Never kept, and nothing sent with a lookup feeds our data.
|
|
1220
|
+
*
|
|
1221
|
+
*/
|
|
1222
|
+
user_agent?: string;
|
|
1223
|
+
};
|
|
1116
1224
|
url: '/myip';
|
|
1117
1225
|
};
|
|
1118
1226
|
export type LookupMyIpErrors = {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export type { OauthOptions, AuthorizationUrlOptions, OauthMetadata, TokenRespons
|
|
|
6
6
|
export { isBogon } from './bogon.js';
|
|
7
7
|
export { VPNDetectionError, OauthError, OauthAccessDeniedError, OauthExpiredTokenError, } from './errors.js';
|
|
8
8
|
export type { ErrorKind } from './errors.js';
|
|
9
|
-
export type { Result, VpnDetail, ClassDetail, ProxyDetail, PubproxyDetail, CarrierDetail, SatelliteDetail, SshDetail, SmtpDetail, WebDetail, DnsResolverDetail, BitTorrentDetail, Location, Asn, Company, AbuseContact, LookupResponse, } from './types.js';
|
|
9
|
+
export type { Result, VpnDetail, ClassDetail, ProxyDetail, PubproxyDetail, CarrierDetail, SatelliteDetail, SshDetail, SmtpDetail, WebDetail, DnsResolverDetail, BitTorrentDetail, BotDetail, Location, Asn, Company, AbuseContact, LookupResponse, } from './types.js';
|
|
10
10
|
export type { Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, } from './generated/types.gen.js';
|
package/dist/shapes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const LOOKUP_MEMBERS: readonly ["ip", "is_vpn"];
|
|
2
2
|
export declare const LOCATION_MEMBERS: readonly ["continent", "continent_name", "country", "country_name", "timezone", "currency_code", "currency_name", "currency_symbol", "flag_emoji", "flag_unicode"];
|
|
3
|
-
export declare const ASN_MEMBERS: readonly ["asn", "name", "domain", "type", "prefix"];
|
|
3
|
+
export declare const ASN_MEMBERS: readonly ["asn", "name", "domain", "type", "prefix", "country", "rpki_status"];
|
|
4
4
|
export declare const COMPANY_MEMBERS: readonly ["name", "domain"];
|
|
5
5
|
export declare const ABUSE_CONTACT_MEMBERS: readonly ["email"];
|
|
6
6
|
export declare const WEB_DETAIL_MEMBERS: readonly ["port", "tls_ok", "session_ok", "status_code", "server", "location", "title", "cert_subject_cn", "cert_subject_o", "cert_issuer_dn", "cert_browser_trusted", "tls_version", "first_seen", "last_seen"];
|
|
@@ -16,6 +16,7 @@ export declare const VPN_DETAIL_TYPES: Record<string, Kind>;
|
|
|
16
16
|
export declare const CLASS_DETAIL_TYPES: Record<string, Kind>;
|
|
17
17
|
export declare const PROXY_DETAIL_TYPES: Record<string, Kind>;
|
|
18
18
|
export declare const PUBPROXY_DETAIL_TYPES: Record<string, Kind>;
|
|
19
|
+
export declare const BOT_DETAIL_TYPES: Record<string, Kind>;
|
|
19
20
|
export declare const CARRIER_DETAIL_TYPES: Record<string, Kind>;
|
|
20
21
|
export declare const SATELLITE_DETAIL_TYPES: Record<string, Kind>;
|
|
21
22
|
export declare const SSH_DETAIL_TYPES: Record<string, Kind>;
|
package/dist/shapes.js
CHANGED
|
@@ -7,7 +7,7 @@ export const LOCATION_MEMBERS = [
|
|
|
7
7
|
'continent', 'continent_name', 'country', 'country_name', 'timezone', 'currency_code', 'currency_name',
|
|
8
8
|
'currency_symbol', 'flag_emoji', 'flag_unicode',
|
|
9
9
|
];
|
|
10
|
-
export const ASN_MEMBERS = ['asn', 'name', 'domain', 'type', 'prefix'];
|
|
10
|
+
export const ASN_MEMBERS = ['asn', 'name', 'domain', 'type', 'prefix', 'country', 'rpki_status'];
|
|
11
11
|
export const COMPANY_MEMBERS = ['name', 'domain'];
|
|
12
12
|
export const ABUSE_CONTACT_MEMBERS = ['email'];
|
|
13
13
|
export const WEB_DETAIL_MEMBERS = [
|
|
@@ -29,6 +29,7 @@ export const LOOKUP_TYPES = {
|
|
|
29
29
|
mobproxy: 'object', pubproxy: 'object', carrier: 'object', satellite: 'object', ssh: 'object', smtp: 'object',
|
|
30
30
|
web: 'array', dns_resolver: 'object', bittorrent: 'object', location: 'object', asn: 'object',
|
|
31
31
|
company: 'object', hostname: 'string', abuse: 'object', trial_expired: 'boolean', cap_reached: 'boolean',
|
|
32
|
+
is_bot: 'boolean', bot: 'object', user_agent: 'object',
|
|
32
33
|
};
|
|
33
34
|
export const VPN_DETAIL_TYPES = {
|
|
34
35
|
provider: 'string', provider_name: 'string', last_seen: 'date', confidence: 'string', method: 'string',
|
|
@@ -44,6 +45,10 @@ export const PUBPROXY_DETAIL_TYPES = {
|
|
|
44
45
|
entry: 'boolean', exit: 'boolean', protocols: 'array', num_ports: 'integer', num_proxies: 'integer',
|
|
45
46
|
last_seen: 'date', last_usable: 'string',
|
|
46
47
|
};
|
|
48
|
+
export const BOT_DETAIL_TYPES = {
|
|
49
|
+
provider: 'string', provider_name: 'string', agents: 'array', categories: 'array', verified: 'boolean',
|
|
50
|
+
identity: 'string', verified_by: 'string', confidence: 'string', first_seen: 'string', last_seen: 'string',
|
|
51
|
+
};
|
|
47
52
|
export const CARRIER_DETAIL_TYPES = {
|
|
48
53
|
name: 'string', mcc: 'string', mnc: 'string', country: 'string', confidence: 'string',
|
|
49
54
|
};
|
|
@@ -166,7 +171,7 @@ const DETAILS = [
|
|
|
166
171
|
['dcproxy', PROXY_DETAIL_TYPES], ['mobproxy', PROXY_DETAIL_TYPES], ['pubproxy', PUBPROXY_DETAIL_TYPES],
|
|
167
172
|
['carrier', CARRIER_DETAIL_TYPES], ['satellite', SATELLITE_DETAIL_TYPES], ['ssh', SSH_DETAIL_TYPES],
|
|
168
173
|
['smtp', SMTP_DETAIL_TYPES], ['dns_resolver', DNS_RESOLVER_DETAIL_TYPES],
|
|
169
|
-
['bittorrent', BITTORRENT_DETAIL_TYPES],
|
|
174
|
+
['bittorrent', BITTORRENT_DETAIL_TYPES], ['bot', BOT_DETAIL_TYPES],
|
|
170
175
|
];
|
|
171
176
|
const SHARED = [
|
|
172
177
|
['location', LOCATION_MEMBERS, LOCATION_TYPES],
|
|
@@ -179,6 +184,7 @@ export function isLookup(data) {
|
|
|
179
184
|
&& DETAILS.every(([member, types]) => optional(data[member], (detail) => typed(detail, [], types)))
|
|
180
185
|
&& optional(data['pubproxy'], (pubproxy) => lists(pubproxy, 'protocols', isString))
|
|
181
186
|
&& optional(data['bittorrent'], (bittorrent) => lists(bittorrent, 'clients', isString))
|
|
187
|
+
&& optional(data['bot'], (bot) => lists(bot, 'agents', isString) && lists(bot, 'categories', isString))
|
|
182
188
|
&& optional(data['web'], (web) => every(web, (row) => typed(row, WEB_DETAIL_MEMBERS, WEB_DETAIL_TYPES)))
|
|
183
189
|
&& SHARED.every(([member, required, types]) => optional(data[member], (o) => typed(o, required, types)));
|
|
184
190
|
}
|
package/dist/store.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class StoreTier {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* How long an answer stays cached: the TTL, or at most a minute for one marked
|
|
34
|
-
* `trialExpired` or `capReached`, which a
|
|
34
|
+
* `trialExpired` or `capReached`, which a renewed trial or a raised cap ends. Still
|
|
35
35
|
* cached, so a busy page past its trial does not send every repeat to the API.
|
|
36
36
|
*/
|
|
37
37
|
export declare function lifeMs(result: Result, ttlMs: number): number;
|
package/dist/store.js
CHANGED
|
@@ -44,7 +44,7 @@ export class StoreTier {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* How long an answer stays cached: the TTL, or at most a minute for one marked
|
|
47
|
-
* `trialExpired` or `capReached`, which a
|
|
47
|
+
* `trialExpired` or `capReached`, which a renewed trial or a raised cap ends. Still
|
|
48
48
|
* cached, so a busy page past its trial does not send every repeat to the API.
|
|
49
49
|
*/
|
|
50
50
|
export function lifeMs(result, ttlMs) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type { AbuseContact, Asn, BitTorrentDetail, CarrierDetail, ClassDetail, Company, DnsResolverDetail, Location, LookupResponse, ProxyDetail, PubproxyDetail, SatelliteDetail, SmtpDetail, SshDetail, VpnDetail, WebDetail } from './generated/types.gen.js';
|
|
2
|
-
export type { AbuseContact,
|
|
1
|
+
import type { AbuseContact, Asn as WireAsn, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, Company, DnsResolverDetail, Location, LookupResponse as WireLookupResponse, ProxyDetail, PubproxyDetail, SatelliteDetail, SmtpDetail, SshDetail, VpnDetail, WebDetail } from './generated/types.gen.js';
|
|
2
|
+
export type { AbuseContact, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, Company, DnsResolverDetail, Location, ProxyDetail, PubproxyDetail, SatelliteDetail, SmtpDetail, SshDetail, VpnDetail, WebDetail, };
|
|
3
|
+
/** The AS announcing an address. Every answer carries `country` and `rpki_status`. */
|
|
4
|
+
export type Asn = Omit<WireAsn, 'country' | 'rpki_status'> & Partial<Pick<WireAsn, 'country' | 'rpki_status'>>;
|
|
5
|
+
/**
|
|
6
|
+
* A lookup's answer as it came off the wire. `user_agent` is left out: it answers
|
|
7
|
+
* a user agent sent with the lookup, which this client sends none of.
|
|
8
|
+
*/
|
|
9
|
+
export type LookupResponse = Omit<WireLookupResponse, 'asn' | 'user_agent'> & {
|
|
10
|
+
asn?: Asn;
|
|
11
|
+
};
|
|
3
12
|
/**
|
|
4
13
|
* What a lookup answers.
|
|
5
14
|
*
|
|
@@ -39,6 +48,11 @@ export interface Result {
|
|
|
39
48
|
isWeb?: boolean;
|
|
40
49
|
isDnsResolver?: boolean;
|
|
41
50
|
isBittorrent?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether an automated client uses the address, such as a search engine's or an AI company's
|
|
53
|
+
* crawler, an uptime monitor or a webhook sender. Every plan includes this; `bot` says whose.
|
|
54
|
+
*/
|
|
55
|
+
isBot?: boolean;
|
|
42
56
|
/**
|
|
43
57
|
* On answers to a key on the free plan only: `false` while its organization's trial of every
|
|
44
58
|
* field lasts, `true` once the answer has Unlimited's.
|
|
@@ -67,6 +81,11 @@ export interface Result {
|
|
|
67
81
|
web?: WebDetail[];
|
|
68
82
|
dnsResolver?: DnsResolverDetail;
|
|
69
83
|
bittorrent?: BitTorrentDetail;
|
|
84
|
+
/**
|
|
85
|
+
* Whose bot uses the address, what it does and whether its operator vouches for the address.
|
|
86
|
+
* Paid plans. `agents` and `categories` keep the API's order.
|
|
87
|
+
*/
|
|
88
|
+
bot?: BotDetail;
|
|
70
89
|
/**
|
|
71
90
|
* Where the address is, on every answer, with or without a key: every key present, empty
|
|
72
91
|
* strings where it is not known. The region, city, postal code, coordinates and the rest
|
package/dist/types.js
CHANGED
|
@@ -7,7 +7,7 @@ const RESULT_NAMES = {
|
|
|
7
7
|
is_resproxy: 'isResproxy', is_dcproxy: 'isDcproxy', is_mobproxy: 'isMobproxy', is_pubproxy: 'isPubproxy',
|
|
8
8
|
is_anycast: 'isAnycast', is_carrier: 'isCarrier', is_satellite: 'isSatellite', is_ssh: 'isSsh',
|
|
9
9
|
is_smtp: 'isSmtp', is_web: 'isWeb', is_dns_resolver: 'isDnsResolver', is_bittorrent: 'isBittorrent',
|
|
10
|
-
trial_expired: 'trialExpired', cap_reached: 'capReached',
|
|
10
|
+
is_bot: 'isBot', trial_expired: 'trialExpired', cap_reached: 'capReached', bot: 'bot',
|
|
11
11
|
vpn: 'vpn', hosting: 'hosting', relay: 'relay', tor: 'tor', cdn: 'cdn', resproxy: 'resproxy', dcproxy: 'dcproxy',
|
|
12
12
|
mobproxy: 'mobproxy', pubproxy: 'pubproxy', carrier: 'carrier', satellite: 'satellite', ssh: 'ssh', smtp: 'smtp',
|
|
13
13
|
web: 'web', dns_resolver: 'dnsResolver', bittorrent: 'bittorrent', location: 'location', asn: 'asn',
|
package/package.json
CHANGED