fix: 被识别为 IP4P 的域名解析结果均增加 _IP4P 字段; 修复报错

This commit is contained in:
xream 2024-07-18 19:47:15 +08:00
parent a0c1bbbf70
commit aa0943a909
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 9 additions and 3 deletions

View File

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

View File

@ -627,8 +627,15 @@ function ResolveDomainOperator({
]
: results[p.server];
if (type === 'IPv6' && isIPv6(ip)) {
ip = new ipAddress.Address6(ip).correctForm();
try {
ip = new ipAddress.Address6(ip).correctForm();
} catch (e) {
$.error(
`Failed to parse IPv6 address: ${ip}: ${e}`,
);
}
if (/^2001::[^:]+:[^:]+:[^:]+$/.test(ip)) {
p._IP4P = ip;
const { server, port } = parseIP4P(ip);
if (server && port) {
p._domain = p.server;
@ -636,7 +643,6 @@ function ResolveDomainOperator({
p.port = port;
p.resolved = true;
p._IPv4 = p.server;
p._IP4P = ip;
if (!isIP(p._IP)) {
p._IP = p.server;
}