fix(core): 节点内容指纹递归忽略内部 _ 前缀字段 - #78
Open
212duo wants to merge 2 commits into
Open
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
buildNodeContentKey 只在节点顶层过滤 _ 前缀的内部字段,嵌套对象 (如 reality-opts 中的 _spider-x)未过滤。机场每次更新订阅都会 轮换 spider-x,导致内容指纹变化、智能匹配永远失败,节点被当成 全新节点重复插入列表末尾。 修复 stableJsonStringify 递归时同样忽略 _ 前缀键,与顶层行为一致。 新增 node-identity 单测和 source-node-refresh 场景测试覆盖。
212duo
force-pushed
the
fix/node-fingerprint-ignore-nested-internal-fields
branch
from
August 11, 2026 10:49
7b8c1bb to
c118ef8
Compare
Ryson-32
self-requested a review
August 12, 2026 08:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
节点内容指纹(
buildNodeContentKey)只在节点顶层过滤_前缀的内部字段,嵌套对象里的内部字段没有过滤。vless reality 解析器会把 spider-x 存为
reality-opts._spider-x(带_前缀的内部字段)。很多机场每次更新订阅都会轮换 spider-x,导致内容指纹每次都变,mergeParsedSourceNodes的智能匹配永远失败——节点被当成"全新节点"重复插入列表末尾,同时旧节点被删除。表现为:某些 reality 节点每次订阅更新后都跑到列表最后、产生重复节点、用户手动排序失效。复现
spider-x参数(uuid/server/port 均不变)实测(真实订阅):uuid、server、port、public-key、short-id 全部一致,仅
_spider-x不同,更新后节点从列表第 1 位掉到末尾。根因
node-identity.ts的stableJsonStringify递归序列化时没有像buildNodeContentKey顶层那样忽略_前缀键,导致reality-opts._spider-x参与指纹计算。_前缀在代码库中是 SubBoost 内部字段的通用约定(生成 YAML、proxy-sanitizer、顶层指纹均按此忽略),嵌套层漏掉属于不一致。修复
stableJsonStringify递归时同样跳过_前缀键,与顶层行为统一。内部字段不再参与节点身份判定,spider-x 轮换不影响匹配。测试
node-identity.test.ts:嵌套_spider-x不同时指纹相等;真实字段(uuid)不同时指纹仍不同;顶层内部字段行为不变source-node-refresh.test.ts场景测试:spider-x 轮换 + 显示名变化时,节点保持匹配、不重复、保留原位置,参数更新为新值