fix(ssr-plus): 修复 gRPC 节点订阅更新后 serviceName 丢失导致 xray 启动失败 - #2042
Open
fordjkhjk wants to merge 1 commit into
Open
fix(ssr-plus): 修复 gRPC 节点订阅更新后 serviceName 丢失导致 xray 启动失败#2042fordjkhjk wants to merge 1 commit into
fordjkhjk wants to merge 1 commit into
Conversation
…ing xray Two chained bugs causing trojan-grpc / vless-grpc nodes to fail silently after a subscription update: 1. subscribe.lua: query params are stored with lowercased keys (params[string.lower(t[1])]) but read back as camelCase params.serviceName, so serviceName always resolves to nil for every gRPC node parsed from a subscription. 2. gen_config.lua: when serviceName is nil, the grpcSettings table may end up with all fields nil; luci.jsonc then serializes it as a JSON array [] instead of an object, which xray (24.x+) rejects and exits. The UI only shows "not running" with no error log. Fix: - fall back to lowercase/path keys when reading serviceName - default serviceName to empty string so grpcSettings always serializes as a JSON object Verified on a real device (ImmortalWrt, xray 24.x): after re-parsing the subscription, gRPC handshake succeeds and socks5 connectivity test returns 204.
Collaborator
|
@fordjkhjk |
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.
问题
从订阅更新节点后,trojan-grpc / vless-grpc 节点必然启动失败,界面显示「未运行」,且无任何日志提示。实机排查发现是两个连环 bug:
根因
1. subscribe.lua —— serviceName 键名大小写不匹配,永远取到 nil
三处 gRPC 分支(trojan/vless/hysteria2 解析)存储查询参数时用
params[string.lower(t[1])]把键名统一转成小写(如servicename),读取时却用驼峰params.serviceName,键名对不上,所有 gRPC 节点的 serviceName 解析结果恒为 nil。2. gen_config.lua —— 空 grpcSettings 被序列化成 JSON 数组,xray 拒收退出
serviceName 为 nil 时,
grpcSettings表内字段可能全为 nil,luci.jsonc会把这样的空表编码成 JSON 数组[](而非对象{}),xray 24.x+ 配置校验失败直接退出进程。两个 bug 叠加:订阅更新 → serviceName 丢失 → xray 崩溃 → 「未运行」,用户完全无法定位原因。
修复
subscribe.lua(3 处):params.serviceName改为params.serviceName or params.servicename or params.path,兼容大小写两种键名(path 与 serviceName 在多数机场链接中同值);gen_config.lua(1 处):serviceName 兜底为空字符串"",保证 grpcSettings 始终序列化为 JSON 对象。实机验证
https://www.google.com/generate_204返回 204。