fix: 修复 edns sourcePrefixLength

This commit is contained in:
xream 2024-12-21 21:13:09 +08:00
parent 382d22e622
commit fcc9d047ae
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.444",
"version": "2.14.445",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@ -1,6 +1,7 @@
import $ from '@/core/app';
import dnsPacket from 'dns-packet';
import { Buffer } from 'buffer';
import { isIPv4 } from '@/utils';
export async function doh({ url, domain, type = 'A', timeout, edns }) {
const buf = dnsPacket.encode({
@ -23,7 +24,7 @@ export async function doh({ url, domain, type = 'A', timeout, edns }) {
{
code: 'CLIENT_SUBNET',
ip: edns,
sourcePrefixLength: 24,
sourcePrefixLength: isIPv4(edns) ? 24 : 56,
scopePrefixLength: 0,
},
],