vpndetection-web 1.5.2 → 1.6.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 +6 -6
- package/dist/bogon.d.ts +3 -2
- package/dist/bogon.js +41 -3
- package/dist/client.d.ts +5 -5
- package/dist/client.js +18 -3
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/sdk.gen.d.ts +1 -1
- package/dist/generated/sdk.gen.js +1 -1
- package/dist/generated/types.gen.d.ts +459 -14
- package/dist/index.d.ts +1 -1
- package/dist/shapes.d.ts +13 -1
- package/dist/shapes.js +73 -8
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/types.d.ts +40 -10
- package/dist/types.js +23 -41
- 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, `location` and `asn
|
|
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:
|
|
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 (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
|
|
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:
|
|
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
|
|
|
@@ -129,7 +129,7 @@ const client = new VPNDetection({ cache: { max: 50_000, ttlMs: 6 * 60 * 60 * 100
|
|
|
129
129
|
const clientNoCache = new VPNDetection({ cache: false });
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
An answer with `trialExpired` or `capReached` true is cached for a minute at most, in memory and in a `store`, so a
|
|
132
|
+
An answer with `trialExpired` or `capReached` true is cached for a minute at most, in memory and in a `store`, so a renewed trial or a raised cap reaches you within a minute.
|
|
133
133
|
|
|
134
134
|
### Keeping answers across a reload
|
|
135
135
|
|
|
@@ -251,12 +251,12 @@ 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
|
|
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".
|
|
255
255
|
|
|
256
256
|
```js
|
|
257
257
|
result.isHosting ?? false // when you only want the flag
|
|
258
258
|
result.isHosting === undefined // on Unlimited: not in your plan
|
|
259
|
-
result.trialExpired === true // a free-plan key's
|
|
259
|
+
result.trialExpired === true // a free-plan key's trial is spent
|
|
260
260
|
result.capReached === true // a paid key past its overage cap
|
|
261
261
|
```
|
|
262
262
|
|
package/dist/bogon.d.ts
CHANGED
|
@@ -18,8 +18,9 @@ export declare function isBogon(ip: string): boolean;
|
|
|
18
18
|
export declare function unmapped(ip: string): string;
|
|
19
19
|
/**
|
|
20
20
|
* The answer a bogon gets, in the full shape the API serves at its widest plan:
|
|
21
|
-
* every flag present and false, every detail object present and empty,
|
|
22
|
-
*
|
|
21
|
+
* every flag present and false, every detail object present and empty, `web` an
|
|
22
|
+
* empty list, `hostname` an empty string, and `location`, `asn`, `company` and
|
|
23
|
+
* `abuse` with every key empty or zero, as the API answers a bogon.
|
|
23
24
|
*
|
|
24
25
|
* `isBogon` is true, as the API answers reserved space. Note this is deliberately the WIDEST shape regardless of your
|
|
25
26
|
* plan, so do not infer which fields your plan includes from a bogon answer.
|
package/dist/bogon.js
CHANGED
|
@@ -36,8 +36,9 @@ export function unmapped(ip) {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* The answer a bogon gets, in the full shape the API serves at its widest plan:
|
|
39
|
-
* every flag present and false, every detail object present and empty,
|
|
40
|
-
*
|
|
39
|
+
* every flag present and false, every detail object present and empty, `web` an
|
|
40
|
+
* empty list, `hostname` an empty string, and `location`, `asn`, `company` and
|
|
41
|
+
* `abuse` with every key empty or zero, as the API answers a bogon.
|
|
41
42
|
*
|
|
42
43
|
* `isBogon` is true, as the API answers reserved space. Note this is deliberately the WIDEST shape regardless of your
|
|
43
44
|
* plan, so do not infer which fields your plan includes from a bogon answer.
|
|
@@ -55,6 +56,14 @@ export function bogonResult(ip) {
|
|
|
55
56
|
isDcproxy: false,
|
|
56
57
|
isMobproxy: false,
|
|
57
58
|
isPubproxy: false,
|
|
59
|
+
isAnycast: false,
|
|
60
|
+
isCarrier: false,
|
|
61
|
+
isSatellite: false,
|
|
62
|
+
isSsh: false,
|
|
63
|
+
isSmtp: false,
|
|
64
|
+
isWeb: false,
|
|
65
|
+
isDnsResolver: false,
|
|
66
|
+
isBittorrent: false,
|
|
58
67
|
vpn: {},
|
|
59
68
|
hosting: {},
|
|
60
69
|
relay: {},
|
|
@@ -64,6 +73,13 @@ export function bogonResult(ip) {
|
|
|
64
73
|
dcproxy: {},
|
|
65
74
|
mobproxy: {},
|
|
66
75
|
pubproxy: {},
|
|
76
|
+
carrier: {},
|
|
77
|
+
satellite: {},
|
|
78
|
+
ssh: {},
|
|
79
|
+
smtp: {},
|
|
80
|
+
web: [],
|
|
81
|
+
dnsResolver: {},
|
|
82
|
+
bittorrent: {},
|
|
67
83
|
location: {
|
|
68
84
|
continent: '',
|
|
69
85
|
continent_name: '',
|
|
@@ -75,8 +91,30 @@ export function bogonResult(ip) {
|
|
|
75
91
|
currency_symbol: '',
|
|
76
92
|
flag_emoji: '',
|
|
77
93
|
flag_unicode: '',
|
|
94
|
+
region: '',
|
|
95
|
+
region_code: '',
|
|
96
|
+
city: '',
|
|
97
|
+
postal_code: '',
|
|
98
|
+
latitude: 0,
|
|
99
|
+
longitude: 0,
|
|
100
|
+
accuracy_radius: 0,
|
|
101
|
+
geoname_id: '',
|
|
102
|
+
dma_code: '',
|
|
103
|
+
last_changed: '',
|
|
104
|
+
},
|
|
105
|
+
asn: { asn: 0, name: '', domain: '', type: '', prefix: '', country: '', rpki_status: '' },
|
|
106
|
+
company: { name: '', domain: '', type: '', country: '' },
|
|
107
|
+
hostname: '',
|
|
108
|
+
abuse: {
|
|
109
|
+
email: '',
|
|
110
|
+
name: '',
|
|
111
|
+
phone: '',
|
|
112
|
+
address: '',
|
|
113
|
+
country: '',
|
|
114
|
+
network: '',
|
|
115
|
+
validated: false,
|
|
116
|
+
unvalidated_since: '',
|
|
78
117
|
},
|
|
79
|
-
asn: { asn: 0, name: '', domain: '', type: '', prefix: '' },
|
|
80
118
|
raw: {},
|
|
81
119
|
};
|
|
82
120
|
}
|
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;
|
|
@@ -22,8 +22,8 @@ export interface CacheOptions {
|
|
|
22
22
|
export interface Options {
|
|
23
23
|
/**
|
|
24
24
|
* Your API key. Without one a lookup is on Unlimited, the free plan: `ip`,
|
|
25
|
-
* `is_vpn`, the Tor and relay members, `
|
|
26
|
-
* or monthly cap. A batch needs a key on a paid plan.
|
|
25
|
+
* `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`, `location`
|
|
26
|
+
* and `asn`, with no daily or monthly cap. A batch needs a key on a paid plan.
|
|
27
27
|
* A key in a web page is readable by anyone who opens the page.
|
|
28
28
|
*/
|
|
29
29
|
apiKey?: string;
|
|
@@ -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 { Asn, BatchLookupError, BatchLookupRequest, BatchLookupResponse, ClassDetail, ClientOptions, 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, TokenRequest, TokenResponse, VpnDetail } from './types.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';
|
|
@@ -19,7 +19,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
19
19
|
* Answers what is known about a single IPv4 or IPv6 address. Which fields
|
|
20
20
|
* come back is decided by the presented key; with no key, on Unlimited,
|
|
21
21
|
* the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members,
|
|
22
|
-
* `location` and `asn`.
|
|
22
|
+
* `is_anycast`, `hostname`, `location` and `asn`.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
export declare const lookupIp: <ThrowOnError extends boolean = false>(options: Options<LookupIpData, ThrowOnError>) => RequestResult<LookupIpResponses, LookupIpErrors, ThrowOnError>;
|
|
@@ -7,7 +7,7 @@ import { urlSearchParamsBodySerializer } from './client/index.js';
|
|
|
7
7
|
* Answers what is known about a single IPv4 or IPv6 address. Which fields
|
|
8
8
|
* come back is decided by the presented key; with no key, on Unlimited,
|
|
9
9
|
* the free plan, the answer is `ip`, `is_vpn`, the Tor and relay members,
|
|
10
|
-
* `location` and `asn`.
|
|
10
|
+
* `is_anycast`, `hostname`, `location` and `asn`.
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
export const lookupIp = (options) => (options.client ?? client).get({
|
|
@@ -3,7 +3,8 @@ export type ClientOptions = {
|
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
5
|
* The union of every tier's answer. Every answer carries `ip`, `is_bogon`,
|
|
6
|
-
* `is_vpn`, the Tor and relay members, `
|
|
6
|
+
* `is_vpn`, the Tor and relay members, `is_anycast`, `hostname`, `location` and
|
|
7
|
+
* `asn`, with or without a key;
|
|
7
8
|
* each remaining field is present when your tier includes it, and absent
|
|
8
9
|
* otherwise. A client that must work across plans should treat an absent
|
|
9
10
|
* flag as unknown rather than as `false`.
|
|
@@ -60,6 +61,38 @@ export type LookupResponse = {
|
|
|
60
61
|
* Whether a public proxy, one anyone can connect through, listens on the address or sends its traffic out from it. Paid plans.
|
|
61
62
|
*/
|
|
62
63
|
is_pubproxy?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the address is announced from many places at once, as a public DNS resolver's or a CDN's edge is. Every answer, with or without a key.
|
|
66
|
+
*/
|
|
67
|
+
is_anycast?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the address is a mobile carrier's, where many phones can share one address. Paid plans.
|
|
70
|
+
*/
|
|
71
|
+
is_carrier?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the address is a satellite operator's. Paid plans.
|
|
74
|
+
*/
|
|
75
|
+
is_satellite?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether an SSH server answered on the address. Paid plans.
|
|
78
|
+
*/
|
|
79
|
+
is_ssh?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a mail server answered on the address. Paid plans.
|
|
82
|
+
*/
|
|
83
|
+
is_smtp?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Whether a web server answered on the address, on port 80 or 443. Paid plans.
|
|
86
|
+
*/
|
|
87
|
+
is_web?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether an open DNS resolver answered on the address. Paid plans.
|
|
90
|
+
*/
|
|
91
|
+
is_dns_resolver?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether a BitTorrent client was seen on the address in the last 90 days. Paid plans.
|
|
94
|
+
*/
|
|
95
|
+
is_bittorrent?: boolean;
|
|
63
96
|
/**
|
|
64
97
|
* Detail for `is_vpn`. Empty when `is_vpn` is false. Paid plans.
|
|
65
98
|
*
|
|
@@ -100,12 +133,46 @@ export type LookupResponse = {
|
|
|
100
133
|
* Detail for `is_pubproxy`. Empty when false. Paid plans.
|
|
101
134
|
*/
|
|
102
135
|
pubproxy?: PubproxyDetail;
|
|
136
|
+
/**
|
|
137
|
+
* Detail for `is_carrier`. Empty when false. Paid plans.
|
|
138
|
+
*/
|
|
139
|
+
carrier?: CarrierDetail;
|
|
140
|
+
/**
|
|
141
|
+
* Detail for `is_satellite`. Empty when false. Paid plans.
|
|
142
|
+
*/
|
|
143
|
+
satellite?: SatelliteDetail;
|
|
144
|
+
/**
|
|
145
|
+
* Detail for `is_ssh`. Empty when false. Paid plans.
|
|
146
|
+
*/
|
|
147
|
+
ssh?: SshDetail;
|
|
148
|
+
/**
|
|
149
|
+
* Detail for `is_smtp`. Empty when false. Paid plans.
|
|
150
|
+
*/
|
|
151
|
+
smtp?: SmtpDetail;
|
|
152
|
+
/**
|
|
153
|
+
* Detail for `is_web`: a row per port that answered, lowest first, and `[]` when false. Paid plans.
|
|
154
|
+
*/
|
|
155
|
+
web?: Array<WebDetail>;
|
|
156
|
+
/**
|
|
157
|
+
* Detail for `is_dns_resolver`. Empty when false. Paid plans.
|
|
158
|
+
*/
|
|
159
|
+
dns_resolver?: DnsResolverDetail;
|
|
160
|
+
/**
|
|
161
|
+
* Detail for `is_bittorrent`. Empty when false. Paid plans.
|
|
162
|
+
*/
|
|
163
|
+
bittorrent?: BitTorrentDetail;
|
|
103
164
|
location?: Location;
|
|
104
165
|
asn?: Asn;
|
|
166
|
+
company?: Company;
|
|
167
|
+
/**
|
|
168
|
+
* The name the address's reverse DNS (PTR) record points to, from our IP RDNS database; an empty string when it has none. Every answer, with or without a key.
|
|
169
|
+
*/
|
|
170
|
+
hostname?: string;
|
|
171
|
+
abuse?: AbuseContact;
|
|
105
172
|
/**
|
|
106
173
|
* On every answer to a key on the free plan, and on no other: `false`
|
|
107
|
-
* while its organization's
|
|
108
|
-
*
|
|
174
|
+
* while its organization's trial of every field lasts, `true` once the
|
|
175
|
+
* answer has Unlimited's.
|
|
109
176
|
*
|
|
110
177
|
*/
|
|
111
178
|
trial_expired?: boolean;
|
|
@@ -327,10 +394,11 @@ export type PubproxyDetail = {
|
|
|
327
394
|
last_usable?: string;
|
|
328
395
|
};
|
|
329
396
|
/**
|
|
330
|
-
* Where the address is
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
397
|
+
* Where the address is: the fields of our IP Country database on every
|
|
398
|
+
* answer, with or without a key, and our IP Geolocation database's finer
|
|
399
|
+
* ones on a paid plan. Each field your plan includes is present whenever
|
|
400
|
+
* the object is, so an address in no country, or a private one, answers
|
|
401
|
+
* empty strings and zeros.
|
|
334
402
|
*
|
|
335
403
|
*/
|
|
336
404
|
export type Location = {
|
|
@@ -374,6 +442,46 @@ export type Location = {
|
|
|
374
442
|
* The Unicode code points of the flag emoji.
|
|
375
443
|
*/
|
|
376
444
|
flag_unicode: string;
|
|
445
|
+
/**
|
|
446
|
+
* Region (state or province). Paid plans.
|
|
447
|
+
*/
|
|
448
|
+
region?: string;
|
|
449
|
+
/**
|
|
450
|
+
* ISO 3166-2 region code. Paid plans.
|
|
451
|
+
*/
|
|
452
|
+
region_code?: string;
|
|
453
|
+
/**
|
|
454
|
+
* City. Paid plans.
|
|
455
|
+
*/
|
|
456
|
+
city?: string;
|
|
457
|
+
/**
|
|
458
|
+
* Postal code. Paid plans.
|
|
459
|
+
*/
|
|
460
|
+
postal_code?: string;
|
|
461
|
+
/**
|
|
462
|
+
* Latitude of the city. Paid plans.
|
|
463
|
+
*/
|
|
464
|
+
latitude?: number;
|
|
465
|
+
/**
|
|
466
|
+
* Longitude of the city. Paid plans.
|
|
467
|
+
*/
|
|
468
|
+
longitude?: number;
|
|
469
|
+
/**
|
|
470
|
+
* Radius in km holding the true location with 67% confidence; 20000 for an address announced everywhere, as an anycast one is. Paid plans.
|
|
471
|
+
*/
|
|
472
|
+
accuracy_radius?: number;
|
|
473
|
+
/**
|
|
474
|
+
* GeoNames ID of the city. Paid plans.
|
|
475
|
+
*/
|
|
476
|
+
geoname_id?: string;
|
|
477
|
+
/**
|
|
478
|
+
* US TV market (DMA) code, empty outside the US. Paid plans.
|
|
479
|
+
*/
|
|
480
|
+
dma_code?: string;
|
|
481
|
+
/**
|
|
482
|
+
* The day the range's location last changed. Paid plans.
|
|
483
|
+
*/
|
|
484
|
+
last_changed?: string;
|
|
377
485
|
};
|
|
378
486
|
/**
|
|
379
487
|
* The autonomous system that announces the address. Every answer, with or
|
|
@@ -403,6 +511,343 @@ export type Asn = {
|
|
|
403
511
|
* The announced BGP prefix that covers the address, the most specific when several do.
|
|
404
512
|
*/
|
|
405
513
|
prefix: string;
|
|
514
|
+
/**
|
|
515
|
+
* The country the AS's registry assigned it to.
|
|
516
|
+
*/
|
|
517
|
+
country?: string;
|
|
518
|
+
/**
|
|
519
|
+
* The announcement's RPKI status: valid, invalid or not_found.
|
|
520
|
+
*/
|
|
521
|
+
rpki_status?: string;
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* The mobile network whose space the address is, from our Carrier IP
|
|
525
|
+
* database. Every key is present when the object is populated; the object
|
|
526
|
+
* is `{}` when `is_carrier` is false.
|
|
527
|
+
*
|
|
528
|
+
*/
|
|
529
|
+
export type CarrierDetail = {
|
|
530
|
+
/**
|
|
531
|
+
* The mobile carrier.
|
|
532
|
+
*/
|
|
533
|
+
name?: string;
|
|
534
|
+
/**
|
|
535
|
+
* Its mobile country code.
|
|
536
|
+
*/
|
|
537
|
+
mcc?: string;
|
|
538
|
+
/**
|
|
539
|
+
* Its mobile network code.
|
|
540
|
+
*/
|
|
541
|
+
mnc?: string;
|
|
542
|
+
/**
|
|
543
|
+
* ISO 3166 country code.
|
|
544
|
+
*/
|
|
545
|
+
country?: string;
|
|
546
|
+
/**
|
|
547
|
+
* `high`, `medium` or `low`.
|
|
548
|
+
*/
|
|
549
|
+
confidence?: string;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* The satellite operator whose space the address is, from our Satellite IP
|
|
553
|
+
* database. Every key is present when the object is populated; the object
|
|
554
|
+
* is `{}` when `is_satellite` is false.
|
|
555
|
+
*
|
|
556
|
+
*/
|
|
557
|
+
export type SatelliteDetail = {
|
|
558
|
+
/**
|
|
559
|
+
* The operator's ID in Satellite IP Provider.
|
|
560
|
+
*/
|
|
561
|
+
provider?: string;
|
|
562
|
+
/**
|
|
563
|
+
* The operator's name.
|
|
564
|
+
*/
|
|
565
|
+
provider_name?: string;
|
|
566
|
+
/**
|
|
567
|
+
* The orbit: `leo`, `meo` or `geo`.
|
|
568
|
+
*/
|
|
569
|
+
orbit?: string;
|
|
570
|
+
/**
|
|
571
|
+
* Who the space serves, such as consumer or maritime.
|
|
572
|
+
*/
|
|
573
|
+
segment?: string;
|
|
574
|
+
/**
|
|
575
|
+
* ISO 3166 country code.
|
|
576
|
+
*/
|
|
577
|
+
country?: string;
|
|
578
|
+
/**
|
|
579
|
+
* The AS the operator announces it from.
|
|
580
|
+
*/
|
|
581
|
+
asn?: number;
|
|
582
|
+
/**
|
|
583
|
+
* `high`, `medium` or `low`.
|
|
584
|
+
*/
|
|
585
|
+
confidence?: string;
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* The SSH server that answered on the address, from our SSH IP database.
|
|
589
|
+
* Every key is present when the object is populated; the object is `{}`
|
|
590
|
+
* when `is_ssh` is false.
|
|
591
|
+
*
|
|
592
|
+
*/
|
|
593
|
+
export type SshDetail = {
|
|
594
|
+
/**
|
|
595
|
+
* The port the server answered on.
|
|
596
|
+
*/
|
|
597
|
+
port?: number;
|
|
598
|
+
/**
|
|
599
|
+
* Its banner.
|
|
600
|
+
*/
|
|
601
|
+
banner?: string;
|
|
602
|
+
/**
|
|
603
|
+
* Its host key's fingerprint.
|
|
604
|
+
*/
|
|
605
|
+
host_key_fp?: string;
|
|
606
|
+
/**
|
|
607
|
+
* A session was set up.
|
|
608
|
+
*/
|
|
609
|
+
session_ok?: boolean;
|
|
610
|
+
/**
|
|
611
|
+
* The first day it answered.
|
|
612
|
+
*/
|
|
613
|
+
first_seen?: string;
|
|
614
|
+
/**
|
|
615
|
+
* The last day it did.
|
|
616
|
+
*/
|
|
617
|
+
last_seen?: string;
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* The mail server that answered on the address, from our SMTP IP database.
|
|
621
|
+
* Every key is present when the object is populated; the object is `{}`
|
|
622
|
+
* when `is_smtp` is false.
|
|
623
|
+
*
|
|
624
|
+
*/
|
|
625
|
+
export type SmtpDetail = {
|
|
626
|
+
/**
|
|
627
|
+
* The port the server answered on.
|
|
628
|
+
*/
|
|
629
|
+
port?: number;
|
|
630
|
+
/**
|
|
631
|
+
* Its banner.
|
|
632
|
+
*/
|
|
633
|
+
banner?: string;
|
|
634
|
+
/**
|
|
635
|
+
* A session was set up.
|
|
636
|
+
*/
|
|
637
|
+
session_ok?: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* The first day it answered.
|
|
640
|
+
*/
|
|
641
|
+
first_seen?: string;
|
|
642
|
+
/**
|
|
643
|
+
* The last day it did.
|
|
644
|
+
*/
|
|
645
|
+
last_seen?: string;
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* One port of the address that answered as a web server, from our Web IP database.
|
|
649
|
+
*/
|
|
650
|
+
export type WebDetail = {
|
|
651
|
+
/**
|
|
652
|
+
* 80 or 443.
|
|
653
|
+
*/
|
|
654
|
+
port: number;
|
|
655
|
+
/**
|
|
656
|
+
* A TLS handshake completed.
|
|
657
|
+
*/
|
|
658
|
+
tls_ok: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* An HTTP response came back.
|
|
661
|
+
*/
|
|
662
|
+
session_ok: boolean;
|
|
663
|
+
/**
|
|
664
|
+
* Its status, 0 where none came.
|
|
665
|
+
*/
|
|
666
|
+
status_code: number;
|
|
667
|
+
/**
|
|
668
|
+
* Its `Server` header.
|
|
669
|
+
*/
|
|
670
|
+
server: string;
|
|
671
|
+
/**
|
|
672
|
+
* Where it redirected.
|
|
673
|
+
*/
|
|
674
|
+
location: string;
|
|
675
|
+
/**
|
|
676
|
+
* The page's title.
|
|
677
|
+
*/
|
|
678
|
+
title: string;
|
|
679
|
+
/**
|
|
680
|
+
* The certificate's subject common name.
|
|
681
|
+
*/
|
|
682
|
+
cert_subject_cn: string;
|
|
683
|
+
/**
|
|
684
|
+
* Its subject organization.
|
|
685
|
+
*/
|
|
686
|
+
cert_subject_o: string;
|
|
687
|
+
/**
|
|
688
|
+
* Its issuer.
|
|
689
|
+
*/
|
|
690
|
+
cert_issuer_dn: string;
|
|
691
|
+
/**
|
|
692
|
+
* Browsers trust it.
|
|
693
|
+
*/
|
|
694
|
+
cert_browser_trusted: boolean;
|
|
695
|
+
/**
|
|
696
|
+
* The TLS version negotiated, empty without TLS.
|
|
697
|
+
*/
|
|
698
|
+
tls_version: string;
|
|
699
|
+
/**
|
|
700
|
+
* The first day the port was open.
|
|
701
|
+
*/
|
|
702
|
+
first_seen: string;
|
|
703
|
+
/**
|
|
704
|
+
* The last day it was.
|
|
705
|
+
*/
|
|
706
|
+
last_seen: string;
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* The open DNS resolver that answered on the address, from our DNS
|
|
710
|
+
* Resolver IP database. Every key is present when the object is populated;
|
|
711
|
+
* the object is `{}` when `is_dns_resolver` is false.
|
|
712
|
+
*
|
|
713
|
+
*/
|
|
714
|
+
export type DnsResolverDetail = {
|
|
715
|
+
/**
|
|
716
|
+
* The port it answered on.
|
|
717
|
+
*/
|
|
718
|
+
port?: number;
|
|
719
|
+
/**
|
|
720
|
+
* It offered recursion.
|
|
721
|
+
*/
|
|
722
|
+
recursion_available?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Its answer's response code.
|
|
725
|
+
*/
|
|
726
|
+
rcode?: number;
|
|
727
|
+
/**
|
|
728
|
+
* Its answer was right.
|
|
729
|
+
*/
|
|
730
|
+
answer_correct?: boolean;
|
|
731
|
+
/**
|
|
732
|
+
* The first day it answered.
|
|
733
|
+
*/
|
|
734
|
+
first_seen?: string;
|
|
735
|
+
/**
|
|
736
|
+
* The last day it did.
|
|
737
|
+
*/
|
|
738
|
+
last_seen?: string;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* BitTorrent clients seen on the address over the last 90 days, from our
|
|
742
|
+
* BitTorrent IP database. Every key is present when the object is
|
|
743
|
+
* populated; the object is `{}` when `is_bittorrent` is false.
|
|
744
|
+
*
|
|
745
|
+
*/
|
|
746
|
+
export type BitTorrentDetail = {
|
|
747
|
+
/**
|
|
748
|
+
* A client here answered, or two or more reported it at once.
|
|
749
|
+
*/
|
|
750
|
+
verified?: boolean;
|
|
751
|
+
/**
|
|
752
|
+
* A client here derived its node ID from the address (BEP 42).
|
|
753
|
+
*/
|
|
754
|
+
id_matches_ip?: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* The first day a client was seen here.
|
|
757
|
+
*/
|
|
758
|
+
first_seen?: string;
|
|
759
|
+
/**
|
|
760
|
+
* The last day.
|
|
761
|
+
*/
|
|
762
|
+
last_seen?: string;
|
|
763
|
+
/**
|
|
764
|
+
* The last day one answered, empty when none did.
|
|
765
|
+
*/
|
|
766
|
+
last_reachable?: string;
|
|
767
|
+
/**
|
|
768
|
+
* On how many days.
|
|
769
|
+
*/
|
|
770
|
+
days_seen?: number;
|
|
771
|
+
/**
|
|
772
|
+
* Distinct ports over the window.
|
|
773
|
+
*/
|
|
774
|
+
num_ports?: number;
|
|
775
|
+
/**
|
|
776
|
+
* The most on one day.
|
|
777
|
+
*/
|
|
778
|
+
peak_num_ports?: number;
|
|
779
|
+
/**
|
|
780
|
+
* A DHT indexer rather than people.
|
|
781
|
+
*/
|
|
782
|
+
indexer?: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* The two-letter codes its clients name themselves by.
|
|
785
|
+
*/
|
|
786
|
+
clients?: Array<string>;
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* Who uses the address, from our IP Company database. Paid plans. Every
|
|
790
|
+
* key is present whenever the object is: empty strings where no record
|
|
791
|
+
* covers the address.
|
|
792
|
+
*
|
|
793
|
+
*/
|
|
794
|
+
export type Company = {
|
|
795
|
+
/**
|
|
796
|
+
* Who uses the address.
|
|
797
|
+
*/
|
|
798
|
+
name: string;
|
|
799
|
+
/**
|
|
800
|
+
* Their domain.
|
|
801
|
+
*/
|
|
802
|
+
domain: string;
|
|
803
|
+
/**
|
|
804
|
+
* What kind of organization: hosting, isp, business, education or government.
|
|
805
|
+
*/
|
|
806
|
+
type?: string;
|
|
807
|
+
/**
|
|
808
|
+
* ISO 3166 country code.
|
|
809
|
+
*/
|
|
810
|
+
country?: string;
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* Where to report abuse from the address, from our IP Abuse Contact
|
|
814
|
+
* database. Paid plans. Every key is present whenever the object is: empty
|
|
815
|
+
* strings where no record covers the address.
|
|
816
|
+
*
|
|
817
|
+
*/
|
|
818
|
+
export type AbuseContact = {
|
|
819
|
+
/**
|
|
820
|
+
* Where to report abuse from the address.
|
|
821
|
+
*/
|
|
822
|
+
email: string;
|
|
823
|
+
/**
|
|
824
|
+
* The contact.
|
|
825
|
+
*/
|
|
826
|
+
name?: string;
|
|
827
|
+
/**
|
|
828
|
+
* Its phone number.
|
|
829
|
+
*/
|
|
830
|
+
phone?: string;
|
|
831
|
+
/**
|
|
832
|
+
* Its postal address.
|
|
833
|
+
*/
|
|
834
|
+
address?: string;
|
|
835
|
+
/**
|
|
836
|
+
* ISO 3166 country code.
|
|
837
|
+
*/
|
|
838
|
+
country?: string;
|
|
839
|
+
/**
|
|
840
|
+
* The registry block it was derived from.
|
|
841
|
+
*/
|
|
842
|
+
network?: string;
|
|
843
|
+
/**
|
|
844
|
+
* ARIN reports the contact answered its yearly validation.
|
|
845
|
+
*/
|
|
846
|
+
validated?: boolean;
|
|
847
|
+
/**
|
|
848
|
+
* Since when it has not.
|
|
849
|
+
*/
|
|
850
|
+
unvalidated_since?: string;
|
|
406
851
|
};
|
|
407
852
|
/**
|
|
408
853
|
* Every non-2xx response carries this shape.
|
|
@@ -444,8 +889,8 @@ export type EntitlementPlan = {
|
|
|
444
889
|
/**
|
|
445
890
|
* The plan the organization is on, as an identifier that is never
|
|
446
891
|
* renamed or reused: `free` for the free plan, or a paid plan's key.
|
|
447
|
-
* Compare against it and show `name`. On `free`, usage counts
|
|
448
|
-
*
|
|
892
|
+
* Compare against it and show `name`. On `free`, usage counts its
|
|
893
|
+
* trial, the lookups answered with every field.
|
|
449
894
|
*
|
|
450
895
|
*/
|
|
451
896
|
key: string;
|
|
@@ -644,8 +1089,8 @@ export type LookupIpErrors = {
|
|
|
644
1089
|
403: LookupError;
|
|
645
1090
|
/**
|
|
646
1091
|
* A rate limit, always with `Retry-After`. A paid plan's overage cap is
|
|
647
|
-
* never a `429
|
|
648
|
-
* `cap_reached` `true
|
|
1092
|
+
* never a `429` by itself: it answers `200` with Unlimited's fields and
|
|
1093
|
+
* `cap_reached` `true`, and a burst past it is rate limited as an Unlimited one is.
|
|
649
1094
|
*
|
|
650
1095
|
*/
|
|
651
1096
|
429: LookupError;
|
|
@@ -686,8 +1131,8 @@ export type LookupMyIpErrors = {
|
|
|
686
1131
|
403: LookupError;
|
|
687
1132
|
/**
|
|
688
1133
|
* A rate limit, always with `Retry-After`. A paid plan's overage cap is
|
|
689
|
-
* never a `429
|
|
690
|
-
* `cap_reached` `true
|
|
1134
|
+
* never a `429` by itself: it answers `200` with Unlimited's fields and
|
|
1135
|
+
* `cap_reached` `true`, and a burst past it is rate limited as an Unlimited one is.
|
|
691
1136
|
*
|
|
692
1137
|
*/
|
|
693
1138
|
429: LookupError;
|
|
@@ -745,7 +1190,7 @@ export type LookupBatchErrors = {
|
|
|
745
1190
|
/**
|
|
746
1191
|
* The rate limit refused the whole call. Always transient and always
|
|
747
1192
|
* with `Retry-After`; a reached overage cap answers each entry in a
|
|
748
|
-
* `200` instead.
|
|
1193
|
+
* `200` instead, and a burst past it is rate limited as an Unlimited one is.
|
|
749
1194
|
*
|
|
750
1195
|
*/
|
|
751
1196
|
429: LookupError;
|
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, Location, Asn, LookupResponse, } from './types.js';
|
|
9
|
+
export type { Result, VpnDetail, ClassDetail, ProxyDetail, PubproxyDetail, CarrierDetail, SatelliteDetail, SshDetail, SmtpDetail, WebDetail, DnsResolverDetail, BitTorrentDetail, 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,20 +1,32 @@
|
|
|
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
3
|
export declare const ASN_MEMBERS: readonly ["asn", "name", "domain", "type", "prefix"];
|
|
4
|
+
export declare const COMPANY_MEMBERS: readonly ["name", "domain"];
|
|
5
|
+
export declare const ABUSE_CONTACT_MEMBERS: readonly ["email"];
|
|
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"];
|
|
4
7
|
export declare const BATCH_MEMBERS: readonly ["results", "errors"];
|
|
5
8
|
export declare const BATCH_ERROR_MEMBERS: readonly ["status", "error"];
|
|
6
9
|
export declare const ENTITLEMENT_MEMBERS: readonly ["org_id", "apikey", "plan", "usage"];
|
|
7
10
|
export declare const ENTITLEMENT_APIKEY_MEMBERS: readonly ["id", "allowed_cidrs"];
|
|
8
11
|
export declare const ENTITLEMENT_PLAN_MEMBERS: readonly ["key", "name", "tier"];
|
|
9
12
|
export declare const ENTITLEMENT_USAGE_MEMBERS: readonly ["requests", "quota", "window_start", "window_end"];
|
|
10
|
-
type Kind = 'string' | 'integer' | 'boolean' | 'object' | 'array' | 'date' | 'date-time';
|
|
13
|
+
type Kind = 'string' | 'integer' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'date-time';
|
|
11
14
|
export declare const LOOKUP_TYPES: Record<string, Kind>;
|
|
12
15
|
export declare const VPN_DETAIL_TYPES: Record<string, Kind>;
|
|
13
16
|
export declare const CLASS_DETAIL_TYPES: Record<string, Kind>;
|
|
14
17
|
export declare const PROXY_DETAIL_TYPES: Record<string, Kind>;
|
|
15
18
|
export declare const PUBPROXY_DETAIL_TYPES: Record<string, Kind>;
|
|
19
|
+
export declare const CARRIER_DETAIL_TYPES: Record<string, Kind>;
|
|
20
|
+
export declare const SATELLITE_DETAIL_TYPES: Record<string, Kind>;
|
|
21
|
+
export declare const SSH_DETAIL_TYPES: Record<string, Kind>;
|
|
22
|
+
export declare const SMTP_DETAIL_TYPES: Record<string, Kind>;
|
|
23
|
+
export declare const WEB_DETAIL_TYPES: Record<string, Kind>;
|
|
24
|
+
export declare const DNS_RESOLVER_DETAIL_TYPES: Record<string, Kind>;
|
|
25
|
+
export declare const BITTORRENT_DETAIL_TYPES: Record<string, Kind>;
|
|
16
26
|
export declare const LOCATION_TYPES: Record<string, Kind>;
|
|
17
27
|
export declare const ASN_TYPES: Record<string, Kind>;
|
|
28
|
+
export declare const COMPANY_TYPES: Record<string, Kind>;
|
|
29
|
+
export declare const ABUSE_CONTACT_TYPES: Record<string, Kind>;
|
|
18
30
|
export declare const BATCH_ERROR_TYPES: Record<string, Kind>;
|
|
19
31
|
export declare const ENTITLEMENT_TYPES: Record<string, Kind>;
|
|
20
32
|
export declare const ENTITLEMENT_APIKEY_TYPES: Record<string, Kind>;
|
package/dist/shapes.js
CHANGED
|
@@ -8,6 +8,12 @@ export const LOCATION_MEMBERS = [
|
|
|
8
8
|
'currency_symbol', 'flag_emoji', 'flag_unicode',
|
|
9
9
|
];
|
|
10
10
|
export const ASN_MEMBERS = ['asn', 'name', 'domain', 'type', 'prefix'];
|
|
11
|
+
export const COMPANY_MEMBERS = ['name', 'domain'];
|
|
12
|
+
export const ABUSE_CONTACT_MEMBERS = ['email'];
|
|
13
|
+
export const WEB_DETAIL_MEMBERS = [
|
|
14
|
+
'port', 'tls_ok', 'session_ok', 'status_code', 'server', 'location', 'title', 'cert_subject_cn',
|
|
15
|
+
'cert_subject_o', 'cert_issuer_dn', 'cert_browser_trusted', 'tls_version', 'first_seen', 'last_seen',
|
|
16
|
+
];
|
|
11
17
|
export const BATCH_MEMBERS = ['results', 'errors'];
|
|
12
18
|
export const BATCH_ERROR_MEMBERS = ['status', 'error'];
|
|
13
19
|
export const ENTITLEMENT_MEMBERS = ['org_id', 'apikey', 'plan', 'usage'];
|
|
@@ -17,9 +23,12 @@ export const ENTITLEMENT_USAGE_MEMBERS = ['requests', 'quota', 'window_start', '
|
|
|
17
23
|
export const LOOKUP_TYPES = {
|
|
18
24
|
ip: 'string', is_bogon: 'boolean', is_vpn: 'boolean', is_hosting: 'boolean', is_relay: 'boolean', is_tor: 'boolean',
|
|
19
25
|
is_cdn: 'boolean', is_resproxy: 'boolean', is_dcproxy: 'boolean', is_mobproxy: 'boolean',
|
|
20
|
-
is_pubproxy: 'boolean',
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
is_pubproxy: 'boolean', is_anycast: 'boolean', is_carrier: 'boolean', is_satellite: 'boolean', is_ssh: 'boolean',
|
|
27
|
+
is_smtp: 'boolean', is_web: 'boolean', is_dns_resolver: 'boolean', is_bittorrent: 'boolean', vpn: 'object',
|
|
28
|
+
hosting: 'object', relay: 'object', tor: 'object', cdn: 'object', resproxy: 'object', dcproxy: 'object',
|
|
29
|
+
mobproxy: 'object', pubproxy: 'object', carrier: 'object', satellite: 'object', ssh: 'object', smtp: 'object',
|
|
30
|
+
web: 'array', dns_resolver: 'object', bittorrent: 'object', location: 'object', asn: 'object',
|
|
31
|
+
company: 'object', hostname: 'string', abuse: 'object', trial_expired: 'boolean', cap_reached: 'boolean',
|
|
23
32
|
};
|
|
24
33
|
export const VPN_DETAIL_TYPES = {
|
|
25
34
|
provider: 'string', provider_name: 'string', last_seen: 'date', confidence: 'string', method: 'string',
|
|
@@ -35,9 +44,51 @@ export const PUBPROXY_DETAIL_TYPES = {
|
|
|
35
44
|
entry: 'boolean', exit: 'boolean', protocols: 'array', num_ports: 'integer', num_proxies: 'integer',
|
|
36
45
|
last_seen: 'date', last_usable: 'string',
|
|
37
46
|
};
|
|
38
|
-
export const
|
|
47
|
+
export const CARRIER_DETAIL_TYPES = {
|
|
48
|
+
name: 'string', mcc: 'string', mnc: 'string', country: 'string', confidence: 'string',
|
|
49
|
+
};
|
|
50
|
+
export const SATELLITE_DETAIL_TYPES = {
|
|
51
|
+
provider: 'string', provider_name: 'string', orbit: 'string', segment: 'string', country: 'string',
|
|
52
|
+
asn: 'integer', confidence: 'string',
|
|
53
|
+
};
|
|
54
|
+
export const SSH_DETAIL_TYPES = {
|
|
55
|
+
port: 'integer', banner: 'string', host_key_fp: 'string', session_ok: 'boolean', first_seen: 'string',
|
|
56
|
+
last_seen: 'string',
|
|
57
|
+
};
|
|
58
|
+
export const SMTP_DETAIL_TYPES = {
|
|
59
|
+
port: 'integer', banner: 'string', session_ok: 'boolean', first_seen: 'string', last_seen: 'string',
|
|
60
|
+
};
|
|
61
|
+
export const WEB_DETAIL_TYPES = {
|
|
62
|
+
port: 'integer', tls_ok: 'boolean', session_ok: 'boolean', status_code: 'integer', server: 'string',
|
|
63
|
+
location: 'string', title: 'string', cert_subject_cn: 'string', cert_subject_o: 'string',
|
|
64
|
+
cert_issuer_dn: 'string', cert_browser_trusted: 'boolean', tls_version: 'string', first_seen: 'string',
|
|
65
|
+
last_seen: 'string',
|
|
66
|
+
};
|
|
67
|
+
export const DNS_RESOLVER_DETAIL_TYPES = {
|
|
68
|
+
port: 'integer', recursion_available: 'boolean', rcode: 'integer', answer_correct: 'boolean',
|
|
69
|
+
first_seen: 'string', last_seen: 'string',
|
|
70
|
+
};
|
|
71
|
+
export const BITTORRENT_DETAIL_TYPES = {
|
|
72
|
+
verified: 'boolean', id_matches_ip: 'boolean', first_seen: 'string', last_seen: 'string',
|
|
73
|
+
last_reachable: 'string', days_seen: 'integer', num_ports: 'integer', peak_num_ports: 'integer',
|
|
74
|
+
indexer: 'boolean', clients: 'array',
|
|
75
|
+
};
|
|
76
|
+
export const LOCATION_TYPES = {
|
|
77
|
+
...Object.fromEntries(LOCATION_MEMBERS.map((m) => [m, 'string'])),
|
|
78
|
+
region: 'string', region_code: 'string', city: 'string', postal_code: 'string', latitude: 'number',
|
|
79
|
+
longitude: 'number', accuracy_radius: 'integer', geoname_id: 'string', dma_code: 'string',
|
|
80
|
+
last_changed: 'string',
|
|
81
|
+
};
|
|
39
82
|
export const ASN_TYPES = {
|
|
40
|
-
asn: 'integer', name: 'string', domain: 'string', type: 'string', prefix: 'string',
|
|
83
|
+
asn: 'integer', name: 'string', domain: 'string', type: 'string', prefix: 'string', country: 'string',
|
|
84
|
+
rpki_status: 'string',
|
|
85
|
+
};
|
|
86
|
+
export const COMPANY_TYPES = {
|
|
87
|
+
name: 'string', domain: 'string', type: 'string', country: 'string',
|
|
88
|
+
};
|
|
89
|
+
export const ABUSE_CONTACT_TYPES = {
|
|
90
|
+
email: 'string', name: 'string', phone: 'string', address: 'string', country: 'string', network: 'string',
|
|
91
|
+
validated: 'boolean', unvalidated_since: 'string',
|
|
41
92
|
};
|
|
42
93
|
export const BATCH_ERROR_TYPES = { status: 'integer', error: 'string' };
|
|
43
94
|
export const ENTITLEMENT_TYPES = {
|
|
@@ -58,6 +109,7 @@ function isKind(value, kind) {
|
|
|
58
109
|
switch (kind) {
|
|
59
110
|
case 'string': return typeof value === 'string';
|
|
60
111
|
case 'integer': return Number.isInteger(value);
|
|
112
|
+
case 'number': return typeof value === 'number' && Number.isFinite(value);
|
|
61
113
|
case 'boolean': return typeof value === 'boolean';
|
|
62
114
|
case 'object': return isObject(value);
|
|
63
115
|
case 'array': return Array.isArray(value);
|
|
@@ -105,17 +157,30 @@ function isString(value) {
|
|
|
105
157
|
function optional(value, valid) {
|
|
106
158
|
return value === undefined || value === null || valid(value);
|
|
107
159
|
}
|
|
160
|
+
function lists(value, member, valid) {
|
|
161
|
+
return optional(value[member], (list) => every(list, valid));
|
|
162
|
+
}
|
|
108
163
|
const DETAILS = [
|
|
109
164
|
['vpn', VPN_DETAIL_TYPES], ['hosting', CLASS_DETAIL_TYPES], ['relay', CLASS_DETAIL_TYPES],
|
|
110
165
|
['tor', CLASS_DETAIL_TYPES], ['cdn', CLASS_DETAIL_TYPES], ['resproxy', PROXY_DETAIL_TYPES],
|
|
111
166
|
['dcproxy', PROXY_DETAIL_TYPES], ['mobproxy', PROXY_DETAIL_TYPES], ['pubproxy', PUBPROXY_DETAIL_TYPES],
|
|
167
|
+
['carrier', CARRIER_DETAIL_TYPES], ['satellite', SATELLITE_DETAIL_TYPES], ['ssh', SSH_DETAIL_TYPES],
|
|
168
|
+
['smtp', SMTP_DETAIL_TYPES], ['dns_resolver', DNS_RESOLVER_DETAIL_TYPES],
|
|
169
|
+
['bittorrent', BITTORRENT_DETAIL_TYPES],
|
|
170
|
+
];
|
|
171
|
+
const SHARED = [
|
|
172
|
+
['location', LOCATION_MEMBERS, LOCATION_TYPES],
|
|
173
|
+
['asn', ASN_MEMBERS, ASN_TYPES],
|
|
174
|
+
['company', COMPANY_MEMBERS, COMPANY_TYPES],
|
|
175
|
+
['abuse', ABUSE_CONTACT_MEMBERS, ABUSE_CONTACT_TYPES],
|
|
112
176
|
];
|
|
113
177
|
export function isLookup(data) {
|
|
114
178
|
return typed(data, LOOKUP_MEMBERS, LOOKUP_TYPES)
|
|
115
179
|
&& DETAILS.every(([member, types]) => optional(data[member], (detail) => typed(detail, [], types)))
|
|
116
|
-
&& optional(data['pubproxy']
|
|
117
|
-
&& optional(data['
|
|
118
|
-
&& optional(data['
|
|
180
|
+
&& optional(data['pubproxy'], (pubproxy) => lists(pubproxy, 'protocols', isString))
|
|
181
|
+
&& optional(data['bittorrent'], (bittorrent) => lists(bittorrent, 'clients', isString))
|
|
182
|
+
&& optional(data['web'], (web) => every(web, (row) => typed(row, WEB_DETAIL_MEMBERS, WEB_DETAIL_TYPES)))
|
|
183
|
+
&& SHARED.every(([member, required, types]) => optional(data[member], (o) => typed(o, required, types)));
|
|
119
184
|
}
|
|
120
185
|
/** Both maps present. An entry in either is judged on its own, as that address's answer. */
|
|
121
186
|
export function isBatch(data) {
|
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,15 +1,16 @@
|
|
|
1
|
-
import type { Asn, ClassDetail, Location, LookupResponse, ProxyDetail, PubproxyDetail, VpnDetail } from './generated/types.gen.js';
|
|
2
|
-
export type { Asn, ClassDetail, Location, ProxyDetail, PubproxyDetail, VpnDetail,
|
|
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, Asn, BitTorrentDetail, CarrierDetail, ClassDetail, Company, DnsResolverDetail, Location, LookupResponse, ProxyDetail, PubproxyDetail, SatelliteDetail, SmtpDetail, SshDetail, VpnDetail, WebDetail, };
|
|
3
3
|
/**
|
|
4
4
|
* What a lookup answers.
|
|
5
5
|
*
|
|
6
6
|
* An **optional** member is one your plan does not include. It never means "we
|
|
7
7
|
* could not check", so `undefined` and `false` are genuinely different answers:
|
|
8
8
|
* `undefined` is "not in your plan", `false` is "checked, and no". Use
|
|
9
|
-
* `?? false` when you only care whether the address is flagged.
|
|
9
|
+
* `?? false` when you only care whether the address is flagged. The same holds
|
|
10
|
+
* inside `location` and `asn`, whose paid members are absent on Unlimited.
|
|
10
11
|
*
|
|
11
|
-
* A detail object that is present but empty (`{}`) means the
|
|
12
|
-
* false. A populated one always carries every one of its keys.
|
|
12
|
+
* A detail object that is present but empty (`{}`, and `web`'s `[]`) means the
|
|
13
|
+
* flag above it is false. A populated one always carries every one of its keys.
|
|
13
14
|
*/
|
|
14
15
|
export interface Result {
|
|
15
16
|
/** The address that was looked up, normalized. */
|
|
@@ -29,10 +30,18 @@ export interface Result {
|
|
|
29
30
|
isDcproxy?: boolean;
|
|
30
31
|
isMobproxy?: boolean;
|
|
31
32
|
isPubproxy?: boolean;
|
|
33
|
+
/** Whether the address is announced from many places at once. Every plan includes this. */
|
|
34
|
+
isAnycast?: boolean;
|
|
35
|
+
isCarrier?: boolean;
|
|
36
|
+
isSatellite?: boolean;
|
|
37
|
+
isSsh?: boolean;
|
|
38
|
+
isSmtp?: boolean;
|
|
39
|
+
isWeb?: boolean;
|
|
40
|
+
isDnsResolver?: boolean;
|
|
41
|
+
isBittorrent?: boolean;
|
|
32
42
|
/**
|
|
33
|
-
* On answers to a key on the free plan only: `false` while its organization's
|
|
34
|
-
*
|
|
35
|
-
* Unlimited's.
|
|
43
|
+
* On answers to a key on the free plan only: `false` while its organization's trial of every
|
|
44
|
+
* field lasts, `true` once the answer has Unlimited's.
|
|
36
45
|
*/
|
|
37
46
|
trialExpired?: boolean;
|
|
38
47
|
/**
|
|
@@ -50,13 +59,34 @@ export interface Result {
|
|
|
50
59
|
dcproxy?: ProxyDetail;
|
|
51
60
|
mobproxy?: ProxyDetail;
|
|
52
61
|
pubproxy?: PubproxyDetail;
|
|
62
|
+
carrier?: CarrierDetail;
|
|
63
|
+
satellite?: SatelliteDetail;
|
|
64
|
+
ssh?: SshDetail;
|
|
65
|
+
smtp?: SmtpDetail;
|
|
66
|
+
/** A row per port that answered, lowest first. */
|
|
67
|
+
web?: WebDetail[];
|
|
68
|
+
dnsResolver?: DnsResolverDetail;
|
|
69
|
+
bittorrent?: BitTorrentDetail;
|
|
53
70
|
/**
|
|
54
71
|
* Where the address is, on every answer, with or without a key: every key present, empty
|
|
55
|
-
* strings where it is not known.
|
|
72
|
+
* strings where it is not known. The region, city, postal code, coordinates and the rest
|
|
73
|
+
* after `flag_unicode` come with a paid plan.
|
|
56
74
|
*/
|
|
57
75
|
location?: Location;
|
|
58
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The AS announcing the address, on every answer, with or without a key: `asn` is 0 where none
|
|
78
|
+
* does. `country` and `rpki_status` are on every plan too.
|
|
79
|
+
*/
|
|
59
80
|
asn?: Asn;
|
|
81
|
+
/** The organization the address is assigned to. */
|
|
82
|
+
company?: Company;
|
|
83
|
+
/**
|
|
84
|
+
* The name the address's reverse DNS (PTR) record points to, empty when it has none. Every
|
|
85
|
+
* plan includes this.
|
|
86
|
+
*/
|
|
87
|
+
hostname?: string;
|
|
88
|
+
/** Where to report abuse from the address. */
|
|
89
|
+
abuse?: AbuseContact;
|
|
60
90
|
/** The response exactly as it came off the wire, with its original names. */
|
|
61
91
|
raw: LookupResponse;
|
|
62
92
|
}
|
package/dist/types.js
CHANGED
|
@@ -1,44 +1,26 @@
|
|
|
1
|
-
// The one place the wire's snake_case becomes idiomatic camelCase. Every
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// The one place the wire's snake_case becomes idiomatic camelCase. Every member
|
|
2
|
+
// is copied when its key is PRESENT rather than truthy, so a plan that includes a
|
|
3
|
+
// field and answers `false` keeps it, and a plan that does not include it stays
|
|
4
|
+
// undefined. A member the spec adds fails to compile here until it is named.
|
|
5
|
+
const RESULT_NAMES = {
|
|
6
|
+
ip: 'ip', is_vpn: 'isVpn', is_hosting: 'isHosting', is_relay: 'isRelay', is_tor: 'isTor', is_cdn: 'isCdn',
|
|
7
|
+
is_resproxy: 'isResproxy', is_dcproxy: 'isDcproxy', is_mobproxy: 'isMobproxy', is_pubproxy: 'isPubproxy',
|
|
8
|
+
is_anycast: 'isAnycast', is_carrier: 'isCarrier', is_satellite: 'isSatellite', is_ssh: 'isSsh',
|
|
9
|
+
is_smtp: 'isSmtp', is_web: 'isWeb', is_dns_resolver: 'isDnsResolver', is_bittorrent: 'isBittorrent',
|
|
10
|
+
trial_expired: 'trialExpired', cap_reached: 'capReached',
|
|
11
|
+
vpn: 'vpn', hosting: 'hosting', relay: 'relay', tor: 'tor', cdn: 'cdn', resproxy: 'resproxy', dcproxy: 'dcproxy',
|
|
12
|
+
mobproxy: 'mobproxy', pubproxy: 'pubproxy', carrier: 'carrier', satellite: 'satellite', ssh: 'ssh', smtp: 'smtp',
|
|
13
|
+
web: 'web', dns_resolver: 'dnsResolver', bittorrent: 'bittorrent', location: 'location', asn: 'asn',
|
|
14
|
+
company: 'company', hostname: 'hostname', abuse: 'abuse',
|
|
15
|
+
};
|
|
5
16
|
export function toResult(body) {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
copyFlag(body, r, 'is_hosting', 'isHosting');
|
|
13
|
-
copyFlag(body, r, 'is_relay', 'isRelay');
|
|
14
|
-
copyFlag(body, r, 'is_tor', 'isTor');
|
|
15
|
-
copyFlag(body, r, 'is_cdn', 'isCdn');
|
|
16
|
-
copyFlag(body, r, 'is_resproxy', 'isResproxy');
|
|
17
|
-
copyFlag(body, r, 'is_dcproxy', 'isDcproxy');
|
|
18
|
-
copyFlag(body, r, 'is_mobproxy', 'isMobproxy');
|
|
19
|
-
copyFlag(body, r, 'is_pubproxy', 'isPubproxy');
|
|
20
|
-
copyFlag(body, r, 'trial_expired', 'trialExpired');
|
|
21
|
-
copyFlag(body, r, 'cap_reached', 'capReached');
|
|
22
|
-
copyDetail(body, r, 'vpn', 'vpn');
|
|
23
|
-
copyDetail(body, r, 'hosting', 'hosting');
|
|
24
|
-
copyDetail(body, r, 'relay', 'relay');
|
|
25
|
-
copyDetail(body, r, 'tor', 'tor');
|
|
26
|
-
copyDetail(body, r, 'cdn', 'cdn');
|
|
27
|
-
copyDetail(body, r, 'resproxy', 'resproxy');
|
|
28
|
-
copyDetail(body, r, 'dcproxy', 'dcproxy');
|
|
29
|
-
copyDetail(body, r, 'mobproxy', 'mobproxy');
|
|
30
|
-
copyDetail(body, r, 'pubproxy', 'pubproxy');
|
|
31
|
-
copyDetail(body, r, 'location', 'location');
|
|
32
|
-
copyDetail(body, r, 'asn', 'asn');
|
|
33
|
-
return r;
|
|
34
|
-
}
|
|
35
|
-
function copyFlag(body, out, from, to) {
|
|
36
|
-
if (from in body && body[from] !== undefined) {
|
|
37
|
-
out[to] = body[from];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function copyDetail(body, out, from, to) {
|
|
41
|
-
if (from in body && body[from] !== undefined) {
|
|
42
|
-
out[to] = body[from];
|
|
17
|
+
const out = {};
|
|
18
|
+
for (const [from, to] of Object.entries(RESULT_NAMES)) {
|
|
19
|
+
if (from in body && body[from] !== undefined) {
|
|
20
|
+
out[to] = body[from];
|
|
21
|
+
}
|
|
43
22
|
}
|
|
23
|
+
out['isBogon'] = body.is_bogon === true;
|
|
24
|
+
out['raw'] = body;
|
|
25
|
+
return out;
|
|
44
26
|
}
|
package/package.json
CHANGED