Adds DoH capabilities
This commit is contained in:
parent
bbd5be8efe
commit
d94fa033cb
1 changed files with 20 additions and 3 deletions
23
src/util.js
23
src/util.js
|
|
@ -64,9 +64,26 @@ const parseTxtRecordData = (value) => {
|
|||
*/
|
||||
export async function findTxtRecord(host) {
|
||||
const resolver = new DohResolver('https://doh.hosterra.tech/dns-query');
|
||||
const resolved = await resolver.query( host );
|
||||
console.log(resolved);
|
||||
throw new Error(resolved.response);
|
||||
resolver.query( host)
|
||||
.then(response => {
|
||||
response.answers.forEach(ans => {
|
||||
console.log(ans.data)
|
||||
const txtData = parseTxtRecordData(ans.data);
|
||||
if (txtData[recordParamDestUrl]) {
|
||||
return {
|
||||
url: txtData[recordParamDestUrl],
|
||||
httpStatus: txtData[recordParamHttpStatus],
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
.catch(throw new Error(err));
|
||||
|
||||
|
||||
//const resolved = await resolver.query( host );
|
||||
//console.log(resolved);
|
||||
//throw new Error(resolved.response);
|
||||
/*if (resolved.response.answers) {
|
||||
for (const head of resolved.response.answers) {
|
||||
const txtData = parseTxtRecordData(head.data);
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue