diff --git a/backend/package.json b/backend/package.json index acb41aa4c..1e1b142f0 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.364", + "version": "2.14.365", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/processors/index.js b/backend/src/core/proxy-utils/processors/index.js index 0ecdace9d..9c01526ad 100644 --- a/backend/src/core/proxy-utils/processors/index.js +++ b/backend/src/core/proxy-utils/processors/index.js @@ -392,18 +392,23 @@ const DOMAIN_RESOLVERS = { const id = hex_md5(`CUSTOM:${url}:${domain}:${type}`); const cached = resourceCache.get(id); if (!noCache && cached) return cached; + const answerType = type === 'IPv6' ? 'AAAA' : 'A'; const res = await doh({ url, domain, - type: type === 'IPv6' ? 'AAAA' : 'A', + type: answerType, timeout, edns, }); + const { answers } = res; if (!Array.isArray(answers) || answers.length === 0) { throw new Error('No answers'); } - const result = answers.map((i) => i?.data).filter((i) => i); + const result = answers + .filter((i) => i?.type === answerType) + .map((i) => i?.data) + .filter((i) => i); if (result.length === 0) { throw new Error('No answers'); }