Set dns forward "marker"
This commit is contained in:
parent
fd801274fd
commit
dc9c157488
1 changed files with 2 additions and 5 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import request from "./certnode/lib/request.js";
|
||||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
import {fileURLToPath} from "url";
|
||||
|
|
@ -48,8 +47,6 @@ export async function ensureDir(dir) {
|
|||
* @param {string} value
|
||||
*/
|
||||
const parseTxtRecordData = (value) => {
|
||||
value = String(value);
|
||||
//throw new Error(value);
|
||||
const result = {};
|
||||
for (const part of value.split(';')) {
|
||||
const [key, ...value] = part.split('=');
|
||||
|
|
@ -66,10 +63,10 @@ const parseTxtRecordData = (value) => {
|
|||
*/
|
||||
export async function findTxtRecord(host) {
|
||||
const resolver = new DohResolver('https://doh.hosterra.tech/dns-query');
|
||||
const resolved = await resolver.query( '_.' + host );
|
||||
const resolved = await resolver.query('_forward.' + host);
|
||||
if (resolved.answers) {
|
||||
for (const head of resolved.answers) {
|
||||
const txtData = parseTxtRecordData(head.data);
|
||||
const txtData = parseTxtRecordData(String(head.data));
|
||||
if (!txtData[recordParamDestUrl]) continue;
|
||||
return {
|
||||
url: txtData[recordParamDestUrl],
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue