asn-blocklist 1.20260703.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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +302 -0
  3. package/dist/consumer.ef.b64 +1 -0
  4. package/dist/consumer.gr.b64 +1 -0
  5. package/dist/consumer.txt +16379 -0
  6. package/dist/hosting.ef.b64 +1 -0
  7. package/dist/hosting.gr.b64 +1 -0
  8. package/dist/hosting.txt +7648 -0
  9. package/lib/access/ef.cjs +181 -0
  10. package/lib/access/ef.d.cts +8 -0
  11. package/lib/access/ef.d.ts +8 -0
  12. package/lib/access/ef.js +151 -0
  13. package/lib/access/gr.cjs +149 -0
  14. package/lib/access/gr.d.cts +8 -0
  15. package/lib/access/gr.d.ts +8 -0
  16. package/lib/access/gr.js +119 -0
  17. package/lib/access-ef-Cyg9fXiX.d.cts +3 -0
  18. package/lib/access-ef-Cyg9fXiX.d.ts +3 -0
  19. package/lib/access-gr-K1sbUYPZ.d.cts +3 -0
  20. package/lib/access-gr-K1sbUYPZ.d.ts +3 -0
  21. package/lib/data/access-ef.cjs +99 -0
  22. package/lib/data/access-ef.d.cts +2 -0
  23. package/lib/data/access-ef.d.ts +2 -0
  24. package/lib/data/access-ef.js +68 -0
  25. package/lib/data/access-gr.cjs +99 -0
  26. package/lib/data/access-gr.d.cts +2 -0
  27. package/lib/data/access-gr.d.ts +2 -0
  28. package/lib/data/access-gr.js +68 -0
  29. package/lib/data/hosting-ef.cjs +99 -0
  30. package/lib/data/hosting-ef.d.cts +2 -0
  31. package/lib/data/hosting-ef.d.ts +2 -0
  32. package/lib/data/hosting-ef.js +68 -0
  33. package/lib/data/hosting-gr.cjs +99 -0
  34. package/lib/data/hosting-gr.d.cts +2 -0
  35. package/lib/data/hosting-gr.d.ts +2 -0
  36. package/lib/data/hosting-gr.js +68 -0
  37. package/lib/hosting/ef.cjs +181 -0
  38. package/lib/hosting/ef.d.cts +8 -0
  39. package/lib/hosting/ef.d.ts +8 -0
  40. package/lib/hosting/ef.js +151 -0
  41. package/lib/hosting/gr.cjs +149 -0
  42. package/lib/hosting/gr.d.cts +8 -0
  43. package/lib/hosting/gr.d.ts +8 -0
  44. package/lib/hosting/gr.js +119 -0
  45. package/lib/hosting-ef-BYHAv_eT.d.cts +3 -0
  46. package/lib/hosting-ef-BYHAv_eT.d.ts +3 -0
  47. package/lib/hosting-gr-ISZyiWi7.d.cts +3 -0
  48. package/lib/hosting-gr-ISZyiWi7.d.ts +3 -0
  49. package/lib/index.cjs +335 -0
  50. package/lib/index.d.cts +12 -0
  51. package/lib/index.d.ts +12 -0
  52. package/lib/index.js +295 -0
  53. package/lib/metadata-CbVhAyw9.d.cts +59 -0
  54. package/lib/metadata-CbVhAyw9.d.ts +59 -0
  55. package/lib/runtime.cjs +239 -0
  56. package/lib/runtime.d.cts +17 -0
  57. package/lib/runtime.d.ts +17 -0
  58. package/lib/runtime.js +208 -0
  59. package/lib/types-BeWCbJlo.d.cts +27 -0
  60. package/lib/types-BeWCbJlo.d.ts +27 -0
  61. package/package.json +109 -0
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/entries/runtime.ts
21
+ var runtime_exports = {};
22
+ __export(runtime_exports, {
23
+ classifyWithSets: () => classifyWithSets,
24
+ createASNSet: () => createASNSet,
25
+ createEFSet: () => createEFSet,
26
+ createGRSet: () => createGRSet,
27
+ normalizeASN: () => normalizeASN
28
+ });
29
+ module.exports = __toCommonJS(runtime_exports);
30
+
31
+ // src/runtime/base64.ts
32
+ function toUint8Array(data) {
33
+ if (data instanceof Uint8Array) {
34
+ return data;
35
+ }
36
+ if (typeof Buffer !== "undefined") {
37
+ return new Uint8Array(Buffer.from(data, "base64"));
38
+ }
39
+ const decoded = atob(data);
40
+ const bytes = new Uint8Array(decoded.length);
41
+ for (let i = 0; i < decoded.length; i++) {
42
+ bytes[i] = decoded.charCodeAt(i);
43
+ }
44
+ return bytes;
45
+ }
46
+ function bitAt(bytes, bitPosition) {
47
+ return bytes[bitPosition >> 3] >> 7 - (bitPosition & 7) & 1;
48
+ }
49
+
50
+ // src/runtime/header.ts
51
+ function dataView(bytes) {
52
+ return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
53
+ }
54
+ function readCommonHeader(bytes) {
55
+ if (bytes.byteLength < 14) {
56
+ throw new Error("ASN dataset is too short to contain a valid header");
57
+ }
58
+ const view = dataView(bytes);
59
+ return {
60
+ offset: view.getUint32(0, true),
61
+ count: view.getUint32(4, true),
62
+ range: view.getUint32(8, true),
63
+ k: view.getUint8(12),
64
+ l: view.getUint8(13)
65
+ };
66
+ }
67
+ function metadataFromHeader(header, kind, encoding) {
68
+ return {
69
+ kind,
70
+ encoding,
71
+ offset: header.offset,
72
+ count: header.count,
73
+ range: header.range,
74
+ minASN: header.offset,
75
+ maxASN: header.offset + header.range - 1
76
+ };
77
+ }
78
+ function detectEncoding(header) {
79
+ if (header.k > 0 && header.l === 0) return "gr";
80
+ if (header.k === 0 && header.l > 0) return "ef";
81
+ throw new Error("Unable to detect ASN dataset encoding");
82
+ }
83
+
84
+ // src/runtime/normalize.ts
85
+ function normalizeASN(input) {
86
+ if (typeof input === "number") {
87
+ return Number.isSafeInteger(input) && input > 0 ? input : null;
88
+ }
89
+ const value = String(input).trim();
90
+ const match = /^(?:AS)?(\d+)$/i.exec(value);
91
+ if (!match) return null;
92
+ const asn = Number(match[1]);
93
+ return Number.isSafeInteger(asn) && asn > 0 ? asn : null;
94
+ }
95
+
96
+ // src/runtime/ef.ts
97
+ function readEFSubHeader(bytes) {
98
+ if (bytes.byteLength < 28) {
99
+ throw new Error("ASN EF dataset is too short to contain a valid sub-header");
100
+ }
101
+ const view = dataView(bytes);
102
+ return {
103
+ lowOffset: view.getUint32(14, true),
104
+ highOffset: view.getUint32(18, true),
105
+ selectOffset: view.getUint32(22, true),
106
+ selectStep: view.getUint16(26, true)
107
+ };
108
+ }
109
+ function createEFSet(data, options = {}) {
110
+ const bytes = toUint8Array(data);
111
+ const header = readCommonHeader(bytes);
112
+ if (header.l === 0) {
113
+ throw new Error("ASN dataset is not Elias-Fano encoded");
114
+ }
115
+ const view = dataView(bytes);
116
+ const sub = readEFSubHeader(bytes);
117
+ const lowMask = (1 << header.l) - 1;
118
+ const kind = options.kind ?? "hosting";
119
+ const metadata = metadataFromHeader(header, kind, "ef");
120
+ function selectZero(n) {
121
+ if (n === 0) return 0;
122
+ const sampleIndex = Math.floor((n - 1) / sub.selectStep);
123
+ let position = view.getUint32(sub.selectOffset + sampleIndex * 4, true);
124
+ const target = n - sampleIndex * sub.selectStep;
125
+ let count = 0;
126
+ while (count < target) {
127
+ if (bitAt(bytes, sub.highOffset * 8 + position) === 0) {
128
+ count++;
129
+ }
130
+ position++;
131
+ }
132
+ return position;
133
+ }
134
+ function readLow(index) {
135
+ let value = 0;
136
+ const bitPosition = sub.lowOffset * 8 + index * header.l;
137
+ for (let i = 0; i < header.l; i++) {
138
+ value = value << 1 | bitAt(bytes, bitPosition + i);
139
+ }
140
+ return value;
141
+ }
142
+ return {
143
+ kind,
144
+ encoding: "ef",
145
+ metadata,
146
+ has(input) {
147
+ const asn = normalizeASN(input);
148
+ if (asn === null) return false;
149
+ if (asn < header.offset || asn > header.offset + header.range - 1) return false;
150
+ const relative = asn - header.offset;
151
+ const high = relative >> header.l;
152
+ const low = relative & lowMask;
153
+ let start;
154
+ let end;
155
+ if (high === 0) {
156
+ start = 0;
157
+ end = selectZero(1) - 1;
158
+ } else {
159
+ const previousZero = selectZero(high);
160
+ const nextZero = selectZero(high + 1);
161
+ start = previousZero - high;
162
+ end = nextZero - (high + 1);
163
+ }
164
+ for (let i = start; i < end; i++) {
165
+ if (readLow(i) === low) return true;
166
+ }
167
+ return false;
168
+ }
169
+ };
170
+ }
171
+
172
+ // src/runtime/gr.ts
173
+ function createGRSet(data, options = {}) {
174
+ const bytes = toUint8Array(data);
175
+ const header = readCommonHeader(bytes);
176
+ if (header.k === 0) {
177
+ throw new Error("ASN dataset is not Golomb-Rice encoded");
178
+ }
179
+ const bucket = new Uint16Array(Math.ceil(header.range / 16));
180
+ if (header.count > 0) {
181
+ bucket[0] |= 1;
182
+ }
183
+ let bitPosition = 14 * 8;
184
+ let relative = 0;
185
+ for (let i = 1; i < header.count; i++) {
186
+ let q = 0;
187
+ while (bitAt(bytes, bitPosition) === 1) {
188
+ q++;
189
+ bitPosition++;
190
+ }
191
+ bitPosition++;
192
+ let r = 0;
193
+ for (let j = 0; j < header.k; j++) {
194
+ r = r << 1 | bitAt(bytes, bitPosition);
195
+ bitPosition++;
196
+ }
197
+ relative += q << header.k | r;
198
+ bucket[relative >> 4] |= 1 << (relative & 15);
199
+ }
200
+ const kind = options.kind ?? "hosting";
201
+ const metadata = metadataFromHeader(header, kind, "gr");
202
+ return {
203
+ kind,
204
+ encoding: "gr",
205
+ metadata,
206
+ has(input) {
207
+ const asn = normalizeASN(input);
208
+ if (asn === null) return false;
209
+ const position = asn - header.offset;
210
+ if (position < 0 || position >= header.range) return false;
211
+ return (bucket[position >> 4] >> (position & 15) & 1) === 1;
212
+ }
213
+ };
214
+ }
215
+
216
+ // src/runtime/set.ts
217
+ function createASNSet(data, options = {}) {
218
+ const bytes = toUint8Array(data);
219
+ const encoding = options.encoding === "auto" || options.encoding === void 0 ? detectEncoding(readCommonHeader(bytes)) : options.encoding;
220
+ if (encoding === "gr") {
221
+ return createGRSet(bytes, { kind: options.kind });
222
+ }
223
+ return createEFSet(bytes, { kind: options.kind });
224
+ }
225
+
226
+ // src/runtime/classify.ts
227
+ function classifyWithSets(asn, sets) {
228
+ if (sets.hosting?.has(asn)) return "hosting";
229
+ if (sets.access?.has(asn)) return "access";
230
+ return "unknown";
231
+ }
232
+ // Annotate the CommonJS export names for ESM import in node:
233
+ 0 && (module.exports = {
234
+ classifyWithSets,
235
+ createASNSet,
236
+ createEFSet,
237
+ createGRSet,
238
+ normalizeASN
239
+ });
@@ -0,0 +1,17 @@
1
+ import { f as ASNSetOptions, A as ASNSet, C as CreateASNSetOptions, a as ASNInput, b as ASNClass } from './types-BeWCbJlo.cjs';
2
+ export { c as ASNEncoding, d as ASNListKind, e as ASNSetMetadata } from './types-BeWCbJlo.cjs';
3
+
4
+ declare function createEFSet(data: string | Uint8Array, options?: ASNSetOptions): ASNSet;
5
+
6
+ declare function createGRSet(data: string | Uint8Array, options?: ASNSetOptions): ASNSet;
7
+
8
+ declare function createASNSet(data: string | Uint8Array, options?: CreateASNSetOptions): ASNSet;
9
+
10
+ declare function classifyWithSets(asn: ASNInput, sets: {
11
+ hosting?: ASNSet;
12
+ access?: ASNSet;
13
+ }): ASNClass;
14
+
15
+ declare function normalizeASN(input: ASNInput): number | null;
16
+
17
+ export { ASNClass, ASNInput, ASNSet, classifyWithSets, createASNSet, createEFSet, createGRSet, normalizeASN };
@@ -0,0 +1,17 @@
1
+ import { f as ASNSetOptions, A as ASNSet, C as CreateASNSetOptions, a as ASNInput, b as ASNClass } from './types-BeWCbJlo.js';
2
+ export { c as ASNEncoding, d as ASNListKind, e as ASNSetMetadata } from './types-BeWCbJlo.js';
3
+
4
+ declare function createEFSet(data: string | Uint8Array, options?: ASNSetOptions): ASNSet;
5
+
6
+ declare function createGRSet(data: string | Uint8Array, options?: ASNSetOptions): ASNSet;
7
+
8
+ declare function createASNSet(data: string | Uint8Array, options?: CreateASNSetOptions): ASNSet;
9
+
10
+ declare function classifyWithSets(asn: ASNInput, sets: {
11
+ hosting?: ASNSet;
12
+ access?: ASNSet;
13
+ }): ASNClass;
14
+
15
+ declare function normalizeASN(input: ASNInput): number | null;
16
+
17
+ export { ASNClass, ASNInput, ASNSet, classifyWithSets, createASNSet, createEFSet, createGRSet, normalizeASN };
package/lib/runtime.js ADDED
@@ -0,0 +1,208 @@
1
+ // src/runtime/base64.ts
2
+ function toUint8Array(data) {
3
+ if (data instanceof Uint8Array) {
4
+ return data;
5
+ }
6
+ if (typeof Buffer !== "undefined") {
7
+ return new Uint8Array(Buffer.from(data, "base64"));
8
+ }
9
+ const decoded = atob(data);
10
+ const bytes = new Uint8Array(decoded.length);
11
+ for (let i = 0; i < decoded.length; i++) {
12
+ bytes[i] = decoded.charCodeAt(i);
13
+ }
14
+ return bytes;
15
+ }
16
+ function bitAt(bytes, bitPosition) {
17
+ return bytes[bitPosition >> 3] >> 7 - (bitPosition & 7) & 1;
18
+ }
19
+
20
+ // src/runtime/header.ts
21
+ function dataView(bytes) {
22
+ return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
23
+ }
24
+ function readCommonHeader(bytes) {
25
+ if (bytes.byteLength < 14) {
26
+ throw new Error("ASN dataset is too short to contain a valid header");
27
+ }
28
+ const view = dataView(bytes);
29
+ return {
30
+ offset: view.getUint32(0, true),
31
+ count: view.getUint32(4, true),
32
+ range: view.getUint32(8, true),
33
+ k: view.getUint8(12),
34
+ l: view.getUint8(13)
35
+ };
36
+ }
37
+ function metadataFromHeader(header, kind, encoding) {
38
+ return {
39
+ kind,
40
+ encoding,
41
+ offset: header.offset,
42
+ count: header.count,
43
+ range: header.range,
44
+ minASN: header.offset,
45
+ maxASN: header.offset + header.range - 1
46
+ };
47
+ }
48
+ function detectEncoding(header) {
49
+ if (header.k > 0 && header.l === 0) return "gr";
50
+ if (header.k === 0 && header.l > 0) return "ef";
51
+ throw new Error("Unable to detect ASN dataset encoding");
52
+ }
53
+
54
+ // src/runtime/normalize.ts
55
+ function normalizeASN(input) {
56
+ if (typeof input === "number") {
57
+ return Number.isSafeInteger(input) && input > 0 ? input : null;
58
+ }
59
+ const value = String(input).trim();
60
+ const match = /^(?:AS)?(\d+)$/i.exec(value);
61
+ if (!match) return null;
62
+ const asn = Number(match[1]);
63
+ return Number.isSafeInteger(asn) && asn > 0 ? asn : null;
64
+ }
65
+
66
+ // src/runtime/ef.ts
67
+ function readEFSubHeader(bytes) {
68
+ if (bytes.byteLength < 28) {
69
+ throw new Error("ASN EF dataset is too short to contain a valid sub-header");
70
+ }
71
+ const view = dataView(bytes);
72
+ return {
73
+ lowOffset: view.getUint32(14, true),
74
+ highOffset: view.getUint32(18, true),
75
+ selectOffset: view.getUint32(22, true),
76
+ selectStep: view.getUint16(26, true)
77
+ };
78
+ }
79
+ function createEFSet(data, options = {}) {
80
+ const bytes = toUint8Array(data);
81
+ const header = readCommonHeader(bytes);
82
+ if (header.l === 0) {
83
+ throw new Error("ASN dataset is not Elias-Fano encoded");
84
+ }
85
+ const view = dataView(bytes);
86
+ const sub = readEFSubHeader(bytes);
87
+ const lowMask = (1 << header.l) - 1;
88
+ const kind = options.kind ?? "hosting";
89
+ const metadata = metadataFromHeader(header, kind, "ef");
90
+ function selectZero(n) {
91
+ if (n === 0) return 0;
92
+ const sampleIndex = Math.floor((n - 1) / sub.selectStep);
93
+ let position = view.getUint32(sub.selectOffset + sampleIndex * 4, true);
94
+ const target = n - sampleIndex * sub.selectStep;
95
+ let count = 0;
96
+ while (count < target) {
97
+ if (bitAt(bytes, sub.highOffset * 8 + position) === 0) {
98
+ count++;
99
+ }
100
+ position++;
101
+ }
102
+ return position;
103
+ }
104
+ function readLow(index) {
105
+ let value = 0;
106
+ const bitPosition = sub.lowOffset * 8 + index * header.l;
107
+ for (let i = 0; i < header.l; i++) {
108
+ value = value << 1 | bitAt(bytes, bitPosition + i);
109
+ }
110
+ return value;
111
+ }
112
+ return {
113
+ kind,
114
+ encoding: "ef",
115
+ metadata,
116
+ has(input) {
117
+ const asn = normalizeASN(input);
118
+ if (asn === null) return false;
119
+ if (asn < header.offset || asn > header.offset + header.range - 1) return false;
120
+ const relative = asn - header.offset;
121
+ const high = relative >> header.l;
122
+ const low = relative & lowMask;
123
+ let start;
124
+ let end;
125
+ if (high === 0) {
126
+ start = 0;
127
+ end = selectZero(1) - 1;
128
+ } else {
129
+ const previousZero = selectZero(high);
130
+ const nextZero = selectZero(high + 1);
131
+ start = previousZero - high;
132
+ end = nextZero - (high + 1);
133
+ }
134
+ for (let i = start; i < end; i++) {
135
+ if (readLow(i) === low) return true;
136
+ }
137
+ return false;
138
+ }
139
+ };
140
+ }
141
+
142
+ // src/runtime/gr.ts
143
+ function createGRSet(data, options = {}) {
144
+ const bytes = toUint8Array(data);
145
+ const header = readCommonHeader(bytes);
146
+ if (header.k === 0) {
147
+ throw new Error("ASN dataset is not Golomb-Rice encoded");
148
+ }
149
+ const bucket = new Uint16Array(Math.ceil(header.range / 16));
150
+ if (header.count > 0) {
151
+ bucket[0] |= 1;
152
+ }
153
+ let bitPosition = 14 * 8;
154
+ let relative = 0;
155
+ for (let i = 1; i < header.count; i++) {
156
+ let q = 0;
157
+ while (bitAt(bytes, bitPosition) === 1) {
158
+ q++;
159
+ bitPosition++;
160
+ }
161
+ bitPosition++;
162
+ let r = 0;
163
+ for (let j = 0; j < header.k; j++) {
164
+ r = r << 1 | bitAt(bytes, bitPosition);
165
+ bitPosition++;
166
+ }
167
+ relative += q << header.k | r;
168
+ bucket[relative >> 4] |= 1 << (relative & 15);
169
+ }
170
+ const kind = options.kind ?? "hosting";
171
+ const metadata = metadataFromHeader(header, kind, "gr");
172
+ return {
173
+ kind,
174
+ encoding: "gr",
175
+ metadata,
176
+ has(input) {
177
+ const asn = normalizeASN(input);
178
+ if (asn === null) return false;
179
+ const position = asn - header.offset;
180
+ if (position < 0 || position >= header.range) return false;
181
+ return (bucket[position >> 4] >> (position & 15) & 1) === 1;
182
+ }
183
+ };
184
+ }
185
+
186
+ // src/runtime/set.ts
187
+ function createASNSet(data, options = {}) {
188
+ const bytes = toUint8Array(data);
189
+ const encoding = options.encoding === "auto" || options.encoding === void 0 ? detectEncoding(readCommonHeader(bytes)) : options.encoding;
190
+ if (encoding === "gr") {
191
+ return createGRSet(bytes, { kind: options.kind });
192
+ }
193
+ return createEFSet(bytes, { kind: options.kind });
194
+ }
195
+
196
+ // src/runtime/classify.ts
197
+ function classifyWithSets(asn, sets) {
198
+ if (sets.hosting?.has(asn)) return "hosting";
199
+ if (sets.access?.has(asn)) return "access";
200
+ return "unknown";
201
+ }
202
+ export {
203
+ classifyWithSets,
204
+ createASNSet,
205
+ createEFSet,
206
+ createGRSet,
207
+ normalizeASN
208
+ };
@@ -0,0 +1,27 @@
1
+ type ASNInput = number | `AS${number}` | string;
2
+ type ASNClass = "hosting" | "access" | "unknown";
3
+ type ASNListKind = "hosting" | "access";
4
+ type ASNEncoding = "gr" | "ef";
5
+ interface ASNSetMetadata {
6
+ kind: ASNListKind;
7
+ encoding: ASNEncoding;
8
+ offset: number;
9
+ count: number;
10
+ range: number;
11
+ minASN: number;
12
+ maxASN: number;
13
+ }
14
+ interface ASNSet {
15
+ readonly kind: ASNListKind;
16
+ readonly encoding: ASNEncoding;
17
+ readonly metadata: ASNSetMetadata;
18
+ has(asn: ASNInput): boolean;
19
+ }
20
+ interface ASNSetOptions {
21
+ kind?: ASNListKind;
22
+ }
23
+ interface CreateASNSetOptions extends ASNSetOptions {
24
+ encoding?: ASNEncoding | "auto";
25
+ }
26
+
27
+ export type { ASNSet as A, CreateASNSetOptions as C, ASNInput as a, ASNClass as b, ASNEncoding as c, ASNListKind as d, ASNSetMetadata as e, ASNSetOptions as f };
@@ -0,0 +1,27 @@
1
+ type ASNInput = number | `AS${number}` | string;
2
+ type ASNClass = "hosting" | "access" | "unknown";
3
+ type ASNListKind = "hosting" | "access";
4
+ type ASNEncoding = "gr" | "ef";
5
+ interface ASNSetMetadata {
6
+ kind: ASNListKind;
7
+ encoding: ASNEncoding;
8
+ offset: number;
9
+ count: number;
10
+ range: number;
11
+ minASN: number;
12
+ maxASN: number;
13
+ }
14
+ interface ASNSet {
15
+ readonly kind: ASNListKind;
16
+ readonly encoding: ASNEncoding;
17
+ readonly metadata: ASNSetMetadata;
18
+ has(asn: ASNInput): boolean;
19
+ }
20
+ interface ASNSetOptions {
21
+ kind?: ASNListKind;
22
+ }
23
+ interface CreateASNSetOptions extends ASNSetOptions {
24
+ encoding?: ASNEncoding | "auto";
25
+ }
26
+
27
+ export type { ASNSet as A, CreateASNSetOptions as C, ASNInput as a, ASNClass as b, ASNEncoding as c, ASNListKind as d, ASNSetMetadata as e, ASNSetOptions as f };
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "asn-blocklist",
3
+ "version": "1.20260703.0",
4
+ "description": "Auto-updated ASN blocklist and access-network list from PeeringDB",
5
+ "type": "module",
6
+ "main": "./lib/index.cjs",
7
+ "module": "./lib/index.js",
8
+ "types": "./lib/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/index.d.ts",
12
+ "import": "./lib/index.js",
13
+ "require": "./lib/index.cjs"
14
+ },
15
+ "./runtime": {
16
+ "types": "./lib/runtime.d.ts",
17
+ "import": "./lib/runtime.js",
18
+ "require": "./lib/runtime.cjs"
19
+ },
20
+ "./hosting/ef": {
21
+ "types": "./lib/hosting/ef.d.ts",
22
+ "import": "./lib/hosting/ef.js",
23
+ "require": "./lib/hosting/ef.cjs"
24
+ },
25
+ "./hosting/gr": {
26
+ "types": "./lib/hosting/gr.d.ts",
27
+ "import": "./lib/hosting/gr.js",
28
+ "require": "./lib/hosting/gr.cjs"
29
+ },
30
+ "./access/ef": {
31
+ "types": "./lib/access/ef.d.ts",
32
+ "import": "./lib/access/ef.js",
33
+ "require": "./lib/access/ef.cjs"
34
+ },
35
+ "./access/gr": {
36
+ "types": "./lib/access/gr.d.ts",
37
+ "import": "./lib/access/gr.js",
38
+ "require": "./lib/access/gr.cjs"
39
+ },
40
+ "./data/hosting-ef": {
41
+ "types": "./lib/data/hosting-ef.d.ts",
42
+ "import": "./lib/data/hosting-ef.js",
43
+ "require": "./lib/data/hosting-ef.cjs"
44
+ },
45
+ "./data/hosting-gr": {
46
+ "types": "./lib/data/hosting-gr.d.ts",
47
+ "import": "./lib/data/hosting-gr.js",
48
+ "require": "./lib/data/hosting-gr.cjs"
49
+ },
50
+ "./data/access-ef": {
51
+ "types": "./lib/data/access-ef.d.ts",
52
+ "import": "./lib/data/access-ef.js",
53
+ "require": "./lib/data/access-ef.cjs"
54
+ },
55
+ "./data/access-gr": {
56
+ "types": "./lib/data/access-gr.d.ts",
57
+ "import": "./lib/data/access-gr.js",
58
+ "require": "./lib/data/access-gr.cjs"
59
+ },
60
+ "./package.json": "./package.json"
61
+ },
62
+ "files": [
63
+ "lib",
64
+ "dist",
65
+ "README.md",
66
+ "LICENSE"
67
+ ],
68
+ "scripts": {
69
+ "generate": "node src/generate/index.cjs",
70
+ "generate:modules": "node scripts/generate-modules.cjs",
71
+ "build": "npm run generate:modules && tsup",
72
+ "test": "npm run build && node --test test/*.test.mjs",
73
+ "prepack": "npm run build",
74
+ "update:sizes": "node scripts/update-sizes.cjs",
75
+ "set-version": "node scripts/set-version.cjs",
76
+ "check:data": "node scripts/check-data.cjs"
77
+ },
78
+ "publishConfig": {
79
+ "access": "public",
80
+ "registry": "https://registry.npmjs.org/"
81
+ },
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "git+https://github.com/InsightFlare/asn-blocklist.git"
85
+ },
86
+ "bugs": {
87
+ "url": "https://github.com/InsightFlare/asn-blocklist/issues"
88
+ },
89
+ "homepage": "https://github.com/InsightFlare/asn-blocklist#readme",
90
+ "keywords": [
91
+ "asn",
92
+ "autonomous-system",
93
+ "blocklist",
94
+ "datacenter",
95
+ "hosting",
96
+ "peeringdb",
97
+ "bot-detection",
98
+ "analytics"
99
+ ],
100
+ "license": "MIT",
101
+ "devDependencies": {
102
+ "@types/node": "^24.0.10",
103
+ "tsup": "^8.5.0",
104
+ "typescript": "^5.8.3"
105
+ },
106
+ "overrides": {
107
+ "esbuild": "^0.28.1"
108
+ }
109
+ }