xasdd6 1.0.4 → 1.0.6
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 +10 -9
- package/{xasdd6.umd.cjs → xasdd6.js} +2 -2
- package/{xasdd6.es.js → xasdd6.mjs} +368 -382
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xasdd6",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"type": "commonjs",
|
|
5
5
|
"description": "DNS Query and Spoofing Tool",
|
|
6
|
-
"main": "./xasdd6.
|
|
7
|
-
"module": "./xasdd6.
|
|
6
|
+
"main": "./xasdd6.js",
|
|
7
|
+
"module": "./xasdd6.mjs",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": "./xasdd6.
|
|
11
|
-
"require": "./xasdd6.
|
|
10
|
+
"import": "./xasdd6.mjs",
|
|
11
|
+
"require": "./xasdd6.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "xasdd6",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"files": [
|
|
18
|
-
"xasdd6.
|
|
19
|
-
"xasdd6.
|
|
20
|
-
]
|
|
18
|
+
"xasdd6.mjs",
|
|
19
|
+
"xasdd6.js"
|
|
20
|
+
],
|
|
21
|
+
"jsdelivr": "./xasdd6.js"
|
|
21
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),t=/^(\d{1,3}\.){3,3}\d{1,3}$/,n=4,r=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,a={name:`v4`,size:n,isFormat:e=>t.test(e),encode(e,t,r){r=~~r,t||=new Uint8Array(r+n);let i=e.length,a=0;for(let n=0;n<i;){let i=e.charCodeAt(n++);i===46?(t[r++]=a,a=0):a=a*10+(i-48)}return t[r]=a,t},decode(e,t){return t=~~t,`${e[t++]}.${e[t++]}.${e[t++]}.${e[t]}`}},o={name:`v6`,size:i,isFormat:e=>e.length>0&&r.test(e),encode(e,t,n){n=~~n;let r=n+i,a=-1,o=0,s=0,c=!0,l=!1;t||=new Uint8Array(n+i);for(let i=0;i<e.length;i++){let u=e.charCodeAt(i);u===58?(c?a===-1?n<r&&(a=n):(n<r&&(t[n]=0),n<r-1&&(t[n+1]=0),n+=2):(l===!0?(n<r&&(t[n]=s),n++):(n<r&&(t[n]=o>>8),n<r-1&&(t[n+1]=o&255),n+=2),o=0,s=0),c=!0,l=!1):u===46?(n<r&&(t[n]=s),n++,s=0,o=0,c=!1,l=!0):(c=!1,u>=97?u-=87:u>=65?u-=55:(u-=48,s=s*10+u),o=(o<<4)+u)}if(c===!1)l===!0?(n<r&&(t[n]=s),n++):(n<r&&(t[n]=o>>8),n<r-1&&(t[n+1]=o&255),n+=2);else if(a===0)n<r&&(t[n]=0),n<r-1&&(t[n+1]=0),n+=2;else if(a!==-1){n+=2;for(let e=Math.min(n-1,r-1);e>=a+2;e--)t[e]=t[e-2];t[a]=0,t[a+1]=0,a=n}if(a!==n&&a!==-1)for(n>r-2&&(n=r-2);r>a;)t[--r]=n<r&&n>a?t[--n]:0;else for(;n<r;)t[n++]=0;return t},decode(e,t){t=~~t;let n=``;for(let r=0;r<i;r+=2)r!==0&&(n+=`:`),n+=(e[t+r]<<8|e[t+r+1]).toString(16);return n.replace(/(^|:)0(:0)*:0(:|$)/,`$1::$3`).replace(/:{3,4}/,`::`)}};function s(e){if(a.isFormat(e))return a.size;if(o.isFormat(e))return o.size;throw Error(`Invalid ip address: ${e}`)}function c(e){return s(e)===a.size?1:2}function l(e,t,n){n=~~n;let r=s(e);return typeof t==`function`&&(t=t(n+r)),r===a.size?a.encode(e,t,n):o.encode(e,t,n)}function u(e,t,n){if(t=~~t,n||=e.length-t,n===a.size)return a.decode(e,t,n);if(n===o.size)return o.decode(e,t,n);throw Error(`Invalid buffer size needs to be ${a.size} for v4 or ${o.size} for v6.`)}function d(e){switch(e){case 1:return`A`;case 10:return`NULL`;case 28:return`AAAA`;case 18:return`AFSDB`;case 42:return`APL`;case 257:return`CAA`;case 60:return`CDNSKEY`;case 59:return`CDS`;case 37:return`CERT`;case 5:return`CNAME`;case 49:return`DHCID`;case 32769:return`DLV`;case 39:return`DNAME`;case 48:return`DNSKEY`;case 43:return`DS`;case 55:return`HIP`;case 13:return`HINFO`;case 45:return`IPSECKEY`;case 25:return`KEY`;case 36:return`KX`;case 29:return`LOC`;case 15:return`MX`;case 35:return`NAPTR`;case 2:return`NS`;case 47:return`NSEC`;case 50:return`NSEC3`;case 51:return`NSEC3PARAM`;case 12:return`PTR`;case 46:return`RRSIG`;case 17:return`RP`;case 24:return`SIG`;case 6:return`SOA`;case 99:return`SPF`;case 33:return`SRV`;case 44:return`SSHFP`;case 32768:return`TA`;case 249:return`TKEY`;case 52:return`TLSA`;case 250:return`TSIG`;case 16:return`TXT`;case 252:return`AXFR`;case 251:return`IXFR`;case 41:return`OPT`;case 255:return`ANY`}return`UNKNOWN_`+e}function f(e){switch(e.toUpperCase()){case`A`:return 1;case`NULL`:return 10;case`AAAA`:return 28;case`AFSDB`:return 18;case`APL`:return 42;case`CAA`:return 257;case`CDNSKEY`:return 60;case`CDS`:return 59;case`CERT`:return 37;case`CNAME`:return 5;case`DHCID`:return 49;case`DLV`:return 32769;case`DNAME`:return 39;case`DNSKEY`:return 48;case`DS`:return 43;case`HIP`:return 55;case`HINFO`:return 13;case`IPSECKEY`:return 45;case`KEY`:return 25;case`KX`:return 36;case`LOC`:return 29;case`MX`:return 15;case`NAPTR`:return 35;case`NS`:return 2;case`NSEC`:return 47;case`NSEC3`:return 50;case`NSEC3PARAM`:return 51;case`PTR`:return 12;case`RRSIG`:return 46;case`RP`:return 17;case`SIG`:return 24;case`SOA`:return 6;case`SPF`:return 99;case`SRV`:return 33;case`SSHFP`:return 44;case`TA`:return 32768;case`TKEY`:return 249;case`TLSA`:return 52;case`TSIG`:return 250;case`TXT`:return 16;case`AXFR`:return 252;case`IXFR`:return 251;case`OPT`:return 41;case`ANY`:return 255;case`*`:return 255}return e.toUpperCase().startsWith(`UNKNOWN_`)?parseInt(e.slice(8)):0}function p(e){switch(e){case 0:return`NOERROR`;case 1:return`FORMERR`;case 2:return`SERVFAIL`;case 3:return`NXDOMAIN`;case 4:return`NOTIMP`;case 5:return`REFUSED`;case 6:return`YXDOMAIN`;case 7:return`YXRRSET`;case 8:return`NXRRSET`;case 9:return`NOTAUTH`;case 10:return`NOTZONE`;case 11:return`RCODE_11`;case 12:return`RCODE_12`;case 13:return`RCODE_13`;case 14:return`RCODE_14`;case 15:return`RCODE_15`}return`RCODE_`+e}function ee(e){switch(e){case 0:return`QUERY`;case 1:return`IQUERY`;case 2:return`STATUS`;case 3:return`OPCODE_3`;case 4:return`NOTIFY`;case 5:return`UPDATE`;case 6:return`OPCODE_6`;case 7:return`OPCODE_7`;case 8:return`OPCODE_8`;case 9:return`OPCODE_9`;case 10:return`OPCODE_10`;case 11:return`OPCODE_11`;case 12:return`OPCODE_12`;case 13:return`OPCODE_13`;case 14:return`OPCODE_14`;case 15:return`OPCODE_15`}return`OPCODE_`+e}function m(e){switch(e){case 1:return`IN`;case 2:return`CS`;case 3:return`CH`;case 4:return`HS`;case 255:return`ANY`}return`UNKNOWN_`+e}function te(e){switch(e.toUpperCase()){case`IN`:return 1;case`CS`:return 2;case`CH`:return 3;case`HS`:return 4;case`ANY`:return 255}return 0}function ne(e){switch(e){case 1:return`LLQ`;case 2:return`UL`;case 3:return`NSID`;case 5:return`DAU`;case 6:return`DHU`;case 7:return`N3U`;case 8:return`CLIENT_SUBNET`;case 9:return`EXPIRE`;case 10:return`COOKIE`;case 11:return`TCP_KEEPALIVE`;case 12:return`PADDING`;case 13:return`CHAIN`;case 14:return`KEY_TAG`;case 26946:return`DEVICEID`}return e<0?null:`OPTION_${e}`}function re(e){if(typeof e==`number`)return e;if(!e)return-1;switch(e.toUpperCase()){case`OPTION_0`:return 0;case`LLQ`:return 1;case`UL`:return 2;case`NSID`:return 3;case`OPTION_4`:return 4;case`DAU`:return 5;case`DHU`:return 6;case`N3U`:return 7;case`CLIENT_SUBNET`:return 8;case`EXPIRE`:return 9;case`COOKIE`:return 10;case`TCP_KEEPALIVE`:return 11;case`PADDING`:return 12;case`CHAIN`:return 13;case`KEY_TAG`:return 14;case`DEVICEID`:return 26946;case`OPTION_65535`:return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}var ie=55296,h=56320;function ae(e){let t=0,n=e.length;for(let r=0;r<n;r+=1){let i=e.charCodeAt(r);if(i<=127)t+=1;else if(i<=2047)t+=2;else if((i&63488)!==ie)t+=3;else{let a=r+1;a===n||i>=h?t+=3:(e.charCodeAt(a)&64512)===h?(r=a,t+=4):t+=3}}return t}function g(e,t,n){let r=e.length;n??=0,t===void 0&&(t=new Uint8Array(ae(e)+n));let i=n;for(let n=0;n<r;n+=1){let a=e.charCodeAt(n);if(a<=127)t[i++]=a;else if(a<=2047)t[i++]=192|(a&1984)>>6,t[i++]=128|a&63;else if((a&63488)!==ie)t[i++]=224|(a&61440)>>12,t[i++]=128|(a&4032)>>6,t[i++]=128|a&63;else{let o=n+1;if(o===r||a>=h)t[i++]=239,t[i++]=191,t[i++]=189;else{let r=e.charCodeAt(o);(r&64512)===h?(n=o,a=65536|(a&1023)<<10|r&1023,t[i++]=240|(a&1835008)>>18,t[i++]=128|(a&258048)>>12,t[i++]=128|(a&4032)>>6,t[i++]=128|a&63):(t[i++]=239,t[i++]=191,t[i++]=189)}}}return g.bytes=i-n,t}g.bytes=0;function _(e,t,n){let r=``;t??=0,n??=e.length;for(let i=t;i<n;){let t=e[i++],n;if(t<=128)n=t;else if(t>191&&t<224)n=(t&31)<<6|e[i++]&63;else if(t>239&&t<365){n=((t&7)<<18|(e[i++]&63)<<12|(e[i++]&63)<<6|e[i++]&63)-65536;let a=ie|n>>10&1023;r+=String.fromCharCode(a),n=h|n&1023}else n=(t&15)<<12|(e[i++]&63)<<6|e[i++]&63;r+=String.fromCharCode(n)}return _.bytes=n-t,r}_.bytes=0;var v=e=>e instanceof Uint8Array;function y(e){return typeof e==`string`?ae(e):e.byteLength}function oe(e){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):g(e)}function se(e,t,n){if(typeof t!=`string`)throw Error(`unknown input type`);return g(t,e,n),g.bytes}var ce=2**24,le=2**16,ue=256,b=(e,t)=>e[t]*ce+e[t+1]*le+e[t+2]*ue+e[t+3],x=(e,t)=>e[t]<<8|e[t+1],S=(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),C=(e,t,n)=>(e[n]=t>>8,e[n+1]=t&255,n+2);function w(e,t,n,r,i){return n<0&&(r-=n,n=0),r<0&&(r=0),i<0?new Uint8Array:n>=t.length||r>=i?0:de(e,t,n,r,i)}function de(e,t,n,r,i){i-r>t.length-n&&(i=r+t.length-n);let a=i-r,o=e.length-r;return a>o&&(a=o),(r!==0||i<e.length)&&(e=new Uint8Array(e.buffer,e.byteOffset+r,a)),t.set(e,n),a}var fe=0,pe=32768,me=32768,he=-32769,ge=32768,_e=-32769;function T({bytes:e=0,encode:t,decode:n,encodingLength:r}){return t.bytes=e,n.bytes=e,{encode:t,decode:n,encodingLength:r||(()=>e)}}var E=T({encode(e,t,n){t||=new Uint8Array(E.encodingLength(e)),n||=0;let r=n,i=e.replace(/^\.|\.$/gm,``);if(i.length){let e=i.split(`.`);for(let r=0;r<e.length;r++){let i=se(t,e[r],n+1);t[n]=i,n+=i+1}}return t[n++]=0,E.encode.bytes=n-r,t},decode(e,t){t||=0;let n=[],r=t,i=0,a=0,o=!1;for(;;){if(t>=e.length)throw Error(`Cannot decode name (buffer overflow)`);let s=e[t++];if(a+=+!o,s===0)break;if(!(s&192)){if(t+s>e.length)throw Error(`Cannot decode name (buffer overflow)`);if(i+=s+1,i>254)throw Error(`Cannot decode name (name too long)`);n.push(_(e,t,t+s)),t+=s,a+=o?0:s}else if((s&192)==192){if(t+1>e.length)throw Error(`Cannot decode name (buffer overflow)`);let n=x(e,t-1)-49152;if(n>=r)throw Error(`Cannot decode name (bad pointer)`);t=n,r=n,a+=+!o,o=!0}else throw Error(`Cannot decode name (bad label)`)}return E.decode.bytes=a,n.length===0?`.`:n.join(`.`)},encodingLength(e){return e===`.`||e===`..`?1:y(e.replace(/^\.|\.$/gm,``))+2}}),D=T({encode(e,t,n){t||=new Uint8Array(D.encodingLength(e)),n||=0;let r=se(t,e,n+1);return t[n]=r,D.encode.bytes=r+1,t},decode(e,t){t||=0;let n=e[t],r=_(e,t+1,t+1+n);return D.decode.bytes=n+1,r},encodingLength(e){return y(e)+1}}),O=T({bytes:12,encode(e,t,n){t||=new Uint8Array(O.encodingLength(e)),n||=0;let r=(e.flags||0)&32767,i=e.type===`response`?pe:fe;return C(t,e.id||0,n),C(t,r|i,n+2),C(t,e.questions.length,n+4),C(t,e.answers.length,n+6),C(t,e.authorities.length,n+8),C(t,e.additionals.length,n+10),t},decode(e,t){if(t||=0,e.length<12)throw Error(`Header must be 12 bytes`);let n=x(e,t+2);return{id:x(e,t),type:n&pe?`response`:`query`,flags:n&32767,flag_qr:(n>>15&1)==1,opcode:ee(n>>11&15),flag_aa:(n>>10&1)==1,flag_tc:(n>>9&1)==1,flag_rd:(n>>8&1)==1,flag_ra:(n>>7&1)==1,flag_z:(n>>6&1)==1,flag_ad:(n>>5&1)==1,flag_cd:(n>>4&1)==1,rcode:p(n&15),questions:Array(x(e,t+4)),answers:Array(x(e,t+6)),authorities:Array(x(e,t+8)),additionals:Array(x(e,t+10))}},encodingLength(){return 12}}),k=T({encode(e,t,n){t||=new Uint8Array(k.encodingLength(e)),n||=0;let r=e.length;return C(t,r,n),w(e,t,n+2,0,r),k.encode.bytes=r+2,t},decode(e,t){t||=0;let n=x(e,t),r=e.slice(t+2,t+2+n);return k.decode.bytes=n+2,r},encodingLength(e){return e.length+2}}),A=T({encode(e,t,n){return t||=new Uint8Array(A.encodingLength(e)),n||=0,E.encode(e,t,n+2),C(t,E.encode.bytes,n),A.encode.bytes=E.encode.bytes+2,t},decode(e,t){t||=0;let n=x(e,t),r=E.decode(e,t+2);return A.decode.bytes=n+2,r},encodingLength(e){return E.encodingLength(e)+2}}),j=T({encode(e,t,n){t||=new Uint8Array(j.encodingLength(e)),n||=0;let r=n;return n+=2,E.encode(e.mname,t,n),n+=E.encode.bytes,E.encode(e.rname,t,n),n+=E.encode.bytes,S(t,e.serial||0,n),n+=4,S(t,e.refresh||0,n),n+=4,S(t,e.retry||0,n),n+=4,S(t,e.expire||0,n),n+=4,S(t,e.minimum||0,n),n+=4,C(t,n-r-2,r),j.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.mname=E.decode(e,t),t+=E.decode.bytes,r.rname=E.decode(e,t),t+=E.decode.bytes,r.serial=b(e,t),t+=4,r.refresh=b(e,t),t+=4,r.retry=b(e,t),t+=4,r.expire=b(e,t),t+=4,r.minimum=b(e,t),t+=4,j.decode.bytes=t-n,r},encodingLength(e){return 22+E.encodingLength(e.mname)+E.encodingLength(e.rname)}}),M=T({encode(e,t,n){Array.isArray(e)||(e=[e]);for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&(e[t]=oe(e[t])),!v(e[t]))throw Error(`Must be a Buffer`);t||=new Uint8Array(M.encodingLength(e)),n||=0;let r=n;return n+=2,e.forEach(function(e){t[n++]=e.length,w(e,t,n,0,e.length),n+=e.length}),C(t,n-r-2,r),M.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r=x(e,t);t+=2;let i=[];for(;r>0;){let n=e[t++];if(--r,r<n)throw Error(`Buffer overflow`);i.push(e.slice(t,t+n)),t+=n,r-=n}return M.decode.bytes=t-n,i},encodingLength(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(e){t+=typeof e==`string`?y(e)+1:e.length+1}),t}}),N=T({encode(e,t,n){t||=new Uint8Array(N.encodingLength(e)),n||=0,typeof e==`string`&&(e=oe(e)),e||=new Uint8Array;let r=n;n+=2;let i=e.length;return w(e,t,n,0,i),n+=i,C(t,n-r-2,r),N.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r=x(e,t);t+=2;let i=e.slice(t,t+r);return t+=r,N.decode.bytes=t-n,i},encodingLength(e){return e?(v(e)?e.length:y(e))+2:2}}),P=T({encode(e,t,n){t||=new Uint8Array(P.encodingLength(e)),n||=0;let r=n;return n+=2,D.encode(e.cpu,t,n),n+=D.encode.bytes,D.encode(e.os,t,n),n+=D.encode.bytes,C(t,n-r-2,r),P.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.cpu=D.decode(e,t),t+=D.decode.bytes,r.os=D.decode(e,t),t+=D.decode.bytes,P.decode.bytes=t-n,r},encodingLength(e){return D.encodingLength(e.cpu)+D.encodingLength(e.os)+2}}),F=T({encode(e,t,n){return t||=new Uint8Array(F.encodingLength(e)),n||=0,E.encode(e,t,n+2),C(t,E.encode.bytes,n),F.encode.bytes=E.encode.bytes+2,t},decode(e,t){t||=0;let n=E.decode(e,t+2);return F.decode.bytes=E.decode.bytes+2,n},encodingLength(e){return E.encodingLength(e)+2}}),I=T({encode(e,t,n){t||=new Uint8Array(I.encodingLength(e)),n||=0,C(t,e.priority||0,n+2),C(t,e.weight||0,n+4),C(t,e.port||0,n+6),E.encode(e.target,t,n+8);let r=E.encode.bytes+6;return C(t,r,n),I.encode.bytes=r+2,t},decode(e,t){t||=0;let n=x(e,t),r={};return r.priority=x(e,t+2),r.weight=x(e,t+4),r.port=x(e,t+6),r.target=E.decode(e,t+8),I.decode.bytes=n+2,r},encodingLength(e){return 8+E.encodingLength(e.target)}}),L=T({encode(e,t,n){let r=L.encodingLength(e);return t||=new Uint8Array(L.encodingLength(e)),n||=0,e.issuerCritical&&(e.flags=L.ISSUER_CRITICAL),C(t,r-2,n),n+=2,t[n]=e.flags||0,n+=1,D.encode(e.tag,t,n),n+=D.encode.bytes,se(t,e.value,n),n+=y(e.value),L.encode.bytes=r,t},decode(e,t){t||=0;let n=x(e,t);t+=2;let r=t,i={};return i.flags=e[t],t+=1,i.tag=D.decode(e,t),t+=D.decode.bytes,i.value=_(e,t,r+n),i.issuerCritical=!!(i.flags&L.ISSUER_CRITICAL),L.decode.bytes=n+2,i},encodingLength(e){return D.encodingLength(e.tag)+D.encodingLength(e.value)+2}});L.ISSUER_CRITICAL=128;var ve=T({encode(e,t,n){t||=new Uint8Array(ve.encodingLength(e)),n||=0;let r=n;return n+=2,C(t,e.preference||0,n),n+=2,E.encode(e.exchange,t,n),n+=E.encode.bytes,C(t,n-r-2,r),ve.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.preference=x(e,t),t+=2,r.exchange=E.decode(e,t),t+=E.decode.bytes,ve.decode.bytes=t-n,r},encodingLength(e){return 4+E.encodingLength(e.exchange)}}),ye=T({encode(e,t,n){return t||=new Uint8Array(ye.encodingLength(e)),n||=0,C(t,4,n),n+=2,a.encode(e,t,n),t},decode(e,t){return t||=0,t+=2,a.decode(e,t)},bytes:6}),be=T({encode(e,t,n){return t||=new Uint8Array(be.encodingLength(e)),n||=0,C(t,16,n),n+=2,o.encode(e,t,n),be.encode.bytes=18,t},decode(e,t){t||=0,t+=2;let n=o.decode(e,t);return be.decode.bytes=18,n},bytes:18}),xe=e=>new Uint8Array(e),R=T({encode(e,t,n){t||=new Uint8Array(R.encodingLength(e)),n||=0;let r=n,i=re(e.code);if(C(t,i,n),n+=2,e.data)C(t,e.data.length,n),n+=2,w(e.data,t,n),n+=e.data.length;else switch(i){case 8:{let r=e.sourcePrefixLength||0,i=e.family||c(e.ip,xe),a=l(e.ip,xe),o=Math.ceil(r/8);C(t,o+4,n),n+=2,C(t,i,n),n+=2,t[n++]=r,t[n++]=e.scopePrefixLength||0,w(a,t,n,0,o),n+=o}break;case 11:e.timeout?(C(t,2,n),n+=2,C(t,e.timeout,n),n+=2):(C(t,0,n),n+=2);break;case 12:{let r=e.length||0;C(t,r,n),n+=2,t.fill(0,n,n+r),n+=r}break;case 14:{let r=e.tags.length*2;C(t,r,n),n+=2;for(let r of e.tags)C(t,r,n),n+=2}break;default:throw Error(`Unknown roption code: ${e.code}`)}return R.encode.bytes=n-r,t},decode(e,t){t||=0;let n={};n.code=x(e,t),n.type=ne(n.code),t+=2;let r=x(e,t);switch(t+=2,n.data=e.slice(t,t+r),n.code){case 8:n.family=x(e,t),t+=2,n.sourcePrefixLength=e[t++],n.scopePrefixLength=e[t++];{let i=new Uint8Array(n.family===1?4:16);w(e,i,0,t,t+r-4),n.ip=u(i)}break;case 11:r>0&&(n.timeout=x(e,t),t+=2);break;case 14:n.tags=[];for(let i=0;i<r;i+=2)n.tags.push(x(e,t)),t+=2}return R.decode.bytes=r+4,n},encodingLength(e){if(e.data)return e.data.length+4;switch(re(e.code)){case 8:{let t=e.sourcePrefixLength||0;return Math.ceil(t/8)+8}case 11:return typeof e.timeout==`number`?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw Error(`Unknown roption code: ${e.code}`)}}),z=T({encode(e,t,n){t||=new Uint8Array(z.encodingLength(e)),n||=0;let r=n,i=X(e,R);return C(t,i,n),n=Z(e,R,t,n+2),z.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r=[],i=x(e,t);t+=2;let a=0;for(;i>0;)r[a++]=R.decode(e,t),t+=R.decode.bytes,i-=R.decode.bytes;return z.decode.bytes=t-n,r},encodingLength(e){return 2+X(e||[],R)}}),B=T({encode(e,t,n){t||=new Uint8Array(B.encodingLength(e)),n||=0;let r=n,i=e.key;if(!v(i))throw Error(`Key must be a Buffer`);return n+=2,C(t,e.flags,n),n+=2,t[n]=B.PROTOCOL_DNSSEC,n+=1,t[n]=e.algorithm,n+=1,w(i,t,n,0,i.length),n+=i.length,B.encode.bytes=n-r,C(t,B.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=x(e,t);if(t+=2,r.flags=x(e,t),t+=2,e[t]!==B.PROTOCOL_DNSSEC)throw Error(`Protocol must be 3`);return t+=1,r.algorithm=e[t],t+=1,r.key=e.slice(t,n+i+2),t+=r.key.length,B.decode.bytes=t-n,r},encodingLength(e){return 6+y(e.key)}});B.PROTOCOL_DNSSEC=3,B.ZONE_KEY=128,B.SECURE_ENTRYPOINT=32768;var V=T({encode(e,t,n){t||=new Uint8Array(V.encodingLength(e)),n||=0;let r=n,i=e.signature;if(!v(i))throw Error(`Signature must be a Buffer`);return n+=2,C(t,f(e.typeCovered),n),n+=2,t[n]=e.algorithm,n+=1,t[n]=e.labels,n+=1,S(t,e.originalTTL,n),n+=4,S(t,e.expiration,n),n+=4,S(t,e.inception,n),n+=4,C(t,e.keyTag,n),n+=2,E.encode(e.signersName,t,n),n+=E.encode.bytes,w(i,t,n,0,i.length),n+=i.length,V.encode.bytes=n-r,C(t,V.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=x(e,t);return t+=2,r.typeCovered=d(x(e,t)),t+=2,r.algorithm=e[t],t+=1,r.labels=e[t],t+=1,r.originalTTL=b(e,t),t+=4,r.expiration=b(e,t),t+=4,r.inception=b(e,t),t+=4,r.keyTag=x(e,t),t+=2,r.signersName=E.decode(e,t),t+=E.decode.bytes,r.signature=e.slice(t,n+i+2),t+=r.signature.length,V.decode.bytes=t-n,r},encodingLength(e){return 20+E.encodingLength(e.signersName)+y(e.signature)}}),H=T({encode(e,t,n){t||=new Uint8Array(H.encodingLength(e)),n||=0;let r=n;return n+=2,E.encode(e.mbox||`.`,t,n),n+=E.encode.bytes,E.encode(e.txt||`.`,t,n),n+=E.encode.bytes,H.encode.bytes=n-r,C(t,H.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.mbox=E.decode(e,t)||`.`,t+=E.decode.bytes,r.txt=E.decode(e,t)||`.`,t+=E.decode.bytes,H.decode.bytes=t-n,r},encodingLength(e){return 2+E.encodingLength(e.mbox||`.`)+E.encodingLength(e.txt||`.`)}}),U=T({encode(e,t,n){t||=new Uint8Array(U.encodingLength(e)),n||=0;let r=n,i=[];for(let t=0;t<e.length;t++){let n=f(e[t]);i[n>>8]===void 0&&(i[n>>8]=[]),i[n>>8][n>>3&31]|=1<<7-(n&7)}for(let e=0;e<i.length;e++)if(i[e]!==void 0){let r=oe(i[e]);t[n]=e,n+=1,t[n]=r.length,n+=1,w(r,t,n,0,r.length),n+=r.length}return U.encode.bytes=n-r,t},decode(e,t,n){t||=0;let r=t,i=[];for(;t-r<n;){let n=e[t];t+=1;let r=e[t];t+=1;for(let a=0;a<r;a++){let r=e[t+a];for(let e=0;e<8;e++)if(r&1<<7-e){let t=d(n<<8|a<<3|e);i.push(t)}}t+=r}return U.decode.bytes=t-r,i},encodingLength(e){let t=[];for(let n=0;n<e.length;n++){let r=f(e[n]);t[r>>8]=Math.max(t[r>>8]||0,r&255)}let n=0;for(let e=0;e<t.length;e++)t[e]!==void 0&&(n+=2+Math.ceil((t[e]+1)/8));return n}}),W=T({encode(e,t,n){t||=new Uint8Array(W.encodingLength(e)),n||=0;let r=n;return n+=2,E.encode(e.nextDomain,t,n),n+=E.encode.bytes,U.encode(e.rrtypes,t,n),n+=U.encode.bytes,W.encode.bytes=n-r,C(t,W.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=x(e,t);return t+=2,r.nextDomain=E.decode(e,t),t+=E.decode.bytes,r.rrtypes=U.decode(e,t,i-(t-n)),t+=U.decode.bytes,W.decode.bytes=t-n,r},encodingLength(e){return 2+E.encodingLength(e.nextDomain)+U.encodingLength(e.rrtypes)}}),G=T({encode(e,t,n){t||=new Uint8Array(G.encodingLength(e)),n||=0;let r=n,i=e.salt;if(!v(i))throw Error(`salt must be a Buffer`);let a=e.nextDomain;if(!v(a))throw Error(`nextDomain must be a Buffer`);return n+=2,t[n]=e.algorithm,n+=1,t[n]=e.flags,n+=1,C(t,e.iterations,n),n+=2,t[n]=i.length,n+=1,w(i,t,n,0,i.length),n+=i.length,t[n]=a.length,n+=1,w(a,t,n,0,a.length),n+=a.length,U.encode(e.rrtypes,t,n),n+=U.encode.bytes,G.encode.bytes=n-r,C(t,G.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=x(e,t);t+=2,r.algorithm=e[t],t+=1,r.flags=e[t],t+=1,r.iterations=x(e,t),t+=2;let a=e[t];t+=1,r.salt=e.slice(t,t+a),t+=a;let o=e[t];return t+=1,r.nextDomain=e.slice(t,t+o),t+=o,r.rrtypes=U.decode(e,t,i-(t-n)),t+=U.decode.bytes,G.decode.bytes=t-n,r},encodingLength(e){return 8+e.salt.length+e.nextDomain.length+U.encodingLength(e.rrtypes)}}),K=T({encode(e,t,n){t||=new Uint8Array(K.encodingLength(e)),n||=0;let r=n,i=e.digest;if(!v(i))throw Error(`Digest must be a Buffer`);return n+=2,C(t,e.keyTag,n),n+=2,t[n]=e.algorithm,n+=1,t[n]=e.digestType,n+=1,w(i,t,n,0,i.length),n+=i.length,K.encode.bytes=n-r,C(t,K.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=x(e,t);return t+=2,r.keyTag=x(e,t),t+=2,r.algorithm=e[t],t+=1,r.digestType=e[t],t+=1,r.digest=e.slice(t,n+i+2),t+=r.digest.length,K.decode.bytes=t-n,r},encodingLength(e){return 6+y(e.digest)}});function Se(e){switch(e.toUpperCase()){case`A`:return ye;case`PTR`:return F;case`CNAME`:return F;case`DNAME`:return F;case`TXT`:return M;case`NULL`:return N;case`AAAA`:return be;case`SRV`:return I;case`HINFO`:return P;case`CAA`:return L;case`NS`:return A;case`SOA`:return j;case`MX`:return ve;case`OPT`:return z;case`DNSKEY`:return B;case`RRSIG`:return V;case`RP`:return H;case`NSEC`:return W;case`NSEC3`:return G;case`DS`:return K}return k}var q=T({encode(e,t,n){t||=new Uint8Array(q.encodingLength(e)),n||=0;let r=n;if(E.encode(e.name,t,n),n+=E.encode.bytes,C(t,f(e.type),n),e.type.toUpperCase()===`OPT`){if(e.name!==`.`)throw Error(`OPT name must be root.`);C(t,e.udpPayloadSize||4096,n+2),t[n+4]=e.extendedRcode||0,t[n+5]=e.ednsVersion||0,C(t,e.flags||0,n+6),n+=8,z.encode(e.options||[],t,n),n+=z.encode.bytes}else{let r=te(e.class===void 0?`IN`:e.class);e.flush&&(r|=me),C(t,r,n+2),S(t,e.ttl||0,n+4),n+=8;let i=Se(e.type);i.encode(e.data,t,n),n+=i.encode.bytes}return q.encode.bytes=n-r,t},decode(e,t){t||=0;let n={},r=t;if(n.name=E.decode(e,t),t+=E.decode.bytes,n.type=d(x(e,t)),n.type===`OPT`)n.udpPayloadSize=x(e,t+2),n.extendedRcode=e[t+4],n.ednsVersion=e[t+5],n.flags=x(e,t+6),n.flag_do=(n.flags>>15&1)==1,n.options=z.decode(e,t+8),t+=8+z.decode.bytes;else{let r=x(e,t+2);n.ttl=b(e,t+4),n.class=m(r&he),n.flush=!!(r&me);let i=Se(n.type);n.data=i.decode(e,t+8),t+=8+i.decode.bytes}return q.decode.bytes=t-r,n},encodingLength(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return E.encodingLength(e.name)+8+Se(e.type).encodingLength(t)}}),J=T({encode(e,t,n){t||=new Uint8Array(J.encodingLength(e)),n||=0;let r=n;return E.encode(e.name,t,n),n+=E.encode.bytes,C(t,f(e.type),n),n+=2,C(t,te(e.class===void 0?`IN`:e.class),n),n+=2,J.encode.bytes=n-r,e},decode(e,t){t||=0;let n=t,r={};return r.name=E.decode(e,t),t+=E.decode.bytes,r.type=d(x(e,t)),t+=2,r.class=m(x(e,t)),t+=2,r.class&ge&&(r.class&=_e),J.decode.bytes=t-n,r},encodingLength(e){return E.encodingLength(e.name)+4}}),Y={encode:function(e,t,n){let r=!t;r&&(t=new Uint8Array(De(e))),n||=0;let i=n;return e.questions||=[],e.answers||=[],e.authorities||=[],e.additionals||=[],O.encode(e,t,n),n+=O.encode.bytes,n=Z(e.questions,J,t,n),n=Z(e.answers,q,t,n),n=Z(e.authorities,q,t,n),n=Z(e.additionals,q,t,n),Y.encode.bytes=n-i,r&&Ee.bytes!==t.length?t.slice(0,Ee.bytes):t},decode:function(e,t){t||=0;let n=t,r=O.decode(e,t);return t+=O.decode.bytes,t=Oe(r.questions,J,e,t),t=Oe(r.answers,q,e,t),t=Oe(r.authorities,q,e,t),t=Oe(r.additionals,q,e,t),Y.decode.bytes=t-n,r},encodingLength:function(e){return O.encodingLength(e)+X(e.questions||[],J)+X(e.answers||[],q)+X(e.authorities||[],q)+X(e.additionals||[],q)}};Y.encode.bytes=0,Y.decode.bytes=0;function Ce(e,t){if(e.questions)throw Error(`Only one .question object expected instead of a .questions array!`);let n=Object.assign({type:t},e);return n.question&&(n.questions=[n.question],delete n.question),n}var we={encode:function(e,t,n){return t=Y.encode(Ce(e,`query`),t,n),we.encode.bytes=Y.encode.bytes,t},decode:function(e,t){let n=Y.decode(e,t);return we.decode.bytes=Y.decode.bytes,n.questions&&(n.question=n.questions[0],delete n.questions),n},encodingLength:function(e){return Y.encodingLength(Ce(e,`query`))}};we.encode.bytes=0,we.decode.bytes=0;var Te={encode:function(e,t,n){return t=Y.encode(Ce(e,`response`),t,n),Te.encode.bytes=Y.encode.bytes,t},decode:function(e,t){let n=Y.decode(e,t);return Te.decode.bytes=Y.decode.bytes,n.questions&&(n.question=n.questions[0],delete n.questions),n},encodingLength:function(e){return Y.encodingLength(Ce(e,`response`))}};Te.encode.bytes=0,Te.decode.bytes=0;var Ee=Y.encode;Y.decode;var De=Y.encodingLength;function X(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t.encodingLength(e[r]);return n}function Z(e,t,n,r){for(let i=0;i<e.length;i++)t.encode(e[i],n,r),r+=t.encode.bytes;return r}function Oe(e,t,n,r){for(let i=0;i<e.length;i++)e[i]=t.decode(n,r),r+=t.decode.bytes;return r}function ke(e,t,n,r){if(t.length!==64)throw Error(`Charset needs to be 64 characters long! (${t.length})`);let i=new Uint8Array(256),a=new Uint8Array(64);for(let e=0;e<64;e+=1){let n=t.charCodeAt(e);if(n>255)throw Error(`Character #${e} in charset [code=${n}, char=${t.charAt(e)}] is too high! (max=255)`);if(i[n]!==0)throw Error(`Character [code=${n}, char=${t.charAt(e)}] is more than once in the charset!`);i[n]=e,a[e]=n}let o=n.charCodeAt(0),s={name:e,encodingLength(e){let t=e.length,n=t*.75|0;return e.charCodeAt(t-1)===o?e.charCodeAt(t-2)===o?n-2:n-1:n},encode(e,t,n){t??=new Uint8Array(s.encodingLength(e)),n??=0;let r=e.length;e.charCodeAt(r-1)===o&&(e.charCodeAt(r-2)===o?r-=2:--r);let a=r%4,c=r-a,l=n,u=0;for(;u<c;){let n=i[e.charCodeAt(u)]<<18|i[e.charCodeAt(u+1)]<<12|i[e.charCodeAt(u+2)]<<6|i[e.charCodeAt(u+3)];t[l++]=n>>16,t[l++]=n>>8,t[l++]=n,u+=4}if(a===3){let n=i[e.charCodeAt(u)]<<10|i[e.charCodeAt(u+1)]<<4|i[e.charCodeAt(u+2)]>>2;t[l++]=n>>8,t[l++]=n}else a===2&&(t[l++]=i[e.charCodeAt(u)]<<2|i[e.charCodeAt(u+1)]>>4);return s.encode.bytes=l-n,t},decode(e,t,n){t??=0,n??=e.length;let i=n-t,c=i%3,l=t+i-c,u=[];for(let n=t;n<l;n+=3){let t=e[n]<<16|e[n+1]<<8|e[n+2];u.push(a[t>>18&63],a[t>>12&63],a[t>>6&63],a[t&63])}if(c===2){let t=(e[n-2]<<8)+e[n-1];u.push(a[t>>10],a[t>>4&63],a[t<<2&63]),r===1&&u.push(o)}else if(c===1){let t=e[n-1];u.push(a[t>>2],a[t<<4&63]),r===1&&u.push(o,o)}return s.decode.bytes=i,String.fromCharCode.apply(String,u)}};return s}ke(`base64`,`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,`=`,1);var Ae=ke(`base64-url`,`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,`=`,2),je=e(((e,t)=>{t.exports={}})),Me=typeof global<`u`?global.AbortError:typeof window<`u`?window.AbortError:null;Me||=class extends Error{constructor(e=`Request aborted.`){super(e)}},Me.prototype.name=`AbortError`,Me.prototype.code=`ABORT_ERR`;var Ne=typeof globalThis<`u`&&globalThis.URL||je().URL,Q=class extends Error{constructor(e,t,n){super(`status=`+t+` while requesting `+e+` [`+n+`]`),this.uri=e,this.status=t,this.method=n}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}};Q.prototype.name=`HTTPStatusError`,Q.prototype.code=`HTTP_STATUS`;var Pe=class extends Error{constructor(e,t){super(e),this.cause=t}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:Re(this.cause)}}};Pe.prototype.name=`ResponseError`,Pe.prototype.code=`RESPONSE_ERR`;var Fe=class extends Error{constructor(e){super(`Timeout (t=`+e+`).`),this.timeout=e}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}};Fe.prototype.name=`TimeoutError`,Fe.prototype.code=`ETIMEOUT`;var Ie=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,Le=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function Re(e){if(typeof e==`string`)return{message:e};try{let t=JSON.stringify(e);if(t!==`{}`)return JSON.parse(t)}catch{}let t={message:String(e.message||e)};return e.code!==void 0&&(t.code=String(e.code)),t}var ze=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,Be=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/gi,Ve=/\[(((pk|name)=([^\]]+)))\]/gi;function He(e){let t=ze.exec(e),n=t[2]||`https:`,r=t[3],i=t[5],a=t[6],o=t[7];if(n===`https:`||n===`http:`){let e=Ue(o,Be);return{name:e.name,protocol:n,ipv4:e.ipv4,ipv6:e.ipv6,host:r,port:i,path:a,method:e.post?`POST`:`GET`}}if(n===`udp:`||n===`udp4:`||n===`udp6:`){let t=Ue(o,Ve),a=/^\[(.*)\]$/.exec(r);if(a&&n===`udp4:`)throw Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${e})`);if(!a&&n===`udp6:`)throw Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${e})`);return a?new Ye({protocol:`udp6:`,ipv6:a[1],port:i,pk:t.pk,name:t.name}):new Je({protocol:`udp4:`,ipv4:r,port:i,pk:t.pk,name:t.name})}throw new We(n,e)}function Ue(e,t){t.lastIndex=0;let n={};for(;;){let r=t.exec(e);if(!r)break;r[2]?n[r[3].toLowerCase()]=r[4]:n[r[1].toLowerCase()]=!0}return n}var We=class extends Error{constructor(e,t){super(`Invalid Endpoint: unsupported protocol "${e}" for endpoint: ${t}, supported protocols: ${Ge.join(`, `)}`),this.protocol=e,this.endpoint=t}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}};We.prototype.name=`InvalidProtocolError`,We.prototype.code=`EPROTOCOL`;var Ge=[`http:`,`https:`,`udp4:`,`udp6:`],Ke=class{constructor(e,t){this.name=e.name||null,this.protocol=e.protocol;let n=typeof e.port==`string`?e.port=parseInt(e.port,10):e.port;if(n==null)this.port=t?this.protocol===`https:`?443:80:e.pk?443:53;else if(typeof n!=`number`&&!isNaN(n))throw Error(`Invalid Endpoint: port "${e.port}" needs to be a number: ${JSON.stringify(e)}`);else this.port=n}toJSON(){return this.toString()}},qe=class extends Ke{constructor(e){super(e,!1),this.pk=e.pk||null}toString(){let e=this.port===(this.pk?443:53)?``:`:${this.port}`,t=this.pk?` [pk=${this.pk}]`:``,n=this.name?` [name=${this.name}]`:``;return`udp://${this.ipv4||`[${this.ipv6}]`}${e}${t}${n}`}},Je=class extends qe{constructor(e){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)}`);this.ipv4=e.ipv4}},Ye=class extends qe{constructor(e){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)}`);this.ipv6=e.ipv6}};function Xe(e){return Le.test(e)&&!Ie.test(e)?`[${e}]`:e}var Ze=class extends Ke{constructor(e){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)}`);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){let e=Le.exec(this.host);e&&(this.ipv6=e[1])}this.ipv4||Ie.test(this.host)&&(this.ipv4=this.host);let t=`${this.protocol}//${Xe(this.host)}:${this.port}${this.path}`;try{this.url=new Ne(t)}catch(e){throw Error(e.message+` [${t}]`)}}toString(){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}]`:``;return`${e}${Xe(this.host)}${t}${r}${n}${a}${o}${i}`}};function Qe(e){let t;if(typeof e==`string`)t=He(e);else{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Can not convert ${e} to an endpoint`);if(e instanceof Ke)return e;t=e}(t.protocol===null||t.protocol===void 0)&&(t.protocol=`https:`);let n=t.protocol;if(n===`udp4:`)return new Je(t);if(n===`udp6:`)return new Ye(t);if(n===`https:`||n===`http:`)return new Ze(t);throw new We(n,JSON.stringify(t))}var $e=`application/dns-message`;function et(){}async function tt(e,t,n,r){let i=t?t.localStoragePrefix+t.name:null;if(i)try{let e=JSON.parse(localStorage.getItem(i));if(e&&e.time>t.maxTime)return e}catch{}let{data:a}=await nt(e,`GET`,null,n,r),o={time:Date.now(),data:JSON.parse(_(a))};if(i)try{localStorage.setItem(i,JSON.stringify(o))}catch{o.time=null}return o}function nt(e,t,n,r,i){return new Promise((a,o)=>{let s=new Ne(e);t===`GET`&&n&&(s.search=`?dns=`+Ae.decode(n));let c=s.toString(),l=new XMLHttpRequest;l.open(t,c,!0),l.setRequestHeader(`Accept`,$e),t===`POST`&&l.setRequestHeader(`Content-Type`,$e),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`,m);function u(){p(new Fe(r));try{l.abort()}catch{}}function d(){if(l.status!==200)p(new Q(c,l.status,t));else{let e;if(typeof l.response==`string`)e=g(l.response);else if(l.response instanceof Uint8Array)e=l.response;else if(Array.isArray(l.response)||l.response instanceof ArrayBuffer)e=new Uint8Array(l.response);else throw Error(`Unprocessable response `+l.response);p(null,e)}}function f(){if(l.readyState>1&&l.status!==200&&l.status!==0){p(new Q(c,l.status,t));try{l.abort()}catch{}}}let p=function(e,t){p=et,i&&i.removeEventListener(`abort`,m),a(e?{error:e,response:l}:{data:t,response:l})};function ee(){p(l.status===200?Error(`Inexplicable XHR Error`):new Q(c,l.status,t))}function m(){p(new Me);try{l.abort()}catch{}}})}function rt(e){return e.filter(e=>e.cors||e.endpoint.cors)}var it={data:[{name:`adfree.usableprivacy.net`,endpoint:{protocol:`https:`,host:`adfree.usableprivacy.net`},description:`Public updns DoH service with advertising, tracker and malware filters.
|
|
1
|
+
(function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),t=/^(\d{1,3}\.){3,3}\d{1,3}$/,n=4,r=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,a={name:`v4`,size:n,isFormat:e=>t.test(e),encode(e,t,r){r=~~r,t||=new Uint8Array(r+n);let i=e.length,a=0;for(let n=0;n<i;){let i=e.charCodeAt(n++);i===46?(t[r++]=a,a=0):a=a*10+(i-48)}return t[r]=a,t},decode(e,t){return t=~~t,`${e[t++]}.${e[t++]}.${e[t++]}.${e[t]}`}},o={name:`v6`,size:i,isFormat:e=>e.length>0&&r.test(e),encode(e,t,n){n=~~n;let r=n+i,a=-1,o=0,s=0,c=!0,l=!1;t||=new Uint8Array(n+i);for(let i=0;i<e.length;i++){let u=e.charCodeAt(i);u===58?(c?a===-1?n<r&&(a=n):(n<r&&(t[n]=0),n<r-1&&(t[n+1]=0),n+=2):(l===!0?(n<r&&(t[n]=s),n++):(n<r&&(t[n]=o>>8),n<r-1&&(t[n+1]=o&255),n+=2),o=0,s=0),c=!0,l=!1):u===46?(n<r&&(t[n]=s),n++,s=0,o=0,c=!1,l=!0):(c=!1,u>=97?u-=87:u>=65?u-=55:(u-=48,s=s*10+u),o=(o<<4)+u)}if(c===!1)l===!0?(n<r&&(t[n]=s),n++):(n<r&&(t[n]=o>>8),n<r-1&&(t[n+1]=o&255),n+=2);else if(a===0)n<r&&(t[n]=0),n<r-1&&(t[n+1]=0),n+=2;else if(a!==-1){n+=2;for(let e=Math.min(n-1,r-1);e>=a+2;e--)t[e]=t[e-2];t[a]=0,t[a+1]=0,a=n}if(a!==n&&a!==-1)for(n>r-2&&(n=r-2);r>a;)t[--r]=n<r&&n>a?t[--n]:0;else for(;n<r;)t[n++]=0;return t},decode(e,t){t=~~t;let n=``;for(let r=0;r<i;r+=2)r!==0&&(n+=`:`),n+=(e[t+r]<<8|e[t+r+1]).toString(16);return n.replace(/(^|:)0(:0)*:0(:|$)/,`$1::$3`).replace(/:{3,4}/,`::`)}};function s(e){if(a.isFormat(e))return a.size;if(o.isFormat(e))return o.size;throw Error(`Invalid ip address: ${e}`)}function c(e){return s(e)===a.size?1:2}function l(e,t,n){n=~~n;let r=s(e);return typeof t==`function`&&(t=t(n+r)),r===a.size?a.encode(e,t,n):o.encode(e,t,n)}function u(e,t,n){if(t=~~t,n||=e.length-t,n===a.size)return a.decode(e,t,n);if(n===o.size)return o.decode(e,t,n);throw Error(`Invalid buffer size needs to be ${a.size} for v4 or ${o.size} for v6.`)}function d(e){switch(e){case 1:return`A`;case 10:return`NULL`;case 28:return`AAAA`;case 18:return`AFSDB`;case 42:return`APL`;case 257:return`CAA`;case 60:return`CDNSKEY`;case 59:return`CDS`;case 37:return`CERT`;case 5:return`CNAME`;case 49:return`DHCID`;case 32769:return`DLV`;case 39:return`DNAME`;case 48:return`DNSKEY`;case 43:return`DS`;case 55:return`HIP`;case 13:return`HINFO`;case 45:return`IPSECKEY`;case 25:return`KEY`;case 36:return`KX`;case 29:return`LOC`;case 15:return`MX`;case 35:return`NAPTR`;case 2:return`NS`;case 47:return`NSEC`;case 50:return`NSEC3`;case 51:return`NSEC3PARAM`;case 12:return`PTR`;case 46:return`RRSIG`;case 17:return`RP`;case 24:return`SIG`;case 6:return`SOA`;case 99:return`SPF`;case 33:return`SRV`;case 44:return`SSHFP`;case 32768:return`TA`;case 249:return`TKEY`;case 52:return`TLSA`;case 250:return`TSIG`;case 16:return`TXT`;case 252:return`AXFR`;case 251:return`IXFR`;case 41:return`OPT`;case 255:return`ANY`}return`UNKNOWN_`+e}function f(e){switch(e.toUpperCase()){case`A`:return 1;case`NULL`:return 10;case`AAAA`:return 28;case`AFSDB`:return 18;case`APL`:return 42;case`CAA`:return 257;case`CDNSKEY`:return 60;case`CDS`:return 59;case`CERT`:return 37;case`CNAME`:return 5;case`DHCID`:return 49;case`DLV`:return 32769;case`DNAME`:return 39;case`DNSKEY`:return 48;case`DS`:return 43;case`HIP`:return 55;case`HINFO`:return 13;case`IPSECKEY`:return 45;case`KEY`:return 25;case`KX`:return 36;case`LOC`:return 29;case`MX`:return 15;case`NAPTR`:return 35;case`NS`:return 2;case`NSEC`:return 47;case`NSEC3`:return 50;case`NSEC3PARAM`:return 51;case`PTR`:return 12;case`RRSIG`:return 46;case`RP`:return 17;case`SIG`:return 24;case`SOA`:return 6;case`SPF`:return 99;case`SRV`:return 33;case`SSHFP`:return 44;case`TA`:return 32768;case`TKEY`:return 249;case`TLSA`:return 52;case`TSIG`:return 250;case`TXT`:return 16;case`AXFR`:return 252;case`IXFR`:return 251;case`OPT`:return 41;case`ANY`:return 255;case`*`:return 255}return e.toUpperCase().startsWith(`UNKNOWN_`)?parseInt(e.slice(8)):0}function p(e){switch(e){case 0:return`NOERROR`;case 1:return`FORMERR`;case 2:return`SERVFAIL`;case 3:return`NXDOMAIN`;case 4:return`NOTIMP`;case 5:return`REFUSED`;case 6:return`YXDOMAIN`;case 7:return`YXRRSET`;case 8:return`NXRRSET`;case 9:return`NOTAUTH`;case 10:return`NOTZONE`;case 11:return`RCODE_11`;case 12:return`RCODE_12`;case 13:return`RCODE_13`;case 14:return`RCODE_14`;case 15:return`RCODE_15`}return`RCODE_`+e}function ee(e){switch(e){case 0:return`QUERY`;case 1:return`IQUERY`;case 2:return`STATUS`;case 3:return`OPCODE_3`;case 4:return`NOTIFY`;case 5:return`UPDATE`;case 6:return`OPCODE_6`;case 7:return`OPCODE_7`;case 8:return`OPCODE_8`;case 9:return`OPCODE_9`;case 10:return`OPCODE_10`;case 11:return`OPCODE_11`;case 12:return`OPCODE_12`;case 13:return`OPCODE_13`;case 14:return`OPCODE_14`;case 15:return`OPCODE_15`}return`OPCODE_`+e}function te(e){switch(e){case 1:return`IN`;case 2:return`CS`;case 3:return`CH`;case 4:return`HS`;case 255:return`ANY`}return`UNKNOWN_`+e}function ne(e){switch(e.toUpperCase()){case`IN`:return 1;case`CS`:return 2;case`CH`:return 3;case`HS`:return 4;case`ANY`:return 255}return 0}function re(e){switch(e){case 1:return`LLQ`;case 2:return`UL`;case 3:return`NSID`;case 5:return`DAU`;case 6:return`DHU`;case 7:return`N3U`;case 8:return`CLIENT_SUBNET`;case 9:return`EXPIRE`;case 10:return`COOKIE`;case 11:return`TCP_KEEPALIVE`;case 12:return`PADDING`;case 13:return`CHAIN`;case 14:return`KEY_TAG`;case 26946:return`DEVICEID`}return e<0?null:`OPTION_${e}`}function ie(e){if(typeof e==`number`)return e;if(!e)return-1;switch(e.toUpperCase()){case`OPTION_0`:return 0;case`LLQ`:return 1;case`UL`:return 2;case`NSID`:return 3;case`OPTION_4`:return 4;case`DAU`:return 5;case`DHU`:return 6;case`N3U`:return 7;case`CLIENT_SUBNET`:return 8;case`EXPIRE`:return 9;case`COOKIE`:return 10;case`TCP_KEEPALIVE`:return 11;case`PADDING`:return 12;case`CHAIN`:return 13;case`KEY_TAG`:return 14;case`DEVICEID`:return 26946;case`OPTION_65535`:return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}var ae=55296,m=56320;function oe(e){let t=0,n=e.length;for(let r=0;r<n;r+=1){let i=e.charCodeAt(r);if(i<=127)t+=1;else if(i<=2047)t+=2;else if((i&63488)!==ae)t+=3;else{let a=r+1;a===n||i>=m?t+=3:(e.charCodeAt(a)&64512)===m?(r=a,t+=4):t+=3}}return t}function h(e,t,n){let r=e.length;n??=0,t===void 0&&(t=new Uint8Array(oe(e)+n));let i=n;for(let n=0;n<r;n+=1){let a=e.charCodeAt(n);if(a<=127)t[i++]=a;else if(a<=2047)t[i++]=192|(a&1984)>>6,t[i++]=128|a&63;else if((a&63488)!==ae)t[i++]=224|(a&61440)>>12,t[i++]=128|(a&4032)>>6,t[i++]=128|a&63;else{let o=n+1;if(o===r||a>=m)t[i++]=239,t[i++]=191,t[i++]=189;else{let r=e.charCodeAt(o);(r&64512)===m?(n=o,a=65536|(a&1023)<<10|r&1023,t[i++]=240|(a&1835008)>>18,t[i++]=128|(a&258048)>>12,t[i++]=128|(a&4032)>>6,t[i++]=128|a&63):(t[i++]=239,t[i++]=191,t[i++]=189)}}}return h.bytes=i-n,t}h.bytes=0;function g(e,t,n){let r=``;t??=0,n??=e.length;for(let i=t;i<n;){let t=e[i++],n;if(t<=128)n=t;else if(t>191&&t<224)n=(t&31)<<6|e[i++]&63;else if(t>239&&t<365){n=((t&7)<<18|(e[i++]&63)<<12|(e[i++]&63)<<6|e[i++]&63)-65536;let a=ae|n>>10&1023;r+=String.fromCharCode(a),n=m|n&1023}else n=(t&15)<<12|(e[i++]&63)<<6|e[i++]&63;r+=String.fromCharCode(n)}return g.bytes=n-t,r}g.bytes=0;var _=e=>e instanceof Uint8Array;function v(e){return typeof e==`string`?oe(e):e.byteLength}function se(e){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):h(e)}function ce(e,t,n){if(typeof t!=`string`)throw Error(`unknown input type`);return h(t,e,n),h.bytes}var le=2**24,ue=2**16,de=256,y=(e,t)=>e[t]*le+e[t+1]*ue+e[t+2]*de+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);function C(e,t,n,r,i){return n<0&&(r-=n,n=0),r<0&&(r=0),i<0?new Uint8Array:n>=t.length||r>=i?0:fe(e,t,n,r,i)}function fe(e,t,n,r,i){i-r>t.length-n&&(i=r+t.length-n);let a=i-r,o=e.length-r;return a>o&&(a=o),(r!==0||i<e.length)&&(e=new Uint8Array(e.buffer,e.byteOffset+r,a)),t.set(e,n),a}var pe=0,me=32768,he=32768,ge=-32769,_e=32768,ve=-32769;function w({bytes:e=0,encode:t,decode:n,encodingLength:r}){return t.bytes=e,n.bytes=e,{encode:t,decode:n,encodingLength:r||(()=>e)}}var T=w({encode(e,t,n){t||=new Uint8Array(T.encodingLength(e)),n||=0;let r=n,i=e.replace(/^\.|\.$/gm,``);if(i.length){let e=i.split(`.`);for(let r=0;r<e.length;r++){let i=ce(t,e[r],n+1);t[n]=i,n+=i+1}}return t[n++]=0,T.encode.bytes=n-r,t},decode(e,t){t||=0;let n=[],r=t,i=0,a=0,o=!1;for(;;){if(t>=e.length)throw Error(`Cannot decode name (buffer overflow)`);let s=e[t++];if(a+=+!o,s===0)break;if(!(s&192)){if(t+s>e.length)throw Error(`Cannot decode name (buffer overflow)`);if(i+=s+1,i>254)throw Error(`Cannot decode name (name too long)`);n.push(g(e,t,t+s)),t+=s,a+=o?0:s}else if((s&192)==192){if(t+1>e.length)throw Error(`Cannot decode name (buffer overflow)`);let n=b(e,t-1)-49152;if(n>=r)throw Error(`Cannot decode name (bad pointer)`);t=n,r=n,a+=+!o,o=!0}else throw Error(`Cannot decode name (bad label)`)}return T.decode.bytes=a,n.length===0?`.`:n.join(`.`)},encodingLength(e){return e===`.`||e===`..`?1:v(e.replace(/^\.|\.$/gm,``))+2}}),E=w({encode(e,t,n){t||=new Uint8Array(E.encodingLength(e)),n||=0;let r=ce(t,e,n+1);return t[n]=r,E.encode.bytes=r+1,t},decode(e,t){t||=0;let n=e[t],r=g(e,t+1,t+1+n);return E.decode.bytes=n+1,r},encodingLength(e){return v(e)+1}}),D=w({bytes:12,encode(e,t,n){t||=new Uint8Array(D.encodingLength(e)),n||=0;let r=(e.flags||0)&32767,i=e.type===`response`?me:pe;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},decode(e,t){if(t||=0,e.length<12)throw Error(`Header must be 12 bytes`);let n=b(e,t+2);return{id:b(e,t),type:n&me?`response`:`query`,flags:n&32767,flag_qr:(n>>15&1)==1,opcode:ee(n>>11&15),flag_aa:(n>>10&1)==1,flag_tc:(n>>9&1)==1,flag_rd:(n>>8&1)==1,flag_ra:(n>>7&1)==1,flag_z:(n>>6&1)==1,flag_ad:(n>>5&1)==1,flag_cd:(n>>4&1)==1,rcode:p(n&15),questions:Array(b(e,t+4)),answers:Array(b(e,t+6)),authorities:Array(b(e,t+8)),additionals:Array(b(e,t+10))}},encodingLength(){return 12}}),O=w({encode(e,t,n){t||=new Uint8Array(O.encodingLength(e)),n||=0;let r=e.length;return S(t,r,n),C(e,t,n+2,0,r),O.encode.bytes=r+2,t},decode(e,t){t||=0;let n=b(e,t),r=e.slice(t+2,t+2+n);return O.decode.bytes=n+2,r},encodingLength(e){return e.length+2}}),k=w({encode(e,t,n){return t||=new Uint8Array(k.encodingLength(e)),n||=0,T.encode(e,t,n+2),S(t,T.encode.bytes,n),k.encode.bytes=T.encode.bytes+2,t},decode(e,t){t||=0;let n=b(e,t),r=T.decode(e,t+2);return k.decode.bytes=n+2,r},encodingLength(e){return T.encodingLength(e)+2}}),ye=w({encode(e,t,n){t||=new Uint8Array(ye.encodingLength(e)),n||=0;let r=n;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),ye.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r={};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,ye.decode.bytes=t-n,r},encodingLength(e){return 22+T.encodingLength(e.mname)+T.encodingLength(e.rname)}}),be=w({encode(e,t,n){Array.isArray(e)||(e=[e]);for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&(e[t]=se(e[t])),!_(e[t]))throw Error(`Must be a Buffer`);t||=new Uint8Array(be.encodingLength(e)),n||=0;let r=n;return n+=2,e.forEach(function(e){t[n++]=e.length,C(e,t,n,0,e.length),n+=e.length}),S(t,n-r-2,r),be.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r=b(e,t);t+=2;let i=[];for(;r>0;){let n=e[t++];if(--r,r<n)throw Error(`Buffer overflow`);i.push(e.slice(t,t+n)),t+=n,r-=n}return be.decode.bytes=t-n,i},encodingLength(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(e){t+=typeof e==`string`?v(e)+1:e.length+1}),t}}),A=w({encode(e,t,n){t||=new Uint8Array(A.encodingLength(e)),n||=0,typeof e==`string`&&(e=se(e)),e||=new Uint8Array;let r=n;n+=2;let i=e.length;return C(e,t,n,0,i),n+=i,S(t,n-r-2,r),A.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r=b(e,t);t+=2;let i=e.slice(t,t+r);return t+=r,A.decode.bytes=t-n,i},encodingLength(e){return e?(_(e)?e.length:v(e))+2:2}}),j=w({encode(e,t,n){t||=new Uint8Array(j.encodingLength(e)),n||=0;let r=n;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),j.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.cpu=E.decode(e,t),t+=E.decode.bytes,r.os=E.decode(e,t),t+=E.decode.bytes,j.decode.bytes=t-n,r},encodingLength(e){return E.encodingLength(e.cpu)+E.encodingLength(e.os)+2}}),M=w({encode(e,t,n){return t||=new Uint8Array(M.encodingLength(e)),n||=0,T.encode(e,t,n+2),S(t,T.encode.bytes,n),M.encode.bytes=T.encode.bytes+2,t},decode(e,t){t||=0;let n=T.decode(e,t+2);return M.decode.bytes=T.decode.bytes+2,n},encodingLength(e){return T.encodingLength(e)+2}}),N=w({encode(e,t,n){t||=new Uint8Array(N.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);let r=T.encode.bytes+6;return S(t,r,n),N.encode.bytes=r+2,t},decode(e,t){t||=0;let n=b(e,t),r={};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),N.decode.bytes=n+2,r},encodingLength(e){return 8+T.encodingLength(e.target)}}),P=w({encode(e,t,n){let r=P.encodingLength(e);return t||=new Uint8Array(P.encodingLength(e)),n||=0,e.issuerCritical&&(e.flags=P.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,ce(t,e.value,n),n+=v(e.value),P.encode.bytes=r,t},decode(e,t){t||=0;let n=b(e,t);t+=2;let r=t,i={};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&P.ISSUER_CRITICAL),P.decode.bytes=n+2,i},encodingLength(e){return E.encodingLength(e.tag)+E.encodingLength(e.value)+2}});P.ISSUER_CRITICAL=128;var F=w({encode(e,t,n){t||=new Uint8Array(F.encodingLength(e)),n||=0;let r=n;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),F.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.preference=b(e,t),t+=2,r.exchange=T.decode(e,t),t+=T.decode.bytes,F.decode.bytes=t-n,r},encodingLength(e){return 4+T.encodingLength(e.exchange)}}),xe=w({encode(e,t,n){return t||=new Uint8Array(xe.encodingLength(e)),n||=0,S(t,4,n),n+=2,a.encode(e,t,n),t},decode(e,t){return t||=0,t+=2,a.decode(e,t)},bytes:6}),I=w({encode(e,t,n){return t||=new Uint8Array(I.encodingLength(e)),n||=0,S(t,16,n),n+=2,o.encode(e,t,n),I.encode.bytes=18,t},decode(e,t){t||=0,t+=2;let n=o.decode(e,t);return I.decode.bytes=18,n},bytes:18}),Se=e=>new Uint8Array(e),L=w({encode(e,t,n){t||=new Uint8Array(L.encodingLength(e)),n||=0;let r=n,i=ie(e.code);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;else switch(i){case 8:{let r=e.sourcePrefixLength||0,i=e.family||c(e.ip,Se),a=l(e.ip,Se),o=Math.ceil(r/8);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}break;case 11:e.timeout?(S(t,2,n),n+=2,S(t,e.timeout,n),n+=2):(S(t,0,n),n+=2);break;case 12:{let r=e.length||0;S(t,r,n),n+=2,t.fill(0,n,n+r),n+=r}break;case 14:{let r=e.tags.length*2;S(t,r,n),n+=2;for(let r of e.tags)S(t,r,n),n+=2}break;default:throw Error(`Unknown roption code: ${e.code}`)}return L.encode.bytes=n-r,t},decode(e,t){t||=0;let n={};n.code=b(e,t),n.type=re(n.code),t+=2;let r=b(e,t);switch(t+=2,n.data=e.slice(t,t+r),n.code){case 8:n.family=b(e,t),t+=2,n.sourcePrefixLength=e[t++],n.scopePrefixLength=e[t++];{let i=new Uint8Array(n.family===1?4:16);C(e,i,0,t,t+r-4),n.ip=u(i)}break;case 11:r>0&&(n.timeout=b(e,t),t+=2);break;case 14:n.tags=[];for(let i=0;i<r;i+=2)n.tags.push(b(e,t)),t+=2}return L.decode.bytes=r+4,n},encodingLength(e){if(e.data)return e.data.length+4;switch(ie(e.code)){case 8:{let t=e.sourcePrefixLength||0;return Math.ceil(t/8)+8}case 11:return typeof e.timeout==`number`?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw Error(`Unknown roption code: ${e.code}`)}}),R=w({encode(e,t,n){t||=new Uint8Array(R.encodingLength(e)),n||=0;let r=n,i=Z(e,L);return S(t,i,n),n=Q(e,L,t,n+2),R.encode.bytes=n-r,t},decode(e,t){t||=0;let n=t,r=[],i=b(e,t);t+=2;let a=0;for(;i>0;)r[a++]=L.decode(e,t),t+=L.decode.bytes,i-=L.decode.bytes;return R.decode.bytes=t-n,r},encodingLength(e){return 2+Z(e||[],L)}}),z=w({encode(e,t,n){t||=new Uint8Array(z.encodingLength(e)),n||=0;let r=n,i=e.key;if(!_(i))throw Error(`Key must be a Buffer`);return n+=2,S(t,e.flags,n),n+=2,t[n]=z.PROTOCOL_DNSSEC,n+=1,t[n]=e.algorithm,n+=1,C(i,t,n,0,i.length),n+=i.length,z.encode.bytes=n-r,S(t,z.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=b(e,t);if(t+=2,r.flags=b(e,t),t+=2,e[t]!==z.PROTOCOL_DNSSEC)throw Error(`Protocol must be 3`);return t+=1,r.algorithm=e[t],t+=1,r.key=e.slice(t,n+i+2),t+=r.key.length,z.decode.bytes=t-n,r},encodingLength(e){return 6+v(e.key)}});z.PROTOCOL_DNSSEC=3,z.ZONE_KEY=128,z.SECURE_ENTRYPOINT=32768;var B=w({encode(e,t,n){t||=new Uint8Array(B.encodingLength(e)),n||=0;let r=n,i=e.signature;if(!_(i))throw Error(`Signature must be a Buffer`);return n+=2,S(t,f(e.typeCovered),n),n+=2,t[n]=e.algorithm,n+=1,t[n]=e.labels,n+=1,x(t,e.originalTTL,n),n+=4,x(t,e.expiration,n),n+=4,x(t,e.inception,n),n+=4,S(t,e.keyTag,n),n+=2,T.encode(e.signersName,t,n),n+=T.encode.bytes,C(i,t,n,0,i.length),n+=i.length,B.encode.bytes=n-r,S(t,B.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=b(e,t);return t+=2,r.typeCovered=d(b(e,t)),t+=2,r.algorithm=e[t],t+=1,r.labels=e[t],t+=1,r.originalTTL=y(e,t),t+=4,r.expiration=y(e,t),t+=4,r.inception=y(e,t),t+=4,r.keyTag=b(e,t),t+=2,r.signersName=T.decode(e,t),t+=T.decode.bytes,r.signature=e.slice(t,n+i+2),t+=r.signature.length,B.decode.bytes=t-n,r},encodingLength(e){return 20+T.encodingLength(e.signersName)+v(e.signature)}}),V=w({encode(e,t,n){t||=new Uint8Array(V.encodingLength(e)),n||=0;let r=n;return n+=2,T.encode(e.mbox||`.`,t,n),n+=T.encode.bytes,T.encode(e.txt||`.`,t,n),n+=T.encode.bytes,V.encode.bytes=n-r,S(t,V.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={};return t+=2,r.mbox=T.decode(e,t)||`.`,t+=T.decode.bytes,r.txt=T.decode(e,t)||`.`,t+=T.decode.bytes,V.decode.bytes=t-n,r},encodingLength(e){return 2+T.encodingLength(e.mbox||`.`)+T.encodingLength(e.txt||`.`)}}),H=w({encode(e,t,n){t||=new Uint8Array(H.encodingLength(e)),n||=0;let r=n,i=[];for(let t=0;t<e.length;t++){let n=f(e[t]);i[n>>8]===void 0&&(i[n>>8]=[]),i[n>>8][n>>3&31]|=1<<7-(n&7)}for(let e=0;e<i.length;e++)if(i[e]!==void 0){let r=se(i[e]);t[n]=e,n+=1,t[n]=r.length,n+=1,C(r,t,n,0,r.length),n+=r.length}return H.encode.bytes=n-r,t},decode(e,t,n){t||=0;let r=t,i=[];for(;t-r<n;){let n=e[t];t+=1;let r=e[t];t+=1;for(let a=0;a<r;a++){let r=e[t+a];for(let e=0;e<8;e++)if(r&1<<7-e){let t=d(n<<8|a<<3|e);i.push(t)}}t+=r}return H.decode.bytes=t-r,i},encodingLength(e){let t=[];for(let n=0;n<e.length;n++){let r=f(e[n]);t[r>>8]=Math.max(t[r>>8]||0,r&255)}let n=0;for(let e=0;e<t.length;e++)t[e]!==void 0&&(n+=2+Math.ceil((t[e]+1)/8));return n}}),U=w({encode(e,t,n){t||=new Uint8Array(U.encodingLength(e)),n||=0;let r=n;return n+=2,T.encode(e.nextDomain,t,n),n+=T.encode.bytes,H.encode(e.rrtypes,t,n),n+=H.encode.bytes,U.encode.bytes=n-r,S(t,U.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=b(e,t);return t+=2,r.nextDomain=T.decode(e,t),t+=T.decode.bytes,r.rrtypes=H.decode(e,t,i-(t-n)),t+=H.decode.bytes,U.decode.bytes=t-n,r},encodingLength(e){return 2+T.encodingLength(e.nextDomain)+H.encodingLength(e.rrtypes)}}),W=w({encode(e,t,n){t||=new Uint8Array(W.encodingLength(e)),n||=0;let r=n,i=e.salt;if(!_(i))throw Error(`salt must be a Buffer`);let a=e.nextDomain;if(!_(a))throw Error(`nextDomain must be a Buffer`);return n+=2,t[n]=e.algorithm,n+=1,t[n]=e.flags,n+=1,S(t,e.iterations,n),n+=2,t[n]=i.length,n+=1,C(i,t,n,0,i.length),n+=i.length,t[n]=a.length,n+=1,C(a,t,n,0,a.length),n+=a.length,H.encode(e.rrtypes,t,n),n+=H.encode.bytes,W.encode.bytes=n-r,S(t,W.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=b(e,t);t+=2,r.algorithm=e[t],t+=1,r.flags=e[t],t+=1,r.iterations=b(e,t),t+=2;let a=e[t];t+=1,r.salt=e.slice(t,t+a),t+=a;let o=e[t];return t+=1,r.nextDomain=e.slice(t,t+o),t+=o,r.rrtypes=H.decode(e,t,i-(t-n)),t+=H.decode.bytes,W.decode.bytes=t-n,r},encodingLength(e){return 8+e.salt.length+e.nextDomain.length+H.encodingLength(e.rrtypes)}}),G=w({encode(e,t,n){t||=new Uint8Array(G.encodingLength(e)),n||=0;let r=n,i=e.digest;if(!_(i))throw Error(`Digest must be a Buffer`);return n+=2,S(t,e.keyTag,n),n+=2,t[n]=e.algorithm,n+=1,t[n]=e.digestType,n+=1,C(i,t,n,0,i.length),n+=i.length,G.encode.bytes=n-r,S(t,G.encode.bytes-2,r),t},decode(e,t){t||=0;let n=t,r={},i=b(e,t);return t+=2,r.keyTag=b(e,t),t+=2,r.algorithm=e[t],t+=1,r.digestType=e[t],t+=1,r.digest=e.slice(t,n+i+2),t+=r.digest.length,G.decode.bytes=t-n,r},encodingLength(e){return 6+v(e.digest)}});function Ce(e){switch(e.toUpperCase()){case`A`:return xe;case`PTR`:return M;case`CNAME`:return M;case`DNAME`:return M;case`TXT`:return be;case`NULL`:return A;case`AAAA`:return I;case`SRV`:return N;case`HINFO`:return j;case`CAA`:return P;case`NS`:return k;case`SOA`:return ye;case`MX`:return F;case`OPT`:return R;case`DNSKEY`:return z;case`RRSIG`:return B;case`RP`:return V;case`NSEC`:return U;case`NSEC3`:return W;case`DS`:return G}return O}var K=w({encode(e,t,n){t||=new Uint8Array(K.encodingLength(e)),n||=0;let r=n;if(T.encode(e.name,t,n),n+=T.encode.bytes,S(t,f(e.type),n),e.type.toUpperCase()===`OPT`){if(e.name!==`.`)throw Error(`OPT name must be root.`);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}else{let r=ne(e.class===void 0?`IN`:e.class);e.flush&&(r|=he),S(t,r,n+2),x(t,e.ttl||0,n+4),n+=8;let i=Ce(e.type);i.encode(e.data,t,n),n+=i.encode.bytes}return K.encode.bytes=n-r,t},decode(e,t){t||=0;let n={},r=t;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;else{let r=b(e,t+2);n.ttl=y(e,t+4),n.class=te(r&ge),n.flush=!!(r&he);let i=Ce(n.type);n.data=i.decode(e,t+8),t+=8+i.decode.bytes}return K.decode.bytes=t-r,n},encodingLength(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return T.encodingLength(e.name)+8+Ce(e.type).encodingLength(t)}}),q=w({encode(e,t,n){t||=new Uint8Array(q.encodingLength(e)),n||=0;let r=n;return T.encode(e.name,t,n),n+=T.encode.bytes,S(t,f(e.type),n),n+=2,S(t,ne(e.class===void 0?`IN`:e.class),n),n+=2,q.encode.bytes=n-r,e},decode(e,t){t||=0;let n=t,r={};return r.name=T.decode(e,t),t+=T.decode.bytes,r.type=d(b(e,t)),t+=2,r.class=te(b(e,t)),t+=2,r.class&_e&&(r.class&=ve),q.decode.bytes=t-n,r},encodingLength(e){return T.encodingLength(e.name)+4}}),J={encode:function(e,t,n){let r=!t;r&&(t=new Uint8Array(Ee(e))),n||=0;let i=n;return e.questions||=[],e.answers||=[],e.authorities||=[],e.additionals||=[],D.encode(e,t,n),n+=D.encode.bytes,n=Q(e.questions,q,t,n),n=Q(e.answers,K,t,n),n=Q(e.authorities,K,t,n),n=Q(e.additionals,K,t,n),J.encode.bytes=n-i,r&&Te.bytes!==t.length?t.slice(0,Te.bytes):t},decode:function(e,t){t||=0;let n=t,r=D.decode(e,t);return t+=D.decode.bytes,t=De(r.questions,q,e,t),t=De(r.answers,K,e,t),t=De(r.authorities,K,e,t),t=De(r.additionals,K,e,t),J.decode.bytes=t-n,r},encodingLength:function(e){return D.encodingLength(e)+Z(e.questions||[],q)+Z(e.answers||[],K)+Z(e.authorities||[],K)+Z(e.additionals||[],K)}};J.encode.bytes=0,J.decode.bytes=0;function Y(e,t){if(e.questions)throw Error(`Only one .question object expected instead of a .questions array!`);let n=Object.assign({type:t},e);return n.question&&(n.questions=[n.question],delete n.question),n}var X={encode:function(e,t,n){return t=J.encode(Y(e,`query`),t,n),X.encode.bytes=J.encode.bytes,t},decode:function(e,t){let n=J.decode(e,t);return X.decode.bytes=J.decode.bytes,n.questions&&(n.question=n.questions[0],delete n.questions),n},encodingLength:function(e){return J.encodingLength(Y(e,`query`))}};X.encode.bytes=0,X.decode.bytes=0;var we={encode:function(e,t,n){return t=J.encode(Y(e,`response`),t,n),we.encode.bytes=J.encode.bytes,t},decode:function(e,t){let n=J.decode(e,t);return we.decode.bytes=J.decode.bytes,n.questions&&(n.question=n.questions[0],delete n.questions),n},encodingLength:function(e){return J.encodingLength(Y(e,`response`))}};we.encode.bytes=0,we.decode.bytes=0;var Te=J.encode;J.decode;var Ee=J.encodingLength;function Z(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t.encodingLength(e[r]);return n}function Q(e,t,n,r){for(let i=0;i<e.length;i++)t.encode(e[i],n,r),r+=t.encode.bytes;return r}function De(e,t,n,r){for(let i=0;i<e.length;i++)e[i]=t.decode(n,r),r+=t.decode.bytes;return r}function Oe(e,t,n,r){if(t.length!==64)throw Error(`Charset needs to be 64 characters long! (${t.length})`);let i=new Uint8Array(256),a=new Uint8Array(64);for(let e=0;e<64;e+=1){let n=t.charCodeAt(e);if(n>255)throw Error(`Character #${e} in charset [code=${n}, char=${t.charAt(e)}] is too high! (max=255)`);if(i[n]!==0)throw Error(`Character [code=${n}, char=${t.charAt(e)}] is more than once in the charset!`);i[n]=e,a[e]=n}let o=n.charCodeAt(0),s={name:e,encodingLength(e){let t=e.length,n=t*.75|0;return e.charCodeAt(t-1)===o?e.charCodeAt(t-2)===o?n-2:n-1:n},encode(e,t,n){t??=new Uint8Array(s.encodingLength(e)),n??=0;let r=e.length;e.charCodeAt(r-1)===o&&(e.charCodeAt(r-2)===o?r-=2:--r);let a=r%4,c=r-a,l=n,u=0;for(;u<c;){let n=i[e.charCodeAt(u)]<<18|i[e.charCodeAt(u+1)]<<12|i[e.charCodeAt(u+2)]<<6|i[e.charCodeAt(u+3)];t[l++]=n>>16,t[l++]=n>>8,t[l++]=n,u+=4}if(a===3){let n=i[e.charCodeAt(u)]<<10|i[e.charCodeAt(u+1)]<<4|i[e.charCodeAt(u+2)]>>2;t[l++]=n>>8,t[l++]=n}else a===2&&(t[l++]=i[e.charCodeAt(u)]<<2|i[e.charCodeAt(u+1)]>>4);return s.encode.bytes=l-n,t},decode(e,t,n){t??=0,n??=e.length;let i=n-t,c=i%3,l=t+i-c,u=[];for(let n=t;n<l;n+=3){let t=e[n]<<16|e[n+1]<<8|e[n+2];u.push(a[t>>18&63],a[t>>12&63],a[t>>6&63],a[t&63])}if(c===2){let t=(e[n-2]<<8)+e[n-1];u.push(a[t>>10],a[t>>4&63],a[t<<2&63]),r===1&&u.push(o)}else if(c===1){let t=e[n-1];u.push(a[t>>2],a[t<<4&63]),r===1&&u.push(o,o)}return s.decode.bytes=i,String.fromCharCode.apply(String,u)}};return s}Oe(`base64`,`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,`=`,1);var ke=Oe(`base64-url`,`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,`=`,2),Ae=e(((e,t)=>{t.exports={}})),je=typeof global<`u`?global.AbortError:typeof window<`u`?window.AbortError:null;je||=class extends Error{constructor(e=`Request aborted.`){super(e)}},je.prototype.name=`AbortError`,je.prototype.code=`ABORT_ERR`;var Me=typeof globalThis<`u`&&globalThis.URL||Ae().URL,$=class extends Error{constructor(e,t,n){super(`status=`+t+` while requesting `+e+` [`+n+`]`),this.uri=e,this.status=t,this.method=n}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}};$.prototype.name=`HTTPStatusError`,$.prototype.code=`HTTP_STATUS`;var Ne=class extends Error{constructor(e,t){super(e),this.cause=t}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:Le(this.cause)}}};Ne.prototype.name=`ResponseError`,Ne.prototype.code=`RESPONSE_ERR`;var Pe=class extends Error{constructor(e){super(`Timeout (t=`+e+`).`),this.timeout=e}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}};Pe.prototype.name=`TimeoutError`,Pe.prototype.code=`ETIMEOUT`;var Fe=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,Ie=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function Le(e){if(typeof e==`string`)return{message:e};try{let t=JSON.stringify(e);if(t!==`{}`)return JSON.parse(t)}catch{}let t={message:String(e.message||e)};return e.code!==void 0&&(t.code=String(e.code)),t}var Re=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,ze=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/gi,Be=/\[(((pk|name)=([^\]]+)))\]/gi;function Ve(e){let t=Re.exec(e),n=t[2]||`https:`,r=t[3],i=t[5],a=t[6],o=t[7];if(n===`https:`||n===`http:`){let e=He(o,ze);return{name:e.name,protocol:n,ipv4:e.ipv4,ipv6:e.ipv6,host:r,port:i,path:a,method:e.post?`POST`:`GET`}}if(n===`udp:`||n===`udp4:`||n===`udp6:`){let t=He(o,Be),a=/^\[(.*)\]$/.exec(r);if(a&&n===`udp4:`)throw Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${e})`);if(!a&&n===`udp6:`)throw Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${e})`);return a?new Je({protocol:`udp6:`,ipv6:a[1],port:i,pk:t.pk,name:t.name}):new qe({protocol:`udp4:`,ipv4:r,port:i,pk:t.pk,name:t.name})}throw new Ue(n,e)}function He(e,t){t.lastIndex=0;let n={};for(;;){let r=t.exec(e);if(!r)break;r[2]?n[r[3].toLowerCase()]=r[4]:n[r[1].toLowerCase()]=!0}return n}var Ue=class extends Error{constructor(e,t){super(`Invalid Endpoint: unsupported protocol "${e}" for endpoint: ${t}, supported protocols: ${We.join(`, `)}`),this.protocol=e,this.endpoint=t}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}};Ue.prototype.name=`InvalidProtocolError`,Ue.prototype.code=`EPROTOCOL`;var We=[`http:`,`https:`,`udp4:`,`udp6:`],Ge=class{constructor(e,t){this.name=e.name||null,this.protocol=e.protocol;let n=typeof e.port==`string`?e.port=parseInt(e.port,10):e.port;if(n==null)this.port=t?this.protocol===`https:`?443:80:e.pk?443:53;else if(typeof n!=`number`&&!isNaN(n))throw Error(`Invalid Endpoint: port "${e.port}" needs to be a number: ${JSON.stringify(e)}`);else this.port=n}toJSON(){return this.toString()}},Ke=class extends Ge{constructor(e){super(e,!1),this.pk=e.pk||null}toString(){let e=this.port===(this.pk?443:53)?``:`:${this.port}`,t=this.pk?` [pk=${this.pk}]`:``,n=this.name?` [name=${this.name}]`:``;return`udp://${this.ipv4||`[${this.ipv6}]`}${e}${t}${n}`}},qe=class extends Ke{constructor(e){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)}`);this.ipv4=e.ipv4}},Je=class extends Ke{constructor(e){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)}`);this.ipv6=e.ipv6}};function Ye(e){return Ie.test(e)&&!Fe.test(e)?`[${e}]`:e}var Xe=class extends Ge{constructor(e){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)}`);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){let e=Ie.exec(this.host);e&&(this.ipv6=e[1])}this.ipv4||Fe.test(this.host)&&(this.ipv4=this.host);let t=`${this.protocol}//${Ye(this.host)}:${this.port}${this.path}`;try{this.url=new Me(t)}catch(e){throw Error(e.message+` [${t}]`)}}toString(){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}]`:``;return`${e}${Ye(this.host)}${t}${r}${n}${a}${o}${i}`}};function Ze(e){let t;if(typeof e==`string`)t=Ve(e);else{if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Can not convert ${e} to an endpoint`);if(e instanceof Ge)return e;t=e}(t.protocol===null||t.protocol===void 0)&&(t.protocol=`https:`);let n=t.protocol;if(n===`udp4:`)return new qe(t);if(n===`udp6:`)return new Je(t);if(n===`https:`||n===`http:`)return new Xe(t);throw new Ue(n,JSON.stringify(t))}var Qe=`application/dns-message`;function $e(){}async function et(e,t,n,r){let i=t?t.localStoragePrefix+t.name:null;if(i)try{let e=JSON.parse(localStorage.getItem(i));if(e&&e.time>t.maxTime)return e}catch{}let{data:a}=await tt(e,`GET`,null,n,r),o={time:Date.now(),data:JSON.parse(g(a))};if(i)try{localStorage.setItem(i,JSON.stringify(o))}catch{o.time=null}return o}function tt(e,t,n,r,i){return new Promise((a,o)=>{let s=new Me(e);t===`GET`&&n&&(s.search=`?dns=`+ke.decode(n));let c=s.toString(),l=new XMLHttpRequest;l.open(t,c,!0),l.setRequestHeader(`Accept`,Qe),t===`POST`&&l.setRequestHeader(`Content-Type`,Qe),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);function u(){p(new Pe(r));try{l.abort()}catch{}}function d(){if(l.status!==200)p(new $(c,l.status,t));else{let e;if(typeof l.response==`string`)e=h(l.response);else if(l.response instanceof Uint8Array)e=l.response;else if(Array.isArray(l.response)||l.response instanceof ArrayBuffer)e=new Uint8Array(l.response);else throw Error(`Unprocessable response `+l.response);p(null,e)}}function f(){if(l.readyState>1&&l.status!==200&&l.status!==0){p(new $(c,l.status,t));try{l.abort()}catch{}}}let p=function(e,t){p=$e,i&&i.removeEventListener(`abort`,te),a(e?{error:e,response:l}:{data:t,response:l})};function ee(){p(l.status===200?Error(`Inexplicable XHR Error`):new $(c,l.status,t))}function te(){p(new je);try{l.abort()}catch{}}})}function nt(e){return e.filter(e=>e.cors||e.endpoint.cors)}var rt={data:[{name:`adfree.usableprivacy.net`,endpoint:{protocol:`https:`,host:`adfree.usableprivacy.net`},description:`Public updns DoH service with advertising, tracker and malware filters.
|
|
2
2
|
Hosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com`,country:`Germany`,location:{lat:51.2993,long:9.491},filter:!0},{name:`adguard-dns-doh`,endpoint:{protocol:`https:`,host:`dns.adguard.com`,ipv4:`94.140.15.15`},description:`Remove ads and protect your computer from malware (over DoH)`,country:`France`,location:{lat:48.8582,long:2.3387},filter:!0},{name:`adguard-dns-family-doh`,endpoint:{protocol:`https:`,host:`dns-family.adguard.com`,ipv4:`94.140.15.16`},description:`Adguard DNS with safesearch and adult content blocking (over DoH)`,country:`France`,location:{lat:48.8582,long:2.3387},filter:!0},{name:`adguard-dns-unfiltered-doh`,endpoint:{protocol:`https:`,host:`dns-unfiltered.adguard.com`,ipv4:`94.140.14.140`},description:`AdGuard public DNS servers without filters (over DoH)`,country:`France`,location:{lat:48.8582,long:2.3387}},{name:`ahadns-doh-chi`,endpoint:{protocol:`https:`,host:`doh.chi.ahadns.net`,cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/
|
|
3
3
|
Server statistics can be seen at: https://statistics.ahadns.com/?server=chi`,country:`United States`,location:{lat:41.8483,long:-87.6517},filter:!0,cors:!0},{name:`ahadns-doh-in`,endpoint:{protocol:`https:`,host:`doh.in.ahadns.net`,cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/
|
|
4
4
|
Server statistics can be seen at: https://statistics.ahadns.com/?server=in`,country:`India`,location:{lat:19.0748,long:72.8856},filter:!0,cors:!0},{name:`ahadns-doh-la`,endpoint:{protocol:`https:`,host:`doh.la.ahadns.net`,cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/
|
|
@@ -84,4 +84,4 @@ https://www.switch.ch
|
|
|
84
84
|
Provides protection against malware, but does not block ads.`,filter:!0},{name:`uncensoreddns-dk-ipv4`,endpoint:{protocol:`https:`,host:`unicast.uncensoreddns.org`},description:`Also known as censurfridns.
|
|
85
85
|
DoH, no logs, no filter, DNSSEC, unicast hosted in Denmark - https://blog.uncensoreddns.org`,country:`Denmark`,location:{lat:55.7123,long:12.0564}},{name:`uncensoreddns-ipv4`,endpoint:{protocol:`https:`,host:`anycast.uncensoreddns.org`},description:`Also known as censurfridns.
|
|
86
86
|
DoH, no logs, no filter, DNSSEC, anycast - https://blog.uncensoreddns.org`,country:`Denmark`,location:{lat:55.7123,long:12.0564}},{name:`v.dnscrypt.uk-doh-ipv4`,endpoint:{protocol:`https:`,host:`v.dnscrypt.uk`},description:`DoH, no logs, uncensored, DNSSEC. Hosted in London UK on Digital Ocean
|
|
87
|
-
https://www.dnscrypt.uk`,country:`United Kingdom`,location:{lat:51.4964,long:-.1224}}],time:1654187067783};function
|
|
87
|
+
https://www.dnscrypt.uk`,country:`United Kingdom`,location:{lat:51.4964,long:-.1224}}],time:1654187067783};function it(e){let t=e.time===null||e.time===void 0?Date.now():e.time,n=nt(e.data.map(e=>(e.endpoint=Ze(Object.assign({name:e.name},e.endpoint)),e))),r=n.map(e=>e.endpoint);return{data:{resolvers:n,resolverByName:n.reduce((e,t)=>(e[t.name]=t,e),{}),endpoints:r,endpointByName:r.reduce((e,t)=>(e[t.name]=t,e),{})},time:t}}var at=it(rt),ot=new Me(`https://martinheidegger.github.io/dns-query/resolvers.json`);function st(e){return/^@/.test(e)}new class{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:ot,persist:!1,localStoragePrefix:`dnsquery_`,maxAge:3e5},e),this._dataP=null}_data(e,t){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?et(this.opts.updateURL,this.opts.persist?{name:`resolvers.json`,localStoragePrefix:this.opts.localStoragePrefix,maxTime:Date.now()-this.opts.maxAge}:null,this.opts.timeout).then(e=>it({data:e.data.resolvers,time:e.time})).catch(()=>t||at):Promise.resolve(at),this._dataP)}data(){return this._data(!1).then(e=>e.data)}endpoints(e){if(e==null)return this.data().then(e=>e.endpoints);if(e===`doh`&&(e=ct),e===`dns`&&(e=lt),typeof e==`function`)return this.data().then(t=>t.endpoints.filter(e));if(typeof e==`string`||typeof e[Symbol.iterator]!=`function`)return Promise.reject(Error(`Endpoints (${e}) needs to be iterable (array).`));if(e=Array.from(e).filter(Boolean),e.findIndex(st)===-1)try{return Promise.resolve(e.map(Ze))}catch(e){return Promise.reject(e)}return this.data().then(t=>e.map(e=>{if(st(e)){let n=t.endpointByName[e.substring(1)];if(!n)throw Error(`Endpoint ${e} is not known.`);return n}return Ze(e)}))}};function ct(e){return e.protocol===`https:`||e.protocol===`http:`}function lt(e){return e.protocol===`udp4:`||e.protocol===`udp6:`}var ut=new TextEncoder().encode(`Hello, World!`),dt=new TextEncoder,ft=new TextDecoder(`utf-8`,{fatal:!0});function pt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]^ut[n%ut.length];return t}function mt(e){return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function ht(e){if(e.length%2!=0)throw Error(`Invalid encoding`);let t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++){let r=Number.parseInt(e.slice(n*2,n*2+2),16);if(Number.isNaN(r))throw Error(`Invalid encoding`);t[n]=r}return t}function gt(e){return mt(pt(dt.encode(e)))}function _t(e){try{return ft.decode(pt(ht(e)))}catch(e){throw e instanceof Error&&e.message===`Invalid encoding`?e:Error(`Invalid encoding`)}}var vt=gt(`Fizz Buzz`);console.log(`Encoded:`,vt);var yt=_t(vt);console.log(`Decoded:`,yt)});
|