Skip to content

Commit

Permalink
fix: 被识别为 IP4P 的域名解析结果均增加 _IP4P 字段; 修复报错
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jul 18, 2024
1 parent a0c1bbb commit aa0943a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
10 changes: 8 additions & 2 deletions backend/src/core/proxy-utils/processors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,16 +627,22 @@ 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;
p.server = server;
p.port = port;
p.resolved = true;
p._IPv4 = p.server;
p._IP4P = ip;
if (!isIP(p._IP)) {
p._IP = p.server;
}
Expand Down

0 comments on commit aa0943a

Please sign in to comment.