feat: 域名解析支持自定义 EDNS(需新版前端)

This commit is contained in:
xream
2024-06-22 11:45:37 +08:00
parent 0e8328dc10
commit 08aaad3bf5
3 changed files with 20 additions and 17 deletions

View File

@@ -2,13 +2,7 @@ import $ from '@/core/app';
import dnsPacket from 'dns-packet';
import { Buffer } from 'buffer';
export async function doh({
url,
domain,
type = 'A',
timeout,
ip = '223.6.6.6',
}) {
export async function doh({ url, domain, type = 'A', timeout, edns }) {
const buf = dnsPacket.encode({
type: 'query',
id: 0,
@@ -28,7 +22,7 @@ export async function doh({
options: [
{
code: 'CLIENT_SUBNET',
ip,
ip: edns,
sourcePrefixLength: 24,
scopePrefixLength: 0,
},