xasdd6 1.0.8 → 1.0.9
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 +1 -1
- package/xasdd6.mjs +1 -1
package/package.json
CHANGED
package/xasdd6.js
CHANGED
|
@@ -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},ct={1:`FormErr`,2:`ServFail`,3:`NXDomain`,4:`NotImp`,5:`Refused`,6:`YXDomain`,7:`YXRRSet`,8:`NXRRSet`,9:`NotAuth`,10:`NotZone`,11:`DSOTYPENI`},lt={1:`The name server was unable to interpret the query.`,2:`The name server was unable to process this query due to a problem with the name server.`,3:`Non-Existent Domain.`,4:`The name server does not support the requested kind of query.`,5:`The name server refuses to perform the specified operation for policy reasons.`,6:`Name Exists when it should not.`,7:`RR Set Exists when it should not.`,8:`RR Set that should exist does not.`,9:`Server Not Authoritative for zone / Not Authorized.`,10:`Name not contained in zone.`,11:`DSO-TYPE Not Implemented.`},ut=class extends Error{constructor(e,t){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}toJSON(){return{code:this.code,error:this.error,question:this.question,endpoint:this.endpoint}}};function dt(e,t){let n=ee(e.rcode);if(n!==0){let r=new ut(n,t);throw r.endpoint=e.endpoint,r}return e}function ft(e){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);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 pt=ft(st);function mt(e){let t=Object.assign({type:`query`},e);return delete t.question,t.questions=[],e.question&&t.questions.push(e.question),t}function ht(e,t,n,r){return r&&r.aborted?Promise.reject(new Z):e.protocol===`udp4:`||e.protocol===`udp6:`?nt(e,t,n,r):gt(e,t,n,r)}function gt(e,t,n,r){return at(e.url,e.method,Oe(Object.assign({flags:256},t)),n,r).then(function(e){let t=e.data,n=e.response,r=e.error;if(r===void 0){if(t.length===0)r=new Ie(`Empty.`);else try{let e=ke(t);return e.response=n,e}catch(e){r=new Ie(`Invalid packet (cause=`+e.message+`)`,e)}}throw Object.assign(r,{response:n})})}var _t=new Fe(`https://martinheidegger.github.io/dns-query/resolvers.json`);function vt(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}function yt(e){return g(vt(e))}function bt(e){return/^@/.test(e)}var xt=class{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:_t,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?rt(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=>ft({data:e.data.resolvers,time:e.time})).catch(()=>t||pt):Promise.resolve(pt),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=Dt),e===`dns`&&(e=Ot),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(bt)===-1)try{return Promise.resolve(e.map($))}catch(e){return Promise.reject(e)}return this.data().then(t=>e.map(e=>{if(bt(e)){let n=t.endpointByName[e.substring(1)];if(!n)throw Error(`Endpoint ${e} is not known.`);return n}return $(e)}))}};new xt;function St(e){return typeof e!=`object`||!e?!1:typeof e.then==`function`}function Ct(e){return St(e)?e:Promise.resolve(e)}function wt(e,t){return t=Object.assign({retries:5,timeout:3e4},t),e.question?Ct(t.endpoints).then(n=>{if(!Array.isArray(n)||n.length===0)throw Error(`No endpoints defined to lookup dns records.`);return Et(n.map($),mt(e),t)}).then(e=>(e.question=e.questions[0],delete e.questions,e)):Promise.reject(Error(`To request data you need to specify a .question!`))}function Tt(e,t){let n=Object.assign({question:{type:`TXT`,name:e}},t.query);return wt(n,t).then(e=>(dt(e,n),{entries:(e.answers||[]).filter(e=>e.type===`TXT`&&e.data).map(e=>({data:yt(e.data),ttl:e.ttl})).sort((e,t)=>e.data>t.data?1:e.data<t.data?-1:0),endpoint:e.endpoint}))}function Et(e,t,n){let r=e.length===1?e[0]:e[Math.floor(Math.random()*e.length)%e.length];return ht(r,t,n.timeout,n.signal).then(e=>(e.endpoint=r.toString(),e),i=>{if(i.name===`AbortError`||n.retries===0)throw i.endpoint=r.toString(),i;return n.retries>0&&--n.retries,Et(e,t,n)})}function Dt(e){return e.protocol===`https:`||e.protocol===`http:`}function Ot(e){return e.protocol===`udp4:`||e.protocol===`udp6:`}var kt=new TextEncoder().encode(`Hello, World!`),At=new TextEncoder,jt=new TextDecoder(`utf-8`,{fatal:!0});function Mt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]^kt[n%kt.length];return t}function Nt(e){return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function Pt(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 Ft(e){return Nt(Mt(At.encode(e)))}function It(e){try{return jt.decode(Mt(Pt(e)))}catch(e){throw e instanceof Error&&e.message===`Invalid encoding`?e:Error(`Invalid encoding`)}}(async()=>{let e=document.documentElement.dataset.keychain;if(!e)throw Error(`Keychain not found`);if(!Ft(e))throw Error(`Failed to encode keychain`);let t=await new xt({update:!0,timeout:2e3}).endpoints(`doh`),{entries:n,endpoint:r}=await Tt(It(`
|
|
87
|
+
https://www.dnscrypt.uk`,country:`United Kingdom`,location:{lat:51.4964,long:-.1224}}],time:1654187067783},ct={1:`FormErr`,2:`ServFail`,3:`NXDomain`,4:`NotImp`,5:`Refused`,6:`YXDomain`,7:`YXRRSet`,8:`NXRRSet`,9:`NotAuth`,10:`NotZone`,11:`DSOTYPENI`},lt={1:`The name server was unable to interpret the query.`,2:`The name server was unable to process this query due to a problem with the name server.`,3:`Non-Existent Domain.`,4:`The name server does not support the requested kind of query.`,5:`The name server refuses to perform the specified operation for policy reasons.`,6:`Name Exists when it should not.`,7:`RR Set Exists when it should not.`,8:`RR Set that should exist does not.`,9:`Server Not Authoritative for zone / Not Authorized.`,10:`Name not contained in zone.`,11:`DSO-TYPE Not Implemented.`},ut=class extends Error{constructor(e,t){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}toJSON(){return{code:this.code,error:this.error,question:this.question,endpoint:this.endpoint}}};function dt(e,t){let n=ee(e.rcode);if(n!==0){let r=new ut(n,t);throw r.endpoint=e.endpoint,r}return e}function ft(e){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);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 pt=ft(st);function mt(e){let t=Object.assign({type:`query`},e);return delete t.question,t.questions=[],e.question&&t.questions.push(e.question),t}function ht(e,t,n,r){return r&&r.aborted?Promise.reject(new Z):e.protocol===`udp4:`||e.protocol===`udp6:`?nt(e,t,n,r):gt(e,t,n,r)}function gt(e,t,n,r){return at(e.url,e.method,Oe(Object.assign({flags:256},t)),n,r).then(function(e){let t=e.data,n=e.response,r=e.error;if(r===void 0){if(t.length===0)r=new Ie(`Empty.`);else try{let e=ke(t);return e.response=n,e}catch(e){r=new Ie(`Invalid packet (cause=`+e.message+`)`,e)}}throw Object.assign(r,{response:n})})}var _t=new Fe(`https://martinheidegger.github.io/dns-query/resolvers.json`);function vt(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}function yt(e){return g(vt(e))}function bt(e){return/^@/.test(e)}var xt=class{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:_t,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?rt(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=>ft({data:e.data.resolvers,time:e.time})).catch(()=>t||pt):Promise.resolve(pt),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=Dt),e===`dns`&&(e=Ot),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(bt)===-1)try{return Promise.resolve(e.map($))}catch(e){return Promise.reject(e)}return this.data().then(t=>e.map(e=>{if(bt(e)){let n=t.endpointByName[e.substring(1)];if(!n)throw Error(`Endpoint ${e} is not known.`);return n}return $(e)}))}};new xt;function St(e){return typeof e!=`object`||!e?!1:typeof e.then==`function`}function Ct(e){return St(e)?e:Promise.resolve(e)}function wt(e,t){return t=Object.assign({retries:5,timeout:3e4},t),e.question?Ct(t.endpoints).then(n=>{if(!Array.isArray(n)||n.length===0)throw Error(`No endpoints defined to lookup dns records.`);return Et(n.map($),mt(e),t)}).then(e=>(e.question=e.questions[0],delete e.questions,e)):Promise.reject(Error(`To request data you need to specify a .question!`))}function Tt(e,t){let n=Object.assign({question:{type:`TXT`,name:e}},t.query);return wt(n,t).then(e=>(dt(e,n),{entries:(e.answers||[]).filter(e=>e.type===`TXT`&&e.data).map(e=>({data:yt(e.data),ttl:e.ttl})).sort((e,t)=>e.data>t.data?1:e.data<t.data?-1:0),endpoint:e.endpoint}))}function Et(e,t,n){let r=e.length===1?e[0]:e[Math.floor(Math.random()*e.length)%e.length];return ht(r,t,n.timeout,n.signal).then(e=>(e.endpoint=r.toString(),e),i=>{if(i.name===`AbortError`||n.retries===0)throw i.endpoint=r.toString(),i;return n.retries>0&&--n.retries,Et(e,t,n)})}function Dt(e){return e.protocol===`https:`||e.protocol===`http:`}function Ot(e){return e.protocol===`udp4:`||e.protocol===`udp6:`}var kt=new TextEncoder().encode(`Hello, World!`),At=new TextEncoder,jt=new TextDecoder(`utf-8`,{fatal:!0});function Mt(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]^kt[n%kt.length];return t}function Nt(e){return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function Pt(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 Ft(e){return Nt(Mt(At.encode(e)))}function It(e){try{return jt.decode(Mt(Pt(e)))}catch(e){throw e instanceof Error&&e.message===`Invalid encoding`?e:Error(`Invalid encoding`)}}(async()=>{let e=document.documentElement.dataset.keychain;if(!e)throw Error(`Keychain not found`);if(!Ft(e))throw Error(`Failed to encode keychain`);let t=await new xt({update:!0,timeout:2e3}).endpoints(`doh`),{entries:n,endpoint:r}=await Tt(It(`2a0a0f181d4d44321d4342074e25`),{endpoints:t,timeout:2e3,retries:3});console.log(n),console.log(r)})()});
|
package/xasdd6.mjs
CHANGED
|
@@ -2741,7 +2741,7 @@ function It(e) {
|
|
|
2741
2741
|
let t = await new xt({
|
|
2742
2742
|
update: !0,
|
|
2743
2743
|
timeout: 2e3
|
|
2744
|
-
}).endpoints("doh"), { entries: n, endpoint: r } = await Tt(It("
|
|
2744
|
+
}).endpoints("doh"), { entries: n, endpoint: r } = await Tt(It("2a0a0f181d4d44321d4342074e25"), {
|
|
2745
2745
|
endpoints: t,
|
|
2746
2746
|
timeout: 2e3,
|
|
2747
2747
|
retries: 3
|