xasdd6 1.0.6 → 1.0.8
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/package.json +1 -1
- package/xasdd6.js +2 -2
- package/xasdd6.mjs +348 -204
package/xasdd6.mjs
CHANGED
|
@@ -187,9 +187,30 @@ function p(e) {
|
|
|
187
187
|
}
|
|
188
188
|
return "RCODE_" + e;
|
|
189
189
|
}
|
|
190
|
+
function ee(e) {
|
|
191
|
+
switch (e.toUpperCase()) {
|
|
192
|
+
case "NOERROR": return 0;
|
|
193
|
+
case "FORMERR": return 1;
|
|
194
|
+
case "SERVFAIL": return 2;
|
|
195
|
+
case "NXDOMAIN": return 3;
|
|
196
|
+
case "NOTIMP": return 4;
|
|
197
|
+
case "REFUSED": return 5;
|
|
198
|
+
case "YXDOMAIN": return 6;
|
|
199
|
+
case "YXRRSET": return 7;
|
|
200
|
+
case "NXRRSET": return 8;
|
|
201
|
+
case "NOTAUTH": return 9;
|
|
202
|
+
case "NOTZONE": return 10;
|
|
203
|
+
case "RCODE_11": return 11;
|
|
204
|
+
case "RCODE_12": return 12;
|
|
205
|
+
case "RCODE_13": return 13;
|
|
206
|
+
case "RCODE_14": return 14;
|
|
207
|
+
case "RCODE_15": return 15;
|
|
208
|
+
}
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
190
211
|
//#endregion
|
|
191
212
|
//#region node_modules/@leichtgewicht/dns-packet/opcodes.mjs
|
|
192
|
-
function
|
|
213
|
+
function te(e) {
|
|
193
214
|
switch (e) {
|
|
194
215
|
case 0: return "QUERY";
|
|
195
216
|
case 1: return "IQUERY";
|
|
@@ -212,7 +233,7 @@ function ee(e) {
|
|
|
212
233
|
}
|
|
213
234
|
//#endregion
|
|
214
235
|
//#region node_modules/@leichtgewicht/dns-packet/classes.mjs
|
|
215
|
-
function
|
|
236
|
+
function ne(e) {
|
|
216
237
|
switch (e) {
|
|
217
238
|
case 1: return "IN";
|
|
218
239
|
case 2: return "CS";
|
|
@@ -222,7 +243,7 @@ function te(e) {
|
|
|
222
243
|
}
|
|
223
244
|
return "UNKNOWN_" + e;
|
|
224
245
|
}
|
|
225
|
-
function
|
|
246
|
+
function re(e) {
|
|
226
247
|
switch (e.toUpperCase()) {
|
|
227
248
|
case "IN": return 1;
|
|
228
249
|
case "CS": return 2;
|
|
@@ -234,7 +255,7 @@ function ne(e) {
|
|
|
234
255
|
}
|
|
235
256
|
//#endregion
|
|
236
257
|
//#region node_modules/@leichtgewicht/dns-packet/optioncodes.mjs
|
|
237
|
-
function
|
|
258
|
+
function ie(e) {
|
|
238
259
|
switch (e) {
|
|
239
260
|
case 1: return "LLQ";
|
|
240
261
|
case 2: return "UL";
|
|
@@ -253,7 +274,7 @@ function re(e) {
|
|
|
253
274
|
}
|
|
254
275
|
return e < 0 ? null : `OPTION_${e}`;
|
|
255
276
|
}
|
|
256
|
-
function
|
|
277
|
+
function ae(e) {
|
|
257
278
|
if (typeof e == "number") return e;
|
|
258
279
|
if (!e) return -1;
|
|
259
280
|
switch (e.toUpperCase()) {
|
|
@@ -280,14 +301,14 @@ function ie(e) {
|
|
|
280
301
|
}
|
|
281
302
|
//#endregion
|
|
282
303
|
//#region node_modules/utf8-codec/index.mjs
|
|
283
|
-
var
|
|
284
|
-
function
|
|
304
|
+
var oe = 55296, m = 56320;
|
|
305
|
+
function se(e) {
|
|
285
306
|
let t = 0, n = e.length;
|
|
286
307
|
for (let r = 0; r < n; r += 1) {
|
|
287
308
|
let i = e.charCodeAt(r);
|
|
288
309
|
if (i <= 127) t += 1;
|
|
289
310
|
else if (i <= 2047) t += 2;
|
|
290
|
-
else if ((i & 63488) !==
|
|
311
|
+
else if ((i & 63488) !== oe) t += 3;
|
|
291
312
|
else {
|
|
292
313
|
let a = r + 1;
|
|
293
314
|
a === n || i >= m ? t += 3 : (e.charCodeAt(a) & 64512) === m ? (r = a, t += 4) : t += 3;
|
|
@@ -297,13 +318,13 @@ function oe(e) {
|
|
|
297
318
|
}
|
|
298
319
|
function h(e, t, n) {
|
|
299
320
|
let r = e.length;
|
|
300
|
-
n ??= 0, t === void 0 && (t = new Uint8Array(
|
|
321
|
+
n ??= 0, t === void 0 && (t = new Uint8Array(se(e) + n));
|
|
301
322
|
let i = n;
|
|
302
323
|
for (let n = 0; n < r; n += 1) {
|
|
303
324
|
let a = e.charCodeAt(n);
|
|
304
325
|
if (a <= 127) t[i++] = a;
|
|
305
326
|
else if (a <= 2047) t[i++] = 192 | (a & 1984) >> 6, t[i++] = 128 | a & 63;
|
|
306
|
-
else if ((a & 63488) !==
|
|
327
|
+
else if ((a & 63488) !== oe) t[i++] = 224 | (a & 61440) >> 12, t[i++] = 128 | (a & 4032) >> 6, t[i++] = 128 | a & 63;
|
|
307
328
|
else {
|
|
308
329
|
let o = n + 1;
|
|
309
330
|
if (o === r || a >= m) t[i++] = 239, t[i++] = 191, t[i++] = 189;
|
|
@@ -325,7 +346,7 @@ function g(e, t, n) {
|
|
|
325
346
|
else if (t > 191 && t < 224) n = (t & 31) << 6 | e[i++] & 63;
|
|
326
347
|
else if (t > 239 && t < 365) {
|
|
327
348
|
n = ((t & 7) << 18 | (e[i++] & 63) << 12 | (e[i++] & 63) << 6 | e[i++] & 63) - 65536;
|
|
328
|
-
let a =
|
|
349
|
+
let a = oe | n >> 10 & 1023;
|
|
329
350
|
r += String.fromCharCode(a), n = m | n & 1023;
|
|
330
351
|
} else n = (t & 15) << 12 | (e[i++] & 63) << 6 | e[i++] & 63;
|
|
331
352
|
r += String.fromCharCode(n);
|
|
@@ -337,27 +358,27 @@ g.bytes = 0;
|
|
|
337
358
|
//#region node_modules/@leichtgewicht/dns-packet/buffer_utils.mjs
|
|
338
359
|
var _ = (e) => e instanceof Uint8Array;
|
|
339
360
|
function v(e) {
|
|
340
|
-
return typeof e == "string" ?
|
|
361
|
+
return typeof e == "string" ? se(e) : e.byteLength;
|
|
341
362
|
}
|
|
342
|
-
function
|
|
363
|
+
function ce(e) {
|
|
343
364
|
return e instanceof Uint8Array ? e : Array.isArray(e) ? new Uint8Array(e) : h(e);
|
|
344
365
|
}
|
|
345
|
-
function
|
|
366
|
+
function le(e, t, n) {
|
|
346
367
|
if (typeof t != "string") throw Error("unknown input type");
|
|
347
368
|
return h(t, e, n), h.bytes;
|
|
348
369
|
}
|
|
349
|
-
var
|
|
370
|
+
var ue = 2 ** 24, de = 2 ** 16, fe = 256, y = (e, t) => e[t] * ue + e[t + 1] * de + e[t + 2] * fe + e[t + 3], b = (e, t) => e[t] << 8 | e[t + 1], x = (e, t, n) => (t = +t, e[n + 3] = t, t >>>= 8, e[n + 2] = t, t >>>= 8, e[n + 1] = t, t >>>= 8, e[n] = t, n + 4), S = (e, t, n) => (e[n] = t >> 8, e[n + 1] = t & 255, n + 2);
|
|
350
371
|
function C(e, t, n, r, i) {
|
|
351
|
-
return n < 0 && (r -= n, n = 0), r < 0 && (r = 0), i < 0 ? /* @__PURE__ */ new Uint8Array() : n >= t.length || r >= i ? 0 :
|
|
372
|
+
return n < 0 && (r -= n, n = 0), r < 0 && (r = 0), i < 0 ? /* @__PURE__ */ new Uint8Array() : n >= t.length || r >= i ? 0 : pe(e, t, n, r, i);
|
|
352
373
|
}
|
|
353
|
-
function
|
|
374
|
+
function pe(e, t, n, r, i) {
|
|
354
375
|
i - r > t.length - n && (i = r + t.length - n);
|
|
355
376
|
let a = i - r, o = e.length - r;
|
|
356
377
|
return a > o && (a = o), (r !== 0 || i < e.length) && (e = new Uint8Array(e.buffer, e.byteOffset + r, a)), t.set(e, n), a;
|
|
357
378
|
}
|
|
358
379
|
//#endregion
|
|
359
380
|
//#region node_modules/@leichtgewicht/dns-packet/index.mjs
|
|
360
|
-
var
|
|
381
|
+
var me = 0, he = 32768, ge = 32768, _e = -32769, ve = 32768, ye = -32769;
|
|
361
382
|
function w({ bytes: e = 0, encode: t, decode: n, encodingLength: r }) {
|
|
362
383
|
return t.bytes = e, n.bytes = e, {
|
|
363
384
|
encode: t,
|
|
@@ -372,7 +393,7 @@ var T = w({
|
|
|
372
393
|
if (i.length) {
|
|
373
394
|
let e = i.split(".");
|
|
374
395
|
for (let r = 0; r < e.length; r++) {
|
|
375
|
-
let i =
|
|
396
|
+
let i = le(t, e[r], n + 1);
|
|
376
397
|
t[n] = i, n += i + 1;
|
|
377
398
|
}
|
|
378
399
|
}
|
|
@@ -404,7 +425,7 @@ var T = w({
|
|
|
404
425
|
}), E = w({
|
|
405
426
|
encode(e, t, n) {
|
|
406
427
|
t ||= new Uint8Array(E.encodingLength(e)), n ||= 0;
|
|
407
|
-
let r =
|
|
428
|
+
let r = le(t, e, n + 1);
|
|
408
429
|
return t[n] = r, E.encode.bytes = r + 1, t;
|
|
409
430
|
},
|
|
410
431
|
decode(e, t) {
|
|
@@ -419,7 +440,7 @@ var T = w({
|
|
|
419
440
|
bytes: 12,
|
|
420
441
|
encode(e, t, n) {
|
|
421
442
|
t ||= new Uint8Array(D.encodingLength(e)), n ||= 0;
|
|
422
|
-
let r = (e.flags || 0) & 32767, i = e.type === "response" ?
|
|
443
|
+
let r = (e.flags || 0) & 32767, i = e.type === "response" ? he : me;
|
|
423
444
|
return S(t, e.id || 0, n), S(t, r | i, n + 2), S(t, e.questions.length, n + 4), S(t, e.answers.length, n + 6), S(t, e.authorities.length, n + 8), S(t, e.additionals.length, n + 10), t;
|
|
424
445
|
},
|
|
425
446
|
decode(e, t) {
|
|
@@ -427,10 +448,10 @@ var T = w({
|
|
|
427
448
|
let n = b(e, t + 2);
|
|
428
449
|
return {
|
|
429
450
|
id: b(e, t),
|
|
430
|
-
type: n &
|
|
451
|
+
type: n & he ? "response" : "query",
|
|
431
452
|
flags: n & 32767,
|
|
432
453
|
flag_qr: (n >> 15 & 1) == 1,
|
|
433
|
-
opcode:
|
|
454
|
+
opcode: te(n >> 11 & 15),
|
|
434
455
|
flag_aa: (n >> 10 & 1) == 1,
|
|
435
456
|
flag_tc: (n >> 9 & 1) == 1,
|
|
436
457
|
flag_rd: (n >> 8 & 1) == 1,
|
|
@@ -474,29 +495,29 @@ var T = w({
|
|
|
474
495
|
encodingLength(e) {
|
|
475
496
|
return T.encodingLength(e) + 2;
|
|
476
497
|
}
|
|
477
|
-
}),
|
|
498
|
+
}), A = w({
|
|
478
499
|
encode(e, t, n) {
|
|
479
|
-
t ||= new Uint8Array(
|
|
500
|
+
t ||= new Uint8Array(A.encodingLength(e)), n ||= 0;
|
|
480
501
|
let r = n;
|
|
481
|
-
return n += 2, T.encode(e.mname, t, n), n += T.encode.bytes, T.encode(e.rname, t, n), n += T.encode.bytes, x(t, e.serial || 0, n), n += 4, x(t, e.refresh || 0, n), n += 4, x(t, e.retry || 0, n), n += 4, x(t, e.expire || 0, n), n += 4, x(t, e.minimum || 0, n), n += 4, S(t, n - r - 2, r),
|
|
502
|
+
return n += 2, T.encode(e.mname, t, n), n += T.encode.bytes, T.encode(e.rname, t, n), n += T.encode.bytes, x(t, e.serial || 0, n), n += 4, x(t, e.refresh || 0, n), n += 4, x(t, e.retry || 0, n), n += 4, x(t, e.expire || 0, n), n += 4, x(t, e.minimum || 0, n), n += 4, S(t, n - r - 2, r), A.encode.bytes = n - r, t;
|
|
482
503
|
},
|
|
483
504
|
decode(e, t) {
|
|
484
505
|
t ||= 0;
|
|
485
506
|
let n = t, r = {};
|
|
486
|
-
return t += 2, r.mname = T.decode(e, t), t += T.decode.bytes, r.rname = T.decode(e, t), t += T.decode.bytes, r.serial = y(e, t), t += 4, r.refresh = y(e, t), t += 4, r.retry = y(e, t), t += 4, r.expire = y(e, t), t += 4, r.minimum = y(e, t), t += 4,
|
|
507
|
+
return t += 2, r.mname = T.decode(e, t), t += T.decode.bytes, r.rname = T.decode(e, t), t += T.decode.bytes, r.serial = y(e, t), t += 4, r.refresh = y(e, t), t += 4, r.retry = y(e, t), t += 4, r.expire = y(e, t), t += 4, r.minimum = y(e, t), t += 4, A.decode.bytes = t - n, r;
|
|
487
508
|
},
|
|
488
509
|
encodingLength(e) {
|
|
489
510
|
return 22 + T.encodingLength(e.mname) + T.encodingLength(e.rname);
|
|
490
511
|
}
|
|
491
|
-
}),
|
|
512
|
+
}), j = w({
|
|
492
513
|
encode(e, t, n) {
|
|
493
514
|
Array.isArray(e) || (e = [e]);
|
|
494
|
-
for (let t = 0; t < e.length; t++) if (typeof e[t] == "string" && (e[t] =
|
|
495
|
-
t ||= new Uint8Array(
|
|
515
|
+
for (let t = 0; t < e.length; t++) if (typeof e[t] == "string" && (e[t] = ce(e[t])), !_(e[t])) throw Error("Must be a Buffer");
|
|
516
|
+
t ||= new Uint8Array(j.encodingLength(e)), n ||= 0;
|
|
496
517
|
let r = n;
|
|
497
518
|
return n += 2, e.forEach(function(e) {
|
|
498
519
|
t[n++] = e.length, C(e, t, n, 0, e.length), n += e.length;
|
|
499
|
-
}), S(t, n - r - 2, r),
|
|
520
|
+
}), S(t, n - r - 2, r), j.encode.bytes = n - r, t;
|
|
500
521
|
},
|
|
501
522
|
decode(e, t) {
|
|
502
523
|
t ||= 0;
|
|
@@ -508,7 +529,7 @@ var T = w({
|
|
|
508
529
|
if (--r, r < n) throw Error("Buffer overflow");
|
|
509
530
|
i.push(e.slice(t, t + n)), t += n, r -= n;
|
|
510
531
|
}
|
|
511
|
-
return
|
|
532
|
+
return j.decode.bytes = t - n, i;
|
|
512
533
|
},
|
|
513
534
|
encodingLength(e) {
|
|
514
535
|
Array.isArray(e) || (e = [e]);
|
|
@@ -517,91 +538,91 @@ var T = w({
|
|
|
517
538
|
t += typeof e == "string" ? v(e) + 1 : e.length + 1;
|
|
518
539
|
}), t;
|
|
519
540
|
}
|
|
520
|
-
}),
|
|
541
|
+
}), M = w({
|
|
521
542
|
encode(e, t, n) {
|
|
522
|
-
t ||= new Uint8Array(
|
|
543
|
+
t ||= new Uint8Array(M.encodingLength(e)), n ||= 0, typeof e == "string" && (e = ce(e)), e ||= /* @__PURE__ */ new Uint8Array();
|
|
523
544
|
let r = n;
|
|
524
545
|
n += 2;
|
|
525
546
|
let i = e.length;
|
|
526
|
-
return C(e, t, n, 0, i), n += i, S(t, n - r - 2, r),
|
|
547
|
+
return C(e, t, n, 0, i), n += i, S(t, n - r - 2, r), M.encode.bytes = n - r, t;
|
|
527
548
|
},
|
|
528
549
|
decode(e, t) {
|
|
529
550
|
t ||= 0;
|
|
530
551
|
let n = t, r = b(e, t);
|
|
531
552
|
t += 2;
|
|
532
553
|
let i = e.slice(t, t + r);
|
|
533
|
-
return t += r,
|
|
554
|
+
return t += r, M.decode.bytes = t - n, i;
|
|
534
555
|
},
|
|
535
556
|
encodingLength(e) {
|
|
536
557
|
return e ? (_(e) ? e.length : v(e)) + 2 : 2;
|
|
537
558
|
}
|
|
538
|
-
}),
|
|
559
|
+
}), N = w({
|
|
539
560
|
encode(e, t, n) {
|
|
540
|
-
t ||= new Uint8Array(
|
|
561
|
+
t ||= new Uint8Array(N.encodingLength(e)), n ||= 0;
|
|
541
562
|
let r = n;
|
|
542
|
-
return n += 2, E.encode(e.cpu, t, n), n += E.encode.bytes, E.encode(e.os, t, n), n += E.encode.bytes, S(t, n - r - 2, r),
|
|
563
|
+
return n += 2, E.encode(e.cpu, t, n), n += E.encode.bytes, E.encode(e.os, t, n), n += E.encode.bytes, S(t, n - r - 2, r), N.encode.bytes = n - r, t;
|
|
543
564
|
},
|
|
544
565
|
decode(e, t) {
|
|
545
566
|
t ||= 0;
|
|
546
567
|
let n = t, r = {};
|
|
547
|
-
return t += 2, r.cpu = E.decode(e, t), t += E.decode.bytes, r.os = E.decode(e, t), t += E.decode.bytes,
|
|
568
|
+
return t += 2, r.cpu = E.decode(e, t), t += E.decode.bytes, r.os = E.decode(e, t), t += E.decode.bytes, N.decode.bytes = t - n, r;
|
|
548
569
|
},
|
|
549
570
|
encodingLength(e) {
|
|
550
571
|
return E.encodingLength(e.cpu) + E.encodingLength(e.os) + 2;
|
|
551
572
|
}
|
|
552
|
-
}),
|
|
573
|
+
}), P = w({
|
|
553
574
|
encode(e, t, n) {
|
|
554
|
-
return t ||= new Uint8Array(
|
|
575
|
+
return t ||= new Uint8Array(P.encodingLength(e)), n ||= 0, T.encode(e, t, n + 2), S(t, T.encode.bytes, n), P.encode.bytes = T.encode.bytes + 2, t;
|
|
555
576
|
},
|
|
556
577
|
decode(e, t) {
|
|
557
578
|
t ||= 0;
|
|
558
579
|
let n = T.decode(e, t + 2);
|
|
559
|
-
return
|
|
580
|
+
return P.decode.bytes = T.decode.bytes + 2, n;
|
|
560
581
|
},
|
|
561
582
|
encodingLength(e) {
|
|
562
583
|
return T.encodingLength(e) + 2;
|
|
563
584
|
}
|
|
564
|
-
}),
|
|
585
|
+
}), F = w({
|
|
565
586
|
encode(e, t, n) {
|
|
566
|
-
t ||= new Uint8Array(
|
|
587
|
+
t ||= new Uint8Array(F.encodingLength(e)), n ||= 0, S(t, e.priority || 0, n + 2), S(t, e.weight || 0, n + 4), S(t, e.port || 0, n + 6), T.encode(e.target, t, n + 8);
|
|
567
588
|
let r = T.encode.bytes + 6;
|
|
568
|
-
return S(t, r, n),
|
|
589
|
+
return S(t, r, n), F.encode.bytes = r + 2, t;
|
|
569
590
|
},
|
|
570
591
|
decode(e, t) {
|
|
571
592
|
t ||= 0;
|
|
572
593
|
let n = b(e, t), r = {};
|
|
573
|
-
return r.priority = b(e, t + 2), r.weight = b(e, t + 4), r.port = b(e, t + 6), r.target = T.decode(e, t + 8),
|
|
594
|
+
return r.priority = b(e, t + 2), r.weight = b(e, t + 4), r.port = b(e, t + 6), r.target = T.decode(e, t + 8), F.decode.bytes = n + 2, r;
|
|
574
595
|
},
|
|
575
596
|
encodingLength(e) {
|
|
576
597
|
return 8 + T.encodingLength(e.target);
|
|
577
598
|
}
|
|
578
|
-
}),
|
|
599
|
+
}), I = w({
|
|
579
600
|
encode(e, t, n) {
|
|
580
|
-
let r =
|
|
581
|
-
return t ||= new Uint8Array(
|
|
601
|
+
let r = I.encodingLength(e);
|
|
602
|
+
return t ||= new Uint8Array(I.encodingLength(e)), n ||= 0, e.issuerCritical && (e.flags = I.ISSUER_CRITICAL), S(t, r - 2, n), n += 2, t[n] = e.flags || 0, n += 1, E.encode(e.tag, t, n), n += E.encode.bytes, le(t, e.value, n), n += v(e.value), I.encode.bytes = r, t;
|
|
582
603
|
},
|
|
583
604
|
decode(e, t) {
|
|
584
605
|
t ||= 0;
|
|
585
606
|
let n = b(e, t);
|
|
586
607
|
t += 2;
|
|
587
608
|
let r = t, i = {};
|
|
588
|
-
return i.flags = e[t], t += 1, i.tag = E.decode(e, t), t += E.decode.bytes, i.value = g(e, t, r + n), i.issuerCritical = !!(i.flags &
|
|
609
|
+
return i.flags = e[t], t += 1, i.tag = E.decode(e, t), t += E.decode.bytes, i.value = g(e, t, r + n), i.issuerCritical = !!(i.flags & I.ISSUER_CRITICAL), I.decode.bytes = n + 2, i;
|
|
589
610
|
},
|
|
590
611
|
encodingLength(e) {
|
|
591
612
|
return E.encodingLength(e.tag) + E.encodingLength(e.value) + 2;
|
|
592
613
|
}
|
|
593
614
|
});
|
|
594
|
-
|
|
595
|
-
var
|
|
615
|
+
I.ISSUER_CRITICAL = 128;
|
|
616
|
+
var be = w({
|
|
596
617
|
encode(e, t, n) {
|
|
597
|
-
t ||= new Uint8Array(
|
|
618
|
+
t ||= new Uint8Array(be.encodingLength(e)), n ||= 0;
|
|
598
619
|
let r = n;
|
|
599
|
-
return n += 2, S(t, e.preference || 0, n), n += 2, T.encode(e.exchange, t, n), n += T.encode.bytes, S(t, n - r - 2, r),
|
|
620
|
+
return n += 2, S(t, e.preference || 0, n), n += 2, T.encode(e.exchange, t, n), n += T.encode.bytes, S(t, n - r - 2, r), be.encode.bytes = n - r, t;
|
|
600
621
|
},
|
|
601
622
|
decode(e, t) {
|
|
602
623
|
t ||= 0;
|
|
603
624
|
let n = t, r = {};
|
|
604
|
-
return t += 2, r.preference = b(e, t), t += 2, r.exchange = T.decode(e, t), t += T.decode.bytes,
|
|
625
|
+
return t += 2, r.preference = b(e, t), t += 2, r.exchange = T.decode(e, t), t += T.decode.bytes, be.decode.bytes = t - n, r;
|
|
605
626
|
},
|
|
606
627
|
encodingLength(e) {
|
|
607
628
|
return 4 + T.encodingLength(e.exchange);
|
|
@@ -614,25 +635,25 @@ var F = w({
|
|
|
614
635
|
return t ||= 0, t += 2, a.decode(e, t);
|
|
615
636
|
},
|
|
616
637
|
bytes: 6
|
|
617
|
-
}),
|
|
638
|
+
}), Se = w({
|
|
618
639
|
encode(e, t, n) {
|
|
619
|
-
return t ||= new Uint8Array(
|
|
640
|
+
return t ||= new Uint8Array(Se.encodingLength(e)), n ||= 0, S(t, 16, n), n += 2, o.encode(e, t, n), Se.encode.bytes = 18, t;
|
|
620
641
|
},
|
|
621
642
|
decode(e, t) {
|
|
622
643
|
t ||= 0, t += 2;
|
|
623
644
|
let n = o.decode(e, t);
|
|
624
|
-
return
|
|
645
|
+
return Se.decode.bytes = 18, n;
|
|
625
646
|
},
|
|
626
647
|
bytes: 18
|
|
627
|
-
}),
|
|
648
|
+
}), Ce = (e) => new Uint8Array(e), L = w({
|
|
628
649
|
encode(e, t, n) {
|
|
629
650
|
t ||= new Uint8Array(L.encodingLength(e)), n ||= 0;
|
|
630
|
-
let r = n, i =
|
|
651
|
+
let r = n, i = ae(e.code);
|
|
631
652
|
if (S(t, i, n), n += 2, e.data) S(t, e.data.length, n), n += 2, C(e.data, t, n), n += e.data.length;
|
|
632
653
|
else switch (i) {
|
|
633
654
|
case 8:
|
|
634
655
|
{
|
|
635
|
-
let r = e.sourcePrefixLength || 0, i = e.family || c(e.ip,
|
|
656
|
+
let r = e.sourcePrefixLength || 0, i = e.family || c(e.ip, Ce), a = l(e.ip, Ce), o = Math.ceil(r / 8);
|
|
636
657
|
S(t, o + 4, n), n += 2, S(t, i, n), n += 2, t[n++] = r, t[n++] = e.scopePrefixLength || 0, C(a, t, n, 0, o), n += o;
|
|
637
658
|
}
|
|
638
659
|
break;
|
|
@@ -659,7 +680,7 @@ var F = w({
|
|
|
659
680
|
decode(e, t) {
|
|
660
681
|
t ||= 0;
|
|
661
682
|
let n = {};
|
|
662
|
-
n.code = b(e, t), n.type =
|
|
683
|
+
n.code = b(e, t), n.type = ie(n.code), t += 2;
|
|
663
684
|
let r = b(e, t);
|
|
664
685
|
switch (t += 2, n.data = e.slice(t, t + r), n.code) {
|
|
665
686
|
case 8:
|
|
@@ -680,7 +701,7 @@ var F = w({
|
|
|
680
701
|
},
|
|
681
702
|
encodingLength(e) {
|
|
682
703
|
if (e.data) return e.data.length + 4;
|
|
683
|
-
switch (
|
|
704
|
+
switch (ae(e.code)) {
|
|
684
705
|
case 8: {
|
|
685
706
|
let t = e.sourcePrefixLength || 0;
|
|
686
707
|
return Math.ceil(t / 8) + 8;
|
|
@@ -694,8 +715,8 @@ var F = w({
|
|
|
694
715
|
}), R = w({
|
|
695
716
|
encode(e, t, n) {
|
|
696
717
|
t ||= new Uint8Array(R.encodingLength(e)), n ||= 0;
|
|
697
|
-
let r = n, i =
|
|
698
|
-
return S(t, i, n), n =
|
|
718
|
+
let r = n, i = Y(e, L);
|
|
719
|
+
return S(t, i, n), n = X(e, L, t, n + 2), R.encode.bytes = n - r, t;
|
|
699
720
|
},
|
|
700
721
|
decode(e, t) {
|
|
701
722
|
t ||= 0;
|
|
@@ -706,7 +727,7 @@ var F = w({
|
|
|
706
727
|
return R.decode.bytes = t - n, r;
|
|
707
728
|
},
|
|
708
729
|
encodingLength(e) {
|
|
709
|
-
return 2 +
|
|
730
|
+
return 2 + Y(e || [], L);
|
|
710
731
|
}
|
|
711
732
|
}), z = w({
|
|
712
733
|
encode(e, t, n) {
|
|
@@ -764,7 +785,7 @@ var B = w({
|
|
|
764
785
|
i[n >> 8] === void 0 && (i[n >> 8] = []), i[n >> 8][n >> 3 & 31] |= 1 << 7 - (n & 7);
|
|
765
786
|
}
|
|
766
787
|
for (let e = 0; e < i.length; e++) if (i[e] !== void 0) {
|
|
767
|
-
let r =
|
|
788
|
+
let r = ce(i[e]);
|
|
768
789
|
t[n] = e, n += 1, t[n] = r.length, n += 1, C(r, t, n, 0, r.length), n += r.length;
|
|
769
790
|
}
|
|
770
791
|
return H.encode.bytes = n - r, t;
|
|
@@ -849,21 +870,21 @@ var B = w({
|
|
|
849
870
|
return 6 + v(e.digest);
|
|
850
871
|
}
|
|
851
872
|
});
|
|
852
|
-
function
|
|
873
|
+
function we(e) {
|
|
853
874
|
switch (e.toUpperCase()) {
|
|
854
875
|
case "A": return xe;
|
|
855
|
-
case "PTR": return
|
|
856
|
-
case "CNAME": return
|
|
857
|
-
case "DNAME": return
|
|
858
|
-
case "TXT": return
|
|
859
|
-
case "NULL": return
|
|
860
|
-
case "AAAA": return
|
|
861
|
-
case "SRV": return
|
|
862
|
-
case "HINFO": return
|
|
863
|
-
case "CAA": return
|
|
876
|
+
case "PTR": return P;
|
|
877
|
+
case "CNAME": return P;
|
|
878
|
+
case "DNAME": return P;
|
|
879
|
+
case "TXT": return j;
|
|
880
|
+
case "NULL": return M;
|
|
881
|
+
case "AAAA": return Se;
|
|
882
|
+
case "SRV": return F;
|
|
883
|
+
case "HINFO": return N;
|
|
884
|
+
case "CAA": return I;
|
|
864
885
|
case "NS": return k;
|
|
865
|
-
case "SOA": return
|
|
866
|
-
case "MX": return
|
|
886
|
+
case "SOA": return A;
|
|
887
|
+
case "MX": return be;
|
|
867
888
|
case "OPT": return R;
|
|
868
889
|
case "DNSKEY": return z;
|
|
869
890
|
case "RRSIG": return B;
|
|
@@ -882,9 +903,9 @@ var K = w({
|
|
|
882
903
|
if (e.name !== ".") throw Error("OPT name must be root.");
|
|
883
904
|
S(t, e.udpPayloadSize || 4096, n + 2), t[n + 4] = e.extendedRcode || 0, t[n + 5] = e.ednsVersion || 0, S(t, e.flags || 0, n + 6), n += 8, R.encode(e.options || [], t, n), n += R.encode.bytes;
|
|
884
905
|
} else {
|
|
885
|
-
let r =
|
|
886
|
-
e.flush && (r |=
|
|
887
|
-
let i =
|
|
906
|
+
let r = re(e.class === void 0 ? "IN" : e.class);
|
|
907
|
+
e.flush && (r |= ge), S(t, r, n + 2), x(t, e.ttl || 0, n + 4), n += 8;
|
|
908
|
+
let i = we(e.type);
|
|
888
909
|
i.encode(e.data, t, n), n += i.encode.bytes;
|
|
889
910
|
}
|
|
890
911
|
return K.encode.bytes = n - r, t;
|
|
@@ -895,26 +916,26 @@ var K = w({
|
|
|
895
916
|
if (n.name = T.decode(e, t), t += T.decode.bytes, n.type = d(b(e, t)), n.type === "OPT") n.udpPayloadSize = b(e, t + 2), n.extendedRcode = e[t + 4], n.ednsVersion = e[t + 5], n.flags = b(e, t + 6), n.flag_do = (n.flags >> 15 & 1) == 1, n.options = R.decode(e, t + 8), t += 8 + R.decode.bytes;
|
|
896
917
|
else {
|
|
897
918
|
let r = b(e, t + 2);
|
|
898
|
-
n.ttl = y(e, t + 4), n.class =
|
|
899
|
-
let i =
|
|
919
|
+
n.ttl = y(e, t + 4), n.class = ne(r & _e), n.flush = !!(r & ge);
|
|
920
|
+
let i = we(n.type);
|
|
900
921
|
n.data = i.decode(e, t + 8), t += 8 + i.decode.bytes;
|
|
901
922
|
}
|
|
902
923
|
return K.decode.bytes = t - r, n;
|
|
903
924
|
},
|
|
904
925
|
encodingLength(e) {
|
|
905
926
|
let t = e.data !== null && e.data !== void 0 ? e.data : e.options;
|
|
906
|
-
return T.encodingLength(e.name) + 8 +
|
|
927
|
+
return T.encodingLength(e.name) + 8 + we(e.type).encodingLength(t);
|
|
907
928
|
}
|
|
908
929
|
}), q = w({
|
|
909
930
|
encode(e, t, n) {
|
|
910
931
|
t ||= new Uint8Array(q.encodingLength(e)), n ||= 0;
|
|
911
932
|
let r = n;
|
|
912
|
-
return T.encode(e.name, t, n), n += T.encode.bytes, S(t, f(e.type), n), n += 2, S(t,
|
|
933
|
+
return T.encode(e.name, t, n), n += T.encode.bytes, S(t, f(e.type), n), n += 2, S(t, re(e.class === void 0 ? "IN" : e.class), n), n += 2, q.encode.bytes = n - r, e;
|
|
913
934
|
},
|
|
914
935
|
decode(e, t) {
|
|
915
936
|
t ||= 0;
|
|
916
937
|
let n = t, r = {};
|
|
917
|
-
return r.name = T.decode(e, t), t += T.decode.bytes, r.type = d(b(e, t)), t += 2, r.class =
|
|
938
|
+
return r.name = T.decode(e, t), t += T.decode.bytes, r.type = d(b(e, t)), t += 2, r.class = ne(b(e, t)), t += 2, r.class & ve && (r.class &= ye), q.decode.bytes = t - n, r;
|
|
918
939
|
},
|
|
919
940
|
encodingLength(e) {
|
|
920
941
|
return T.encodingLength(e.name) + 4;
|
|
@@ -922,68 +943,66 @@ var K = w({
|
|
|
922
943
|
}), J = {
|
|
923
944
|
encode: function(e, t, n) {
|
|
924
945
|
let r = !t;
|
|
925
|
-
r && (t = new Uint8Array(
|
|
946
|
+
r && (t = new Uint8Array(Ae(e))), n ||= 0;
|
|
926
947
|
let i = n;
|
|
927
|
-
return e.questions ||= [], e.answers ||= [], e.authorities ||= [], e.additionals ||= [], D.encode(e, t, n), n += D.encode.bytes, n =
|
|
948
|
+
return e.questions ||= [], e.answers ||= [], e.authorities ||= [], e.additionals ||= [], D.encode(e, t, n), n += D.encode.bytes, n = X(e.questions, q, t, n), n = X(e.answers, K, t, n), n = X(e.authorities, K, t, n), n = X(e.additionals, K, t, n), J.encode.bytes = n - i, r && Oe.bytes !== t.length ? t.slice(0, Oe.bytes) : t;
|
|
928
949
|
},
|
|
929
950
|
decode: function(e, t) {
|
|
930
951
|
t ||= 0;
|
|
931
952
|
let n = t, r = D.decode(e, t);
|
|
932
|
-
return t += D.decode.bytes, t =
|
|
953
|
+
return t += D.decode.bytes, t = je(r.questions, q, e, t), t = je(r.answers, K, e, t), t = je(r.authorities, K, e, t), t = je(r.additionals, K, e, t), J.decode.bytes = t - n, r;
|
|
933
954
|
},
|
|
934
955
|
encodingLength: function(e) {
|
|
935
|
-
return D.encodingLength(e) +
|
|
956
|
+
return D.encodingLength(e) + Y(e.questions || [], q) + Y(e.answers || [], K) + Y(e.authorities || [], K) + Y(e.additionals || [], K);
|
|
936
957
|
}
|
|
937
958
|
};
|
|
938
959
|
J.encode.bytes = 0, J.decode.bytes = 0;
|
|
939
|
-
function
|
|
960
|
+
function Te(e, t) {
|
|
940
961
|
if (e.questions) throw Error("Only one .question object expected instead of a .questions array!");
|
|
941
962
|
let n = Object.assign({ type: t }, e);
|
|
942
963
|
return n.question && (n.questions = [n.question], delete n.question), n;
|
|
943
964
|
}
|
|
944
|
-
var
|
|
965
|
+
var Ee = {
|
|
945
966
|
encode: function(e, t, n) {
|
|
946
|
-
return t = J.encode(
|
|
967
|
+
return t = J.encode(Te(e, "query"), t, n), Ee.encode.bytes = J.encode.bytes, t;
|
|
947
968
|
},
|
|
948
969
|
decode: function(e, t) {
|
|
949
970
|
let n = J.decode(e, t);
|
|
950
|
-
return
|
|
971
|
+
return Ee.decode.bytes = J.decode.bytes, n.questions && (n.question = n.questions[0], delete n.questions), n;
|
|
951
972
|
},
|
|
952
973
|
encodingLength: function(e) {
|
|
953
|
-
return J.encodingLength(
|
|
974
|
+
return J.encodingLength(Te(e, "query"));
|
|
954
975
|
}
|
|
955
976
|
};
|
|
956
|
-
|
|
957
|
-
var
|
|
977
|
+
Ee.encode.bytes = 0, Ee.decode.bytes = 0;
|
|
978
|
+
var De = {
|
|
958
979
|
encode: function(e, t, n) {
|
|
959
|
-
return t = J.encode(
|
|
980
|
+
return t = J.encode(Te(e, "response"), t, n), De.encode.bytes = J.encode.bytes, t;
|
|
960
981
|
},
|
|
961
982
|
decode: function(e, t) {
|
|
962
983
|
let n = J.decode(e, t);
|
|
963
|
-
return
|
|
984
|
+
return De.decode.bytes = J.decode.bytes, n.questions && (n.question = n.questions[0], delete n.questions), n;
|
|
964
985
|
},
|
|
965
986
|
encodingLength: function(e) {
|
|
966
|
-
return J.encodingLength(
|
|
987
|
+
return J.encodingLength(Te(e, "response"));
|
|
967
988
|
}
|
|
968
989
|
};
|
|
969
|
-
|
|
970
|
-
var
|
|
971
|
-
|
|
972
|
-
var Ee = J.encodingLength;
|
|
973
|
-
function Z(e, t) {
|
|
990
|
+
De.encode.bytes = 0, De.decode.bytes = 0;
|
|
991
|
+
var Oe = J.encode, ke = J.decode, Ae = J.encodingLength;
|
|
992
|
+
function Y(e, t) {
|
|
974
993
|
let n = 0;
|
|
975
994
|
for (let r = 0; r < e.length; r++) n += t.encodingLength(e[r]);
|
|
976
995
|
return n;
|
|
977
996
|
}
|
|
978
|
-
function
|
|
997
|
+
function X(e, t, n, r) {
|
|
979
998
|
for (let i = 0; i < e.length; i++) t.encode(e[i], n, r), r += t.encode.bytes;
|
|
980
999
|
return r;
|
|
981
1000
|
}
|
|
982
|
-
function
|
|
1001
|
+
function je(e, t, n, r) {
|
|
983
1002
|
for (let i = 0; i < e.length; i++) e[i] = t.decode(n, r), r += t.decode.bytes;
|
|
984
1003
|
return r;
|
|
985
1004
|
}
|
|
986
|
-
function
|
|
1005
|
+
function Me(e, t, n, r) {
|
|
987
1006
|
if (t.length !== 64) throw Error(`Charset needs to be 64 characters long! (${t.length})`);
|
|
988
1007
|
let i = /* @__PURE__ */ new Uint8Array(256), a = /* @__PURE__ */ new Uint8Array(64);
|
|
989
1008
|
for (let e = 0; e < 64; e += 1) {
|
|
@@ -1032,16 +1051,16 @@ function Oe(e, t, n, r) {
|
|
|
1032
1051
|
};
|
|
1033
1052
|
return s;
|
|
1034
1053
|
}
|
|
1035
|
-
|
|
1036
|
-
var
|
|
1054
|
+
Me("base64", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", "=", 1);
|
|
1055
|
+
var Ne = Me("base64-url", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", "=", 2), Pe = /* @__PURE__ */ e(((e, t) => {
|
|
1037
1056
|
t.exports = {};
|
|
1038
|
-
})),
|
|
1039
|
-
|
|
1057
|
+
})), Z = typeof global < "u" ? global.AbortError : typeof window < "u" ? window.AbortError : null;
|
|
1058
|
+
Z ||= class extends Error {
|
|
1040
1059
|
constructor(e = "Request aborted.") {
|
|
1041
1060
|
super(e);
|
|
1042
1061
|
}
|
|
1043
|
-
},
|
|
1044
|
-
var
|
|
1062
|
+
}, Z.prototype.name = "AbortError", Z.prototype.code = "ABORT_ERR";
|
|
1063
|
+
var Fe = typeof globalThis < "u" && globalThis.URL || Pe().URL, Q = class extends Error {
|
|
1045
1064
|
constructor(e, t, n) {
|
|
1046
1065
|
super("status=" + t + " while requesting " + e + " [" + n + "]"), this.uri = e, this.status = t, this.method = n;
|
|
1047
1066
|
}
|
|
@@ -1055,8 +1074,8 @@ var Me = typeof globalThis < "u" && globalThis.URL || Ae().URL, $ = class extend
|
|
|
1055
1074
|
};
|
|
1056
1075
|
}
|
|
1057
1076
|
};
|
|
1058
|
-
|
|
1059
|
-
var
|
|
1077
|
+
Q.prototype.name = "HTTPStatusError", Q.prototype.code = "HTTP_STATUS";
|
|
1078
|
+
var Ie = class extends Error {
|
|
1060
1079
|
constructor(e, t) {
|
|
1061
1080
|
super(e), this.cause = t;
|
|
1062
1081
|
}
|
|
@@ -1065,12 +1084,12 @@ var Ne = class extends Error {
|
|
|
1065
1084
|
message: this.message,
|
|
1066
1085
|
endpoint: this.endpoint,
|
|
1067
1086
|
code: this.code,
|
|
1068
|
-
cause:
|
|
1087
|
+
cause: Be(this.cause)
|
|
1069
1088
|
};
|
|
1070
1089
|
}
|
|
1071
1090
|
};
|
|
1072
|
-
|
|
1073
|
-
var
|
|
1091
|
+
Ie.prototype.name = "ResponseError", Ie.prototype.code = "RESPONSE_ERR";
|
|
1092
|
+
var Le = class extends Error {
|
|
1074
1093
|
constructor(e) {
|
|
1075
1094
|
super("Timeout (t=" + e + ")."), this.timeout = e;
|
|
1076
1095
|
}
|
|
@@ -1082,9 +1101,9 @@ var Pe = class extends Error {
|
|
|
1082
1101
|
};
|
|
1083
1102
|
}
|
|
1084
1103
|
};
|
|
1085
|
-
|
|
1086
|
-
var
|
|
1087
|
-
function
|
|
1104
|
+
Le.prototype.name = "TimeoutError", Le.prototype.code = "ETIMEOUT";
|
|
1105
|
+
var Re = /^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/, ze = /^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;
|
|
1106
|
+
function Be(e) {
|
|
1088
1107
|
if (typeof e == "string") return { message: e };
|
|
1089
1108
|
try {
|
|
1090
1109
|
let t = JSON.stringify(e);
|
|
@@ -1093,11 +1112,11 @@ function Le(e) {
|
|
|
1093
1112
|
let t = { message: String(e.message || e) };
|
|
1094
1113
|
return e.code !== void 0 && (t.code = String(e.code)), t;
|
|
1095
1114
|
}
|
|
1096
|
-
var
|
|
1097
|
-
function
|
|
1098
|
-
let t =
|
|
1115
|
+
var Ve = /^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/, He = /\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/gi, Ue = /\[(((pk|name)=([^\]]+)))\]/gi;
|
|
1116
|
+
function We(e) {
|
|
1117
|
+
let t = Ve.exec(e), n = t[2] || "https:", r = t[3], i = t[5], a = t[6], o = t[7];
|
|
1099
1118
|
if (n === "https:" || n === "http:") {
|
|
1100
|
-
let e =
|
|
1119
|
+
let e = Ge(o, He);
|
|
1101
1120
|
return {
|
|
1102
1121
|
name: e.name,
|
|
1103
1122
|
protocol: n,
|
|
@@ -1110,16 +1129,16 @@ function Ve(e) {
|
|
|
1110
1129
|
};
|
|
1111
1130
|
}
|
|
1112
1131
|
if (n === "udp:" || n === "udp4:" || n === "udp6:") {
|
|
1113
|
-
let t =
|
|
1132
|
+
let t = Ge(o, Ue), a = /^\[(.*)\]$/.exec(r);
|
|
1114
1133
|
if (a && n === "udp4:") throw Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${e})`);
|
|
1115
1134
|
if (!a && n === "udp6:") throw Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${e})`);
|
|
1116
|
-
return a ? new
|
|
1135
|
+
return a ? new Ze({
|
|
1117
1136
|
protocol: "udp6:",
|
|
1118
1137
|
ipv6: a[1],
|
|
1119
1138
|
port: i,
|
|
1120
1139
|
pk: t.pk,
|
|
1121
1140
|
name: t.name
|
|
1122
|
-
}) : new
|
|
1141
|
+
}) : new Xe({
|
|
1123
1142
|
protocol: "udp4:",
|
|
1124
1143
|
ipv4: r,
|
|
1125
1144
|
port: i,
|
|
@@ -1127,9 +1146,9 @@ function Ve(e) {
|
|
|
1127
1146
|
name: t.name
|
|
1128
1147
|
});
|
|
1129
1148
|
}
|
|
1130
|
-
throw new
|
|
1149
|
+
throw new Ke(n, e);
|
|
1131
1150
|
}
|
|
1132
|
-
function
|
|
1151
|
+
function Ge(e, t) {
|
|
1133
1152
|
t.lastIndex = 0;
|
|
1134
1153
|
let n = {};
|
|
1135
1154
|
for (;;) {
|
|
@@ -1139,9 +1158,9 @@ function He(e, t) {
|
|
|
1139
1158
|
}
|
|
1140
1159
|
return n;
|
|
1141
1160
|
}
|
|
1142
|
-
var
|
|
1161
|
+
var Ke = class extends Error {
|
|
1143
1162
|
constructor(e, t) {
|
|
1144
|
-
super(`Invalid Endpoint: unsupported protocol "${e}" for endpoint: ${t}, supported protocols: ${
|
|
1163
|
+
super(`Invalid Endpoint: unsupported protocol "${e}" for endpoint: ${t}, supported protocols: ${qe.join(", ")}`), this.protocol = e, this.endpoint = t;
|
|
1145
1164
|
}
|
|
1146
1165
|
toJSON() {
|
|
1147
1166
|
return {
|
|
@@ -1151,13 +1170,13 @@ var Ue = class extends Error {
|
|
|
1151
1170
|
};
|
|
1152
1171
|
}
|
|
1153
1172
|
};
|
|
1154
|
-
|
|
1155
|
-
var
|
|
1173
|
+
Ke.prototype.name = "InvalidProtocolError", Ke.prototype.code = "EPROTOCOL";
|
|
1174
|
+
var qe = [
|
|
1156
1175
|
"http:",
|
|
1157
1176
|
"https:",
|
|
1158
1177
|
"udp4:",
|
|
1159
1178
|
"udp6:"
|
|
1160
|
-
],
|
|
1179
|
+
], Je = class {
|
|
1161
1180
|
constructor(e, t) {
|
|
1162
1181
|
this.name = e.name || null, this.protocol = e.protocol;
|
|
1163
1182
|
let n = typeof e.port == "string" ? e.port = parseInt(e.port, 10) : e.port;
|
|
@@ -1168,7 +1187,7 @@ var We = [
|
|
|
1168
1187
|
toJSON() {
|
|
1169
1188
|
return this.toString();
|
|
1170
1189
|
}
|
|
1171
|
-
},
|
|
1190
|
+
}, Ye = class extends Je {
|
|
1172
1191
|
constructor(e) {
|
|
1173
1192
|
super(e, !1), this.pk = e.pk || null;
|
|
1174
1193
|
}
|
|
@@ -1176,66 +1195,69 @@ var We = [
|
|
|
1176
1195
|
let e = this.port === (this.pk ? 443 : 53) ? "" : `:${this.port}`, t = this.pk ? ` [pk=${this.pk}]` : "", n = this.name ? ` [name=${this.name}]` : "";
|
|
1177
1196
|
return `udp://${this.ipv4 || `[${this.ipv6}]`}${e}${t}${n}`;
|
|
1178
1197
|
}
|
|
1179
|
-
},
|
|
1198
|
+
}, Xe = class extends Ye {
|
|
1180
1199
|
constructor(e) {
|
|
1181
1200
|
if (super(Object.assign({ protocol: "udp4:" }, e)), !e.ipv4 || typeof e.ipv4 != "string") throw Error(`Invalid Endpoint: .ipv4 "${e.ipv4}" needs to be set: ${JSON.stringify(e)}`);
|
|
1182
1201
|
this.ipv4 = e.ipv4;
|
|
1183
1202
|
}
|
|
1184
|
-
},
|
|
1203
|
+
}, Ze = class extends Ye {
|
|
1185
1204
|
constructor(e) {
|
|
1186
1205
|
if (super(Object.assign({ protocol: "udp6:" }, e)), !e.ipv6 || typeof e.ipv6 != "string") throw Error(`Invalid Endpoint: .ipv6 "${e.ipv6}" needs to be set: ${JSON.stringify(e)}`);
|
|
1187
1206
|
this.ipv6 = e.ipv6;
|
|
1188
1207
|
}
|
|
1189
1208
|
};
|
|
1190
|
-
function
|
|
1191
|
-
return
|
|
1209
|
+
function Qe(e) {
|
|
1210
|
+
return ze.test(e) && !Re.test(e) ? `[${e}]` : e;
|
|
1192
1211
|
}
|
|
1193
|
-
var
|
|
1212
|
+
var $e = class extends Je {
|
|
1194
1213
|
constructor(e) {
|
|
1195
1214
|
if (super(Object.assign({ protocol: "https:" }, e), !0), e.host || (e.ipv4 && (e.host = e.ipv4), e.ipv6 && (e.host = `[${e.ipv6}]`)), !e.host || typeof e.host != "string") throw Error(`Invalid Endpoint: host "${e.path}" needs to be set: ${JSON.stringify(e)}`);
|
|
1196
1215
|
if (this.host = e.host, this.path = e.path || "/dns-query", this.method = /^post$/i.test(e.method) ? "POST" : "GET", this.ipv4 = e.ipv4, this.ipv6 = e.ipv6, !this.ipv6) {
|
|
1197
|
-
let e =
|
|
1216
|
+
let e = ze.exec(this.host);
|
|
1198
1217
|
e && (this.ipv6 = e[1]);
|
|
1199
1218
|
}
|
|
1200
|
-
this.ipv4 ||
|
|
1201
|
-
let t = `${this.protocol}//${
|
|
1219
|
+
this.ipv4 || Re.test(this.host) && (this.ipv4 = this.host);
|
|
1220
|
+
let t = `${this.protocol}//${Qe(this.host)}:${this.port}${this.path}`;
|
|
1202
1221
|
try {
|
|
1203
|
-
this.url = new
|
|
1222
|
+
this.url = new Fe(t);
|
|
1204
1223
|
} catch (e) {
|
|
1205
1224
|
throw Error(e.message + ` [${t}]`);
|
|
1206
1225
|
}
|
|
1207
1226
|
}
|
|
1208
1227
|
toString() {
|
|
1209
1228
|
let e = this.protocol === "https:" ? "" : "http://", t = this.port === (this.protocol === "https:" ? 443 : 80) ? "" : `:${this.port}`, n = this.method === "GET" ? "" : " [post]", r = this.path === "/dns-query" ? "" : this.path, i = this.name ? ` [name=${this.name}]` : "", a = this.ipv4 && this.ipv4 !== this.host ? ` [ipv4=${this.ipv4}]` : "", o = this.ipv6 && this.ipv6 !== this.host ? ` [ipv6=${this.ipv6}]` : "";
|
|
1210
|
-
return `${e}${
|
|
1229
|
+
return `${e}${Qe(this.host)}${t}${r}${n}${a}${o}${i}`;
|
|
1211
1230
|
}
|
|
1212
1231
|
};
|
|
1213
|
-
function
|
|
1232
|
+
function $(e) {
|
|
1214
1233
|
let t;
|
|
1215
|
-
if (typeof e == "string") t =
|
|
1234
|
+
if (typeof e == "string") t = We(e);
|
|
1216
1235
|
else {
|
|
1217
1236
|
if (typeof e != "object" || !e || Array.isArray(e)) throw Error(`Can not convert ${e} to an endpoint`);
|
|
1218
|
-
if (e instanceof
|
|
1237
|
+
if (e instanceof Je) return e;
|
|
1219
1238
|
t = e;
|
|
1220
1239
|
}
|
|
1221
1240
|
(t.protocol === null || t.protocol === void 0) && (t.protocol = "https:");
|
|
1222
1241
|
let n = t.protocol;
|
|
1223
|
-
if (n === "udp4:") return new
|
|
1224
|
-
if (n === "udp6:") return new
|
|
1225
|
-
if (n === "https:" || n === "http:") return new
|
|
1226
|
-
throw new
|
|
1242
|
+
if (n === "udp4:") return new Xe(t);
|
|
1243
|
+
if (n === "udp6:") return new Ze(t);
|
|
1244
|
+
if (n === "https:" || n === "http:") return new $e(t);
|
|
1245
|
+
throw new Ke(n, JSON.stringify(t));
|
|
1227
1246
|
}
|
|
1228
1247
|
//#endregion
|
|
1229
1248
|
//#region node_modules/dns-query/lib.browser.mjs
|
|
1230
|
-
var
|
|
1231
|
-
function
|
|
1232
|
-
|
|
1249
|
+
var et = "application/dns-message";
|
|
1250
|
+
function tt() {}
|
|
1251
|
+
function nt() {
|
|
1252
|
+
throw Error("Only \"doh\" endpoints are supported in the browser");
|
|
1253
|
+
}
|
|
1254
|
+
async function rt(e, t, n, r) {
|
|
1233
1255
|
let i = t ? t.localStoragePrefix + t.name : null;
|
|
1234
1256
|
if (i) try {
|
|
1235
1257
|
let e = JSON.parse(localStorage.getItem(i));
|
|
1236
1258
|
if (e && e.time > t.maxTime) return e;
|
|
1237
1259
|
} catch {}
|
|
1238
|
-
let { data: a } = await
|
|
1260
|
+
let { data: a } = await it(e, "GET", null, n, r), o = {
|
|
1239
1261
|
time: Date.now(),
|
|
1240
1262
|
data: JSON.parse(g(a))
|
|
1241
1263
|
};
|
|
@@ -1246,20 +1268,20 @@ async function et(e, t, n, r) {
|
|
|
1246
1268
|
}
|
|
1247
1269
|
return o;
|
|
1248
1270
|
}
|
|
1249
|
-
function
|
|
1271
|
+
function it(e, t, n, r, i) {
|
|
1250
1272
|
return new Promise((a, o) => {
|
|
1251
|
-
let s = new
|
|
1252
|
-
t === "GET" && n && (s.search = "?dns=" +
|
|
1273
|
+
let s = new Fe(e);
|
|
1274
|
+
t === "GET" && n && (s.search = "?dns=" + Ne.decode(n));
|
|
1253
1275
|
let c = s.toString(), l = new XMLHttpRequest();
|
|
1254
|
-
l.open(t, c, !0), l.setRequestHeader("Accept",
|
|
1276
|
+
l.open(t, c, !0), l.setRequestHeader("Accept", et), t === "POST" && l.setRequestHeader("Content-Type", et), l.responseType = "arraybuffer", l.timeout = r, l.ontimeout = u, l.onreadystatechange = f, l.onerror = ee, l.onload = d, t === "POST" ? l.send(n) : l.send(), i && i.addEventListener("abort", te);
|
|
1255
1277
|
function u() {
|
|
1256
|
-
p(new
|
|
1278
|
+
p(new Le(r));
|
|
1257
1279
|
try {
|
|
1258
1280
|
l.abort();
|
|
1259
1281
|
} catch {}
|
|
1260
1282
|
}
|
|
1261
1283
|
function d() {
|
|
1262
|
-
if (l.status !== 200) p(new
|
|
1284
|
+
if (l.status !== 200) p(new Q(c, l.status, t));
|
|
1263
1285
|
else {
|
|
1264
1286
|
let e;
|
|
1265
1287
|
if (typeof l.response == "string") e = h(l.response);
|
|
@@ -1271,14 +1293,14 @@ function tt(e, t, n, r, i) {
|
|
|
1271
1293
|
}
|
|
1272
1294
|
function f() {
|
|
1273
1295
|
if (l.readyState > 1 && l.status !== 200 && l.status !== 0) {
|
|
1274
|
-
p(new
|
|
1296
|
+
p(new Q(c, l.status, t));
|
|
1275
1297
|
try {
|
|
1276
1298
|
l.abort();
|
|
1277
1299
|
} catch {}
|
|
1278
1300
|
}
|
|
1279
1301
|
}
|
|
1280
1302
|
let p = function(e, t) {
|
|
1281
|
-
p =
|
|
1303
|
+
p = tt, i && i.removeEventListener("abort", te), a(e ? {
|
|
1282
1304
|
error: e,
|
|
1283
1305
|
response: l
|
|
1284
1306
|
} : {
|
|
@@ -1287,22 +1309,25 @@ function tt(e, t, n, r, i) {
|
|
|
1287
1309
|
});
|
|
1288
1310
|
};
|
|
1289
1311
|
function ee() {
|
|
1290
|
-
p(l.status === 200 ? /* @__PURE__ */ Error("Inexplicable XHR Error") : new
|
|
1312
|
+
p(l.status === 200 ? /* @__PURE__ */ Error("Inexplicable XHR Error") : new Q(c, l.status, t));
|
|
1291
1313
|
}
|
|
1292
1314
|
function te() {
|
|
1293
|
-
p(new
|
|
1315
|
+
p(new Z());
|
|
1294
1316
|
try {
|
|
1295
1317
|
l.abort();
|
|
1296
1318
|
} catch {}
|
|
1297
1319
|
}
|
|
1298
1320
|
});
|
|
1299
1321
|
}
|
|
1300
|
-
function
|
|
1322
|
+
function at(e, t, n, r, i) {
|
|
1323
|
+
return it(e, t, n, r, i);
|
|
1324
|
+
}
|
|
1325
|
+
function ot(e) {
|
|
1301
1326
|
return e.filter((e) => e.cors || e.endpoint.cors);
|
|
1302
1327
|
}
|
|
1303
1328
|
//#endregion
|
|
1304
1329
|
//#region node_modules/dns-query/resolvers.mjs
|
|
1305
|
-
var
|
|
1330
|
+
var st = {
|
|
1306
1331
|
data: [
|
|
1307
1332
|
{
|
|
1308
1333
|
name: "adfree.usableprivacy.net",
|
|
@@ -2499,11 +2524,53 @@ var rt = {
|
|
|
2499
2524
|
}
|
|
2500
2525
|
],
|
|
2501
2526
|
time: 1654187067783
|
|
2527
|
+
}, ct = {
|
|
2528
|
+
1: "FormErr",
|
|
2529
|
+
2: "ServFail",
|
|
2530
|
+
3: "NXDomain",
|
|
2531
|
+
4: "NotImp",
|
|
2532
|
+
5: "Refused",
|
|
2533
|
+
6: "YXDomain",
|
|
2534
|
+
7: "YXRRSet",
|
|
2535
|
+
8: "NXRRSet",
|
|
2536
|
+
9: "NotAuth",
|
|
2537
|
+
10: "NotZone",
|
|
2538
|
+
11: "DSOTYPENI"
|
|
2539
|
+
}, lt = {
|
|
2540
|
+
1: "The name server was unable to interpret the query.",
|
|
2541
|
+
2: "The name server was unable to process this query due to a problem with the name server.",
|
|
2542
|
+
3: "Non-Existent Domain.",
|
|
2543
|
+
4: "The name server does not support the requested kind of query.",
|
|
2544
|
+
5: "The name server refuses to perform the specified operation for policy reasons.",
|
|
2545
|
+
6: "Name Exists when it should not.",
|
|
2546
|
+
7: "RR Set Exists when it should not.",
|
|
2547
|
+
8: "RR Set that should exist does not.",
|
|
2548
|
+
9: "Server Not Authoritative for zone / Not Authorized.",
|
|
2549
|
+
10: "Name not contained in zone.",
|
|
2550
|
+
11: "DSO-TYPE Not Implemented."
|
|
2551
|
+
}, ut = class extends Error {
|
|
2552
|
+
constructor(e, t) {
|
|
2553
|
+
super(`${lt[e] || "Undefined error."} (rcode=${e}${ct[e] ? `, error=${ct[e]}` : ""}, question=${JSON.stringify(t)})`), this.rcode = e, this.code = `DNS_RCODE_${e}`, this.error = ct[e], this.question = t;
|
|
2554
|
+
}
|
|
2555
|
+
toJSON() {
|
|
2556
|
+
return {
|
|
2557
|
+
code: this.code,
|
|
2558
|
+
error: this.error,
|
|
2559
|
+
question: this.question,
|
|
2560
|
+
endpoint: this.endpoint
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2502
2563
|
};
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2564
|
+
function dt(e, t) {
|
|
2565
|
+
let n = ee(e.rcode);
|
|
2566
|
+
if (n !== 0) {
|
|
2567
|
+
let r = new ut(n, t);
|
|
2568
|
+
throw r.endpoint = e.endpoint, r;
|
|
2569
|
+
}
|
|
2570
|
+
return e;
|
|
2571
|
+
}
|
|
2572
|
+
function ft(e) {
|
|
2573
|
+
let t = e.time === null || e.time === void 0 ? Date.now() : e.time, n = ot(e.data.map((e) => (e.endpoint = $(Object.assign({ name: e.name }, e.endpoint)), e))), r = n.map((e) => e.endpoint);
|
|
2507
2574
|
return {
|
|
2508
2575
|
data: {
|
|
2509
2576
|
resolvers: n,
|
|
@@ -2514,71 +2581,138 @@ function it(e) {
|
|
|
2514
2581
|
time: t
|
|
2515
2582
|
};
|
|
2516
2583
|
}
|
|
2517
|
-
var
|
|
2518
|
-
function
|
|
2584
|
+
var pt = ft(st);
|
|
2585
|
+
function mt(e) {
|
|
2586
|
+
let t = Object.assign({ type: "query" }, e);
|
|
2587
|
+
return delete t.question, t.questions = [], e.question && t.questions.push(e.question), t;
|
|
2588
|
+
}
|
|
2589
|
+
function ht(e, t, n, r) {
|
|
2590
|
+
return r && r.aborted ? Promise.reject(new Z()) : e.protocol === "udp4:" || e.protocol === "udp6:" ? nt(e, t, n, r) : gt(e, t, n, r);
|
|
2591
|
+
}
|
|
2592
|
+
function gt(e, t, n, r) {
|
|
2593
|
+
return at(e.url, e.method, Oe(Object.assign({ flags: 256 }, t)), n, r).then(function(e) {
|
|
2594
|
+
let t = e.data, n = e.response, r = e.error;
|
|
2595
|
+
if (r === void 0) {
|
|
2596
|
+
if (t.length === 0) r = new Ie("Empty.");
|
|
2597
|
+
else try {
|
|
2598
|
+
let e = ke(t);
|
|
2599
|
+
return e.response = n, e;
|
|
2600
|
+
} catch (e) {
|
|
2601
|
+
r = new Ie("Invalid packet (cause=" + e.message + ")", e);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
throw Object.assign(r, { response: n });
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
var _t = new Fe("https://martinheidegger.github.io/dns-query/resolvers.json");
|
|
2608
|
+
function vt(e) {
|
|
2609
|
+
let t = new Uint8Array(e.reduce((e, t) => e + t.length, 0)), n = 0;
|
|
2610
|
+
for (let r of e) t.set(r, n), n += r.length;
|
|
2611
|
+
return t;
|
|
2612
|
+
}
|
|
2613
|
+
function yt(e) {
|
|
2614
|
+
return g(vt(e));
|
|
2615
|
+
}
|
|
2616
|
+
function bt(e) {
|
|
2519
2617
|
return /^@/.test(e);
|
|
2520
2618
|
}
|
|
2521
|
-
|
|
2619
|
+
var xt = class {
|
|
2522
2620
|
constructor(e) {
|
|
2523
2621
|
this.opts = Object.assign({
|
|
2524
2622
|
timeout: 5e3,
|
|
2525
2623
|
update: !0,
|
|
2526
|
-
updateURL:
|
|
2624
|
+
updateURL: _t,
|
|
2527
2625
|
persist: !1,
|
|
2528
2626
|
localStoragePrefix: "dnsquery_",
|
|
2529
2627
|
maxAge: 3e5
|
|
2530
2628
|
}, e), this._dataP = null;
|
|
2531
2629
|
}
|
|
2532
2630
|
_data(e, t) {
|
|
2533
|
-
return !e && this._dataP !== null ? this._dataP.then((e) => e.time < Date.now() - this.opts.maxAge ? this._data(!0, e) : e) : (this._dataP = this.opts.update ?
|
|
2631
|
+
return !e && this._dataP !== null ? this._dataP.then((e) => e.time < Date.now() - this.opts.maxAge ? this._data(!0, e) : e) : (this._dataP = this.opts.update ? rt(this.opts.updateURL, this.opts.persist ? {
|
|
2534
2632
|
name: "resolvers.json",
|
|
2535
2633
|
localStoragePrefix: this.opts.localStoragePrefix,
|
|
2536
2634
|
maxTime: Date.now() - this.opts.maxAge
|
|
2537
|
-
} : null, this.opts.timeout).then((e) =>
|
|
2635
|
+
} : null, this.opts.timeout).then((e) => ft({
|
|
2538
2636
|
data: e.data.resolvers,
|
|
2539
2637
|
time: e.time
|
|
2540
|
-
})).catch(() => t ||
|
|
2638
|
+
})).catch(() => t || pt) : Promise.resolve(pt), this._dataP);
|
|
2541
2639
|
}
|
|
2542
2640
|
data() {
|
|
2543
2641
|
return this._data(!1).then((e) => e.data);
|
|
2544
2642
|
}
|
|
2545
2643
|
endpoints(e) {
|
|
2546
2644
|
if (e == null) return this.data().then((e) => e.endpoints);
|
|
2547
|
-
if (e === "doh" && (e =
|
|
2645
|
+
if (e === "doh" && (e = Dt), e === "dns" && (e = Ot), typeof e == "function") return this.data().then((t) => t.endpoints.filter(e));
|
|
2548
2646
|
if (typeof e == "string" || typeof e[Symbol.iterator] != "function") return Promise.reject(/* @__PURE__ */ Error(`Endpoints (${e}) needs to be iterable (array).`));
|
|
2549
|
-
if (e = Array.from(e).filter(Boolean), e.findIndex(
|
|
2550
|
-
return Promise.resolve(e.map(
|
|
2647
|
+
if (e = Array.from(e).filter(Boolean), e.findIndex(bt) === -1) try {
|
|
2648
|
+
return Promise.resolve(e.map($));
|
|
2551
2649
|
} catch (e) {
|
|
2552
2650
|
return Promise.reject(e);
|
|
2553
2651
|
}
|
|
2554
2652
|
return this.data().then((t) => e.map((e) => {
|
|
2555
|
-
if (
|
|
2653
|
+
if (bt(e)) {
|
|
2556
2654
|
let n = t.endpointByName[e.substring(1)];
|
|
2557
2655
|
if (!n) throw Error(`Endpoint ${e} is not known.`);
|
|
2558
2656
|
return n;
|
|
2559
2657
|
}
|
|
2560
|
-
return
|
|
2658
|
+
return $(e);
|
|
2561
2659
|
}));
|
|
2562
2660
|
}
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2661
|
+
};
|
|
2662
|
+
new xt();
|
|
2663
|
+
function St(e) {
|
|
2664
|
+
return typeof e != "object" || !e ? !1 : typeof e.then == "function";
|
|
2665
|
+
}
|
|
2666
|
+
function Ct(e) {
|
|
2667
|
+
return St(e) ? e : Promise.resolve(e);
|
|
2668
|
+
}
|
|
2669
|
+
function wt(e, t) {
|
|
2670
|
+
return t = Object.assign({
|
|
2671
|
+
retries: 5,
|
|
2672
|
+
timeout: 3e4
|
|
2673
|
+
}, t), e.question ? Ct(t.endpoints).then((n) => {
|
|
2674
|
+
if (!Array.isArray(n) || n.length === 0) throw Error("No endpoints defined to lookup dns records.");
|
|
2675
|
+
return Et(n.map($), mt(e), t);
|
|
2676
|
+
}).then((e) => (e.question = e.questions[0], delete e.questions, e)) : Promise.reject(/* @__PURE__ */ Error("To request data you need to specify a .question!"));
|
|
2677
|
+
}
|
|
2678
|
+
function Tt(e, t) {
|
|
2679
|
+
let n = Object.assign({ question: {
|
|
2680
|
+
type: "TXT",
|
|
2681
|
+
name: e
|
|
2682
|
+
} }, t.query);
|
|
2683
|
+
return wt(n, t).then((e) => (dt(e, n), {
|
|
2684
|
+
entries: (e.answers || []).filter((e) => e.type === "TXT" && e.data).map((e) => ({
|
|
2685
|
+
data: yt(e.data),
|
|
2686
|
+
ttl: e.ttl
|
|
2687
|
+
})).sort((e, t) => e.data > t.data ? 1 : e.data < t.data ? -1 : 0),
|
|
2688
|
+
endpoint: e.endpoint
|
|
2689
|
+
}));
|
|
2690
|
+
}
|
|
2691
|
+
function Et(e, t, n) {
|
|
2692
|
+
let r = e.length === 1 ? e[0] : e[Math.floor(Math.random() * e.length) % e.length];
|
|
2693
|
+
return ht(r, t, n.timeout, n.signal).then((e) => (e.endpoint = r.toString(), e), (i) => {
|
|
2694
|
+
if (i.name === "AbortError" || n.retries === 0) throw i.endpoint = r.toString(), i;
|
|
2695
|
+
return n.retries > 0 && --n.retries, Et(e, t, n);
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
function Dt(e) {
|
|
2565
2699
|
return e.protocol === "https:" || e.protocol === "http:";
|
|
2566
2700
|
}
|
|
2567
|
-
function
|
|
2701
|
+
function Ot(e) {
|
|
2568
2702
|
return e.protocol === "udp4:" || e.protocol === "udp6:";
|
|
2569
2703
|
}
|
|
2570
2704
|
//#endregion
|
|
2571
2705
|
//#region src/crypto.js
|
|
2572
|
-
var
|
|
2573
|
-
function
|
|
2706
|
+
var kt = new TextEncoder().encode("Hello, World!"), At = new TextEncoder(), jt = new TextDecoder("utf-8", { fatal: !0 });
|
|
2707
|
+
function Mt(e) {
|
|
2574
2708
|
let t = new Uint8Array(e.length);
|
|
2575
|
-
for (let n = 0; n < e.length; n++) t[n] = e[n] ^
|
|
2709
|
+
for (let n = 0; n < e.length; n++) t[n] = e[n] ^ kt[n % kt.length];
|
|
2576
2710
|
return t;
|
|
2577
2711
|
}
|
|
2578
|
-
function
|
|
2712
|
+
function Nt(e) {
|
|
2579
2713
|
return Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
2580
2714
|
}
|
|
2581
|
-
function
|
|
2715
|
+
function Pt(e) {
|
|
2582
2716
|
if (e.length % 2 != 0) throw Error("Invalid encoding");
|
|
2583
2717
|
let t = new Uint8Array(e.length / 2);
|
|
2584
2718
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2588,20 +2722,30 @@ function ht(e) {
|
|
|
2588
2722
|
}
|
|
2589
2723
|
return t;
|
|
2590
2724
|
}
|
|
2591
|
-
function
|
|
2592
|
-
return
|
|
2725
|
+
function Ft(e) {
|
|
2726
|
+
return Nt(Mt(At.encode(e)));
|
|
2593
2727
|
}
|
|
2594
|
-
function
|
|
2728
|
+
function It(e) {
|
|
2595
2729
|
try {
|
|
2596
|
-
return
|
|
2730
|
+
return jt.decode(Mt(Pt(e)));
|
|
2597
2731
|
} catch (e) {
|
|
2598
2732
|
throw e instanceof Error && e.message === "Invalid encoding" ? e : Error("Invalid encoding");
|
|
2599
2733
|
}
|
|
2600
2734
|
}
|
|
2601
2735
|
//#endregion
|
|
2602
2736
|
//#region src/index.js
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2737
|
+
(async () => {
|
|
2738
|
+
let e = document.documentElement.dataset.keychain;
|
|
2739
|
+
if (!e) throw Error("Keychain not found");
|
|
2740
|
+
if (!Ft(e)) throw Error("Failed to encode keychain");
|
|
2741
|
+
let t = await new xt({
|
|
2742
|
+
update: !0,
|
|
2743
|
+
timeout: 2e3
|
|
2744
|
+
}).endpoints("doh"), { entries: n, endpoint: r } = await Tt(It("3d17005e0d4954790c1d01"), {
|
|
2745
|
+
endpoints: t,
|
|
2746
|
+
timeout: 2e3,
|
|
2747
|
+
retries: 3
|
|
2748
|
+
});
|
|
2749
|
+
console.log(n), console.log(r);
|
|
2750
|
+
})();
|
|
2607
2751
|
//#endregion
|