@internetdata/internetdata 2.8.1 → 2.9.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 CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  The official Node.js client library for the [InternetData](https://internetdata.io) API.
7
7
 
8
- InternetData publishes IP and ASN databases: geolocation, anonymity, ownership and network data, as gzipped CSV and as MMDB. This library lists the databases your organization is licensed for, tells you what is inside one before you fetch it, downloads it, and verifies the bytes you got.
8
+ It looks up what every InternetData database says about an IP address, an AS or a domain, and downloads the databases your organization is licensed for.
9
9
 
10
10
  ## Getting Started
11
11
 
@@ -17,6 +17,170 @@ Requires Node.js 22 or newer. TypeScript types are included.
17
17
 
18
18
  ## Usage
19
19
 
20
+ **No API key needed to start.** Unlimited, the free plan, answers Tor, relay, anycast, carrier, satellite and the five service flags (SSH, SMTP, web, DNS resolver and BitTorrent), reverse DNS, country-level `location`, `asn`, the company's name and domain and the abuse email, with no daily or monthly cap, with a key or without one.
21
+
22
+ ```js
23
+ import { InternetData } from '@internetdata/internetdata';
24
+
25
+ const client = new InternetData();
26
+
27
+ const result = await client.lookup('146.70.116.130');
28
+ console.log(result.isTor); // false
29
+ console.log(result.location.country); // the ISO 3166 country code
30
+ console.log(result.company.name); // who the address belongs to
31
+ ```
32
+
33
+ ### With an API key
34
+
35
+ Every paid plan answers every field: `is_vpn`, `is_hosting`, `is_cdn` and the four proxy flags as well, city-level location, the whois records and the 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.internetdata.io), then pass it in:
36
+
37
+ ```js
38
+ const client = new InternetData({ apiKey: process.env.INTERNETDATA_API_KEY });
39
+
40
+ const result = await client.lookup('146.70.116.130');
41
+ console.log(result.isVpn); // on a paid plan
42
+ console.log(result.vpn?.provider); // on a paid plan
43
+ console.log(result.location.city); // on a paid plan
44
+ ```
45
+
46
+ ### An AS or a domain
47
+
48
+ ```js
49
+ const asn = await client.lookupAsn(9009);
50
+ console.log(asn.name); // M247 Europe SRL
51
+ console.log(asn.prefixes); // on a paid plan
52
+
53
+ const domain = await client.lookupDomain('example.com');
54
+ console.log(domain.isRegistered); // true
55
+ console.log(domain.dns?.mx); // on a paid plan
56
+ ```
57
+
58
+ Unlimited answers an AS's registration, and whether a domain is registered and which record types it has. A paid plan adds the AS's whois record and prefixes, and the domain's records, IP ranges and whether it is disposable. Neither lookup is cached or batched.
59
+
60
+ ### Your own address
61
+
62
+ ```js
63
+ const result = await client.myIp();
64
+ console.log(result.ip); // the address we saw this call come from
65
+ ```
66
+
67
+ ### Your plan and usage
68
+
69
+ ```js
70
+ const ent = await client.myEntitlement();
71
+ console.log(ent.plan.key); // starter
72
+ console.log(ent.usage.requests); // 580
73
+ console.log(ent.usage.window_end); // when the allowance resets
74
+ ```
75
+
76
+ Usage counts against the anniversary of your subscription on a paid plan, not the calendar month and not the billing period, and against the UTC day on the free plan; it is the same number a lookup is gated on. `hard_limit` is null on an uncapped plan, which is not the same as zero.
77
+
78
+ ### Batch lookup
79
+
80
+ Look up as many addresses as you like in one call. Bogons and cached answers are handled locally, and the rest go to the batch endpoint in chunks of up to 1000, in parallel. The batch endpoint needs a paid plan:
81
+
82
+ ```js
83
+ const results = await client.lookupBatch(['146.70.116.130', '8.8.8.8', '1.1.1.1']);
84
+
85
+ for (const [ip, result] of results) {
86
+ if (result instanceof Error) {
87
+ console.log(`${ip}: ${result.message}`);
88
+ continue;
89
+ }
90
+ console.log(`${ip}: ${result.isVpn}`);
91
+ }
92
+ ```
93
+
94
+ Results are keyed by address, in the order you first listed each one, so duplicates in your list collapse into a single entry and one address failing never loses the rest: it carries its error as its value, with the status the API would have given that address on its own.
95
+
96
+ How many chunks are in flight at once, how many times a failed chunk is retried, and how long each request may take are configurable per call:
97
+
98
+ ```js
99
+ const results = await client.lookupBatch(manyIps, { concurrency: 4, retries: 4, timeoutMs: 10_000 });
100
+ ```
101
+
102
+ ### Caching
103
+
104
+ Answers are cached by default, so repeat lookups of the same address are free:
105
+
106
+ ```js
107
+ const client = new InternetData();
108
+
109
+ const result = await client.lookup('146.70.116.130');
110
+ console.log(result.isTor); // false, API request
111
+
112
+ const result2 = await client.lookup('146.70.116.130');
113
+ console.log(result2.isTor); // false, no API request, result was cached
114
+ ```
115
+
116
+ You can change the default cache variables (max size, TTL, etc) on initialization, or even disable it:
117
+
118
+ ```js
119
+ const client = new InternetData({ cache: { max: 50_000, ttlMs: 6 * 60 * 60 * 1000 } });
120
+ const clientNoCache = new InternetData({ cache: false });
121
+ ```
122
+
123
+ ### Private and reserved addresses
124
+
125
+ Private, loopback, link-local, documentation and multicast addresses (and their IPv6 equivalents, including the 6to4 and Teredo ranges) are answered locally, so they cost no request and no quota. Each gets the answer the API gives one, every flag false bar `is_bogon` and every other field empty:
126
+
127
+ ```js
128
+ const result = await client.lookup('192.168.1.1');
129
+ result.isBogon; // true
130
+ result.isVpn; // false
131
+ ```
132
+
133
+ The check is available on the client, which is handy when your inputs are addresses anyway:
134
+
135
+ ```js
136
+ client.isBogon('10.0.0.1'); // true
137
+ client.isBogon('8.8.8.8'); // false
138
+ ```
139
+
140
+ It is also importable on its own, if you want it without a client:
141
+
142
+ ```js
143
+ import { isBogon } from '@internetdata/internetdata';
144
+
145
+ isBogon('10.0.0.1'); // true
146
+ ```
147
+
148
+ ### Errors
149
+
150
+ Failures throw an `InternetDataError` carrying a `kind` and a `retryable` flag:
151
+
152
+ ```js
153
+ import { InternetDataError } from '@internetdata/internetdata';
154
+
155
+ try {
156
+ await client.lookup('146.70.116.130');
157
+ } catch (err) {
158
+ if (err instanceof InternetDataError) {
159
+ console.error(err.kind, err.status, err.retryable);
160
+ }
161
+ }
162
+ ```
163
+
164
+ `kind` is one of `bad_request`, `unauthorized`, `forbidden`, `rate_limited`, `quota_exceeded`, `server_error` or `network`. The message is the API's own: a sentence from a lookup, and from a database call its result code, such as `NOT_LICENSED` or `LICENSE_EXPIRED`.
165
+
166
+ `rate_limited` is a 429 that carries `Retry-After`, and the library retries it for you. `quota_exceeded` is a 429 without one, which it never retries: your allowance needs raising, or its window has to roll over. The database calls have no quota, so only a lookup answers `quota_exceeded`.
167
+
168
+ A failure part way through a transfer is rethrown as it arrived rather than wrapped: a reset socket and a full disk are different problems, and only one of them is ours.
169
+
170
+ ### Timeouts
171
+
172
+ A request that hasn't finished after 30 seconds is abandoned and surfaces as a retryable `network` error. The limit applies to each attempt, so a call that gets retried can take longer in total. Set it for the client, or for a single lookup:
173
+
174
+ ```js
175
+ const client = new InternetData({ timeoutMs: 10_000 });
176
+
177
+ const result = await client.lookup('146.70.116.130', { timeoutMs: 2000 });
178
+ ```
179
+
180
+ A database transfer is exempt, because a large one takes minutes.
181
+
182
+ ### Database downloads
183
+
20
184
  Every database call needs an API key carrying the `db.download` scope; create one in the [console](https://app.internetdata.io). The Open databases are licensed to every organization from the start and are free under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/), and `list()` marks them `open`. The rest are licensed by contract rather than bought self-serve; see the [API documentation](https://docs.internetdata.io/api), or [request an evaluation](https://internetdata.io/contact?purpose=evaluation&subject=Evaluation+license) if your organization doesn't have a license yet.
21
185
 
22
186
  ```js
@@ -105,28 +269,6 @@ for (const d of await client.database.downloads({ limit: 20 })) {
105
269
  }
106
270
  ```
107
271
 
108
- ### Errors
109
-
110
- Failures throw an `InternetDataError` carrying a `kind` and a `retryable` flag:
111
-
112
- ```js
113
- import { InternetDataError } from '@internetdata/internetdata';
114
-
115
- try {
116
- await client.database.download('vpn_ip_v1', 'mmdb', './vpn_ip_v1.mmdb');
117
- } catch (err) {
118
- if (err instanceof InternetDataError) {
119
- console.error(err.kind, err.status, err.retryable);
120
- }
121
- }
122
- ```
123
-
124
- `kind` is one of `bad_request`, `unauthorized`, `forbidden`, `rate_limited`, `quota_exceeded`, `server_error` or `network`. The message is the API's own result code, such as `NOT_LICENSED` or `LICENSE_EXPIRED`, which is usually the specific thing you want to read.
125
-
126
- `rate_limited` is a 429 that carries `Retry-After`, and the library retries it for you. `quota_exceeded` is a 429 without one, which it never retries. InternetData's database API has no quota, so you won't see `quota_exceeded` from it.
127
-
128
- A failure part way through a transfer is rethrown as it arrived rather than wrapped: a reset socket and a full disk are different problems, and only one of them is ours.
129
-
130
272
  ### Sign in with OAuth (device flow)
131
273
 
132
274
  A program running on the person's own machine can let them sign in with a browser and pick one of their API keys, instead of asking them to paste it:
@@ -179,13 +321,23 @@ const registration = await client.oauth.register(['http://127.0.0.1:8765/callbac
179
321
 
180
322
  Each redirect URI must be https on a public host name, or http on a loopback address, which then matches any port. Nothing is kept until a person approves the client, so an app with no client ID saved can simply register again.
181
323
 
324
+ ### Absent is not false
325
+
326
+ Unlimited leaves out `isVpn`, `isHosting`, `isCdn` and the four proxy flags, the detail behind them, and the paid members inside `location`, `asn`, `company` and `abuse`, such as `location.city`; 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".
327
+
328
+ ```js
329
+ result.isVpn ?? false // when you only want the flag
330
+ result.isVpn === undefined // on Unlimited: not in your plan
331
+ result.trialExpired === true // a free-plan key's daily trial is spent
332
+ ```
333
+
182
334
  ## Other Libraries
183
335
 
184
336
  There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, and Ruby. See our GitHub at https://github.com/internetdata for more.
185
337
 
186
338
  ## About InternetData
187
339
 
188
- Geolocation, anonymity, ownership and network databases for IP addresses and AS numbers, licensed as files you download and query yourself.
340
+ Geolocation, anonymity, ownership and network data for IP addresses, AS numbers and domains, as an API and as databases you download and query yourself.
189
341
 
190
342
  [<img src="https://s3.internetdata.io/internetdata-public/brand/mark.svg" alt="InternetData" height="64"/>](https://internetdata.io/)
191
343
 
@@ -0,0 +1,29 @@
1
+ import { type Result } from './types.js';
2
+ /**
3
+ * Whether an address is a bogon: private, loopback, link-local, documentation,
4
+ * multicast or otherwise not routable on the public internet, including the
5
+ * IPv6 equivalents and the 6to4 and Teredo ranges that wrap them.
6
+ *
7
+ * The API answers one from the address alone, so the client answers them
8
+ * itself and they never cost a request. An IPv4-mapped address
9
+ * (`::ffff:8.8.8.8`) is judged as the IPv4 address it carries.
10
+ */
11
+ export declare function isBogon(ip: string): boolean;
12
+ /**
13
+ * The IPv4 address an IPv4-mapped IPv6 address carries, dotted, and any other
14
+ * string as given. A server listening on `::` sees every IPv4 visitor in the
15
+ * mapped form, which is inside `::ffff:0:0/96` and so read whole would answer
16
+ * every one of them as a bogon, with no request made.
17
+ */
18
+ export declare function unmapped(ip: string): string;
19
+ /**
20
+ * The answer a bogon gets, in the shape the API answers one on a paid plan:
21
+ * every flag present and false, every detail object present and empty (Web
22
+ * IP's list empty), `location`, `asn`, `company`, `abuse`, `whois` and `rwhois`
23
+ * with every key empty, `hostname` empty, `hosted_domains` 0, and `is_bogon`
24
+ * true, as the API serves it.
25
+ *
26
+ * Note this is the WIDEST shape regardless of your plan, so do not infer which
27
+ * fields your plan includes from a bogon answer.
28
+ */
29
+ export declare function bogonResult(ip: string): Result;
package/dist/bogon.js ADDED
@@ -0,0 +1,211 @@
1
+ import { BOGON_V4, BOGON_V6 } from './bogons.gen.js';
2
+ import { toResult } from './types.js';
3
+ /**
4
+ * Whether an address is a bogon: private, loopback, link-local, documentation,
5
+ * multicast or otherwise not routable on the public internet, including the
6
+ * IPv6 equivalents and the 6to4 and Teredo ranges that wrap them.
7
+ *
8
+ * The API answers one from the address alone, so the client answers them
9
+ * itself and they never cost a request. An IPv4-mapped address
10
+ * (`::ffff:8.8.8.8`) is judged as the IPv4 address it carries.
11
+ */
12
+ export function isBogon(ip) {
13
+ const addr = unmapped(ip);
14
+ if (addr.includes(':')) {
15
+ const a = v6ToInt(addr);
16
+ return a === null ? false : v6().some((r) => (a & r.mask) === r.net);
17
+ }
18
+ const a = v4ToInt(addr);
19
+ return a === null ? false : v4().some((r) => (a & r.mask) >>> 0 === r.net);
20
+ }
21
+ /**
22
+ * The IPv4 address an IPv4-mapped IPv6 address carries, dotted, and any other
23
+ * string as given. A server listening on `::` sees every IPv4 visitor in the
24
+ * mapped form, which is inside `::ffff:0:0/96` and so read whole would answer
25
+ * every one of them as a bogon, with no request made.
26
+ */
27
+ export function unmapped(ip) {
28
+ if (!ip.includes(':')) {
29
+ return ip;
30
+ }
31
+ const a = v6ToInt(ip);
32
+ if (a === null || a >> 32n !== 0xffffn) {
33
+ return ip;
34
+ }
35
+ const n = Number(a & 0xffffffffn);
36
+ return [n >>> 24, (n >>> 16) & 0xff, (n >>> 8) & 0xff, n & 0xff].join('.');
37
+ }
38
+ /**
39
+ * The answer a bogon gets, in the shape the API answers one on a paid plan:
40
+ * every flag present and false, every detail object present and empty (Web
41
+ * IP's list empty), `location`, `asn`, `company`, `abuse`, `whois` and `rwhois`
42
+ * with every key empty, `hostname` empty, `hosted_domains` 0, and `is_bogon`
43
+ * true, as the API serves it.
44
+ *
45
+ * Note this is the WIDEST shape regardless of your plan, so do not infer which
46
+ * fields your plan includes from a bogon answer.
47
+ */
48
+ export function bogonResult(ip) {
49
+ return toResult(bogonAnswer(ip));
50
+ }
51
+ function bogonAnswer(ip) {
52
+ return {
53
+ ip: ip,
54
+ is_bogon: true,
55
+ is_vpn: false,
56
+ is_tor: false,
57
+ is_relay: false,
58
+ is_resproxy: false,
59
+ is_dcproxy: false,
60
+ is_mobproxy: false,
61
+ is_pubproxy: false,
62
+ is_hosting: false,
63
+ is_cdn: false,
64
+ is_anycast: false,
65
+ is_carrier: false,
66
+ is_satellite: false,
67
+ is_ssh: false,
68
+ is_smtp: false,
69
+ is_web: false,
70
+ is_dns_resolver: false,
71
+ is_bittorrent: false,
72
+ vpn: {},
73
+ tor: {},
74
+ relay: {},
75
+ resproxy: {},
76
+ dcproxy: {},
77
+ mobproxy: {},
78
+ pubproxy: {},
79
+ hosting: {},
80
+ cdn: {},
81
+ carrier: {},
82
+ satellite: {},
83
+ ssh: {},
84
+ smtp: {},
85
+ web: [],
86
+ dns_resolver: {},
87
+ bittorrent: {},
88
+ location: {
89
+ continent: '',
90
+ continent_name: '',
91
+ country: '',
92
+ country_name: '',
93
+ timezone: '',
94
+ currency_code: '',
95
+ currency_name: '',
96
+ currency_symbol: '',
97
+ flag_emoji: '',
98
+ flag_unicode: '',
99
+ region: '',
100
+ region_code: '',
101
+ city: '',
102
+ postal_code: '',
103
+ latitude: 0,
104
+ longitude: 0,
105
+ accuracy_radius: 0,
106
+ geoname_id: '',
107
+ dma_code: '',
108
+ last_changed: '',
109
+ },
110
+ asn: { asn: 0, name: '', domain: '', type: '', prefix: '', country: '', rpki_status: '' },
111
+ company: { name: '', domain: '', type: '', country: '' },
112
+ hostname: '',
113
+ abuse: {
114
+ email: '',
115
+ name: '',
116
+ phone: '',
117
+ address: '',
118
+ country: '',
119
+ network: '',
120
+ validated: false,
121
+ unvalidated_since: '',
122
+ },
123
+ whois: {
124
+ id: '', name: '', org: '', country: '', status: '', source: '', domain: '', abuse_email: '', asn: 0,
125
+ },
126
+ rwhois: { id: '', name: '', country: '', source: '', domain: '', abuse_email: '' },
127
+ hosted_domains: { total: 0 },
128
+ };
129
+ }
130
+ // Parsed once on first use rather than at import: a consumer that never looks
131
+ // up an address should not pay for the table, and module-scope work is what
132
+ // makes a library expensive to import.
133
+ let v4Cache = null;
134
+ let v6Cache = null;
135
+ function v4() {
136
+ if (!v4Cache) {
137
+ v4Cache = BOGON_V4.map((c) => {
138
+ const [net, bits] = c.split('/');
139
+ const mask = bits === '0' ? 0 : (~0 << (32 - Number(bits))) >>> 0;
140
+ return { net: (v4ToInt(net) & mask) >>> 0, mask: mask };
141
+ });
142
+ }
143
+ return v4Cache;
144
+ }
145
+ function v6() {
146
+ if (!v6Cache) {
147
+ v6Cache = BOGON_V6.map((c) => {
148
+ const [net, bits] = c.split('/');
149
+ const mask = bits === '0' ? 0n : (~0n << BigInt(128 - Number(bits))) & MAX128;
150
+ return { net: v6ToInt(net) & mask, mask: mask };
151
+ });
152
+ }
153
+ return v6Cache;
154
+ }
155
+ const MAX128 = (1n << 128n) - 1n;
156
+ function v4ToInt(ip) {
157
+ const p = ip.split('.');
158
+ if (p.length !== 4) {
159
+ return null;
160
+ }
161
+ let n = 0;
162
+ for (const part of p) {
163
+ const b = Number(part);
164
+ if (!Number.isInteger(b) || b < 0 || b > 255 || part === '') {
165
+ return null;
166
+ }
167
+ n = ((n << 8) | b) >>> 0;
168
+ }
169
+ return n;
170
+ }
171
+ // Handles the `::` run and a trailing IPv4 literal (::ffff:1.2.3.4), which
172
+ // several of the canonical ranges use.
173
+ function v6ToInt(ip) {
174
+ let a = ip;
175
+ const v4Tail = a.match(/(\d+\.\d+\.\d+\.\d+)$/);
176
+ if (v4Tail) {
177
+ const n = v4ToInt(v4Tail[1]);
178
+ if (n === null) {
179
+ return null;
180
+ }
181
+ const hi = (n >>> 16).toString(16).padStart(4, '0');
182
+ const lo = (n & 0xffff).toString(16).padStart(4, '0');
183
+ a = `${a.slice(0, v4Tail.index)}${hi}:${lo}`;
184
+ }
185
+ const dbl = a.indexOf('::');
186
+ let groups;
187
+ if (dbl === -1) {
188
+ groups = a.split(':');
189
+ if (groups.length !== 8) {
190
+ return null;
191
+ }
192
+ }
193
+ else {
194
+ const head = a.slice(0, dbl).split(':').filter((g) => g !== '');
195
+ const tail = a.slice(dbl + 2).split(':').filter((g) => g !== '');
196
+ const fill = 8 - head.length - tail.length;
197
+ if (fill < 0) {
198
+ return null;
199
+ }
200
+ groups = [...head, ...Array(fill).fill('0'), ...tail];
201
+ }
202
+ let n = 0n;
203
+ for (const g of groups) {
204
+ if (!/^[0-9a-fA-F]{1,4}$/.test(g)) {
205
+ return null;
206
+ }
207
+ n = (n << 16n) | BigInt(parseInt(g, 16));
208
+ }
209
+ return n;
210
+ }
211
+ //# sourceMappingURL=bogon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bogon.js","sourceRoot":"","sources":["../src/bogon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;A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AAG,IAAI,CAAC,MAAM,CAAC;QAC3C,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACX,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACrB,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,CAAC,CAAC;AACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const BOGON_V4: readonly string[];
2
+ export declare const BOGON_V6: readonly string[];
@@ -0,0 +1,88 @@
1
+ // Generated. Do not edit: a regeneration overwrites it.
2
+ // The list is checked against both upstream definitions on every
3
+ // regeneration.
4
+ export const BOGON_V4 = [
5
+ '0.0.0.0/8',
6
+ '10.0.0.0/8',
7
+ '100.64.0.0/10',
8
+ '127.0.0.0/8',
9
+ '169.254.0.0/16',
10
+ '172.16.0.0/12',
11
+ '192.0.0.0/24',
12
+ '192.0.2.0/24',
13
+ '192.88.99.2/32',
14
+ '192.168.0.0/16',
15
+ '198.18.0.0/15',
16
+ '198.51.100.0/24',
17
+ '203.0.113.0/24',
18
+ '224.0.0.0/4',
19
+ '255.255.255.255/32',
20
+ '240.0.0.0/4',
21
+ ];
22
+ export const BOGON_V6 = [
23
+ '::/128',
24
+ '::1/128',
25
+ '::ffff:0:0/96',
26
+ '::/96',
27
+ '64:ff9b::/96',
28
+ '64:ff9b:1::/48',
29
+ '100::/64',
30
+ '100:0:0:1::/64',
31
+ '2001:2::/48',
32
+ '2001:10::/28',
33
+ '2001:db8::/32',
34
+ '3fff::/20',
35
+ '5f00::/16',
36
+ 'fc00::/7',
37
+ 'fe80::/10',
38
+ 'fec0::/10',
39
+ 'ff00::/8',
40
+ '2002::/24',
41
+ '2002:a00::/24',
42
+ '2002:6440::/26',
43
+ '2002:7f00::/24',
44
+ '2002:a9fe::/32',
45
+ '2002:ac10::/28',
46
+ '2002:c000::/40',
47
+ '2002:c000:200::/40',
48
+ '2002:c058:6302::/48',
49
+ '2002:c0a8::/32',
50
+ '2002:c612::/31',
51
+ '2002:c633:6400::/40',
52
+ '2002:cb00:7100::/40',
53
+ '2002:e000::/20',
54
+ '2002:ffff:ffff::/48',
55
+ '2002:f000::/20',
56
+ '2001::/40',
57
+ '2001:0:a00::/40',
58
+ '2001:0:6440::/42',
59
+ '2001:0:7f00::/40',
60
+ '2001:0:a9fe::/48',
61
+ '2001:0:ac10::/44',
62
+ '2001:0:c000::/56',
63
+ '2001:0:c000:200::/56',
64
+ '2001:0:c058:6302::/64',
65
+ '2001:0:c0a8::/48',
66
+ '2001:0:c612::/47',
67
+ '2001:0:c633:6400::/56',
68
+ '2001:0:cb00:7100::/56',
69
+ '2001:0:e000::/36',
70
+ '2001:0:ffff:ffff::/64',
71
+ '2001:0:f000::/36',
72
+ '2001:1::/32',
73
+ '2001:2::/31',
74
+ '2001:4::/30',
75
+ '2001:8::/29',
76
+ '2001:20::/27',
77
+ '2001:40::/26',
78
+ '2001:80::/25',
79
+ '2001:100::/24',
80
+ '::/3',
81
+ '4000::/3',
82
+ '6000::/3',
83
+ '8000::/3',
84
+ 'a000::/3',
85
+ 'c000::/3',
86
+ 'e000::/3',
87
+ ];
88
+ //# sourceMappingURL=bogons.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bogons.gen.js","sourceRoot":"","sources":["../src/bogons.gen.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,iEAAiE;AACjE,gBAAgB;AAEhB,MAAM,CAAC,MAAM,QAAQ,GAAsB;IACvC,WAAW;IACX,YAAY;IACZ,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,aAAa;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAsB;IACvC,QAAQ;IACR,SAAS;IACT,eAAe;IACf,OAAO;IACP,cAAc;IACd,gBAAgB;IAChB,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,eAAe;IACf,WAAW;IACX,WAAW;IACX,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,WAAW;IACX,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,qBAAqB;IACrB,gBAAgB;IAChB,gBAAgB;IAChB,qBAAqB;IACrB,qBAAqB;IACrB,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;IAChB,WAAW;IACX,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,sBAAsB;IACtB,uBAAuB;IACvB,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,uBAAuB;IACvB,kBAAkB;IAClB,uBAAuB;IACvB,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,eAAe;IACf,MAAM;IACN,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;CACb,CAAC"}