add native Shadowrocket proxy output - #637
Conversation
|
由于我对 shadowrocket 原生写法不熟悉, 以下内容由 Codex review 得出
例如 VMess + WS + TLS 节点最终会变成:
输出中没有 TLS 和 WebSocket 配置,Shadowrocket 可能将其按普通 TCP VMess 节点解析,导致无法连接。 建议补齐 native VMess 所需的 TLS/WS 参数;如果某种配置暂时无法无损表达,则明确报错。同时增加 VMess + WS + TLS 的完整输出测试。目前测试只覆盖基础 TCP VMess,无法发现这个问题。 Since I’m not familiar with Shadowrocket’s native configuration syntax, the following finding was identified by a Codex review.
For example, a VMess + WebSocket + TLS node is reduced to:
Without the TLS and WebSocket settings, Shadowrocket may interpret it as a plain TCP VMess node, causing the connection to fail. Please either serialize the native VMess parameters required to preserve TLS/WS semantics or throw a clear error when a VMess configuration cannot be represented losslessly. A full-output regression test for VMess + WS + TLS should also be added, since the current test covers only basic TCP VMess. |
|
VMess WS/TLS 的问题已经修复,但还有两个类似问题: D — VLESS WebSocket 参数丢失
E — Shadowsocks v2ray-plugin 参数丢失
建议完整序列化所有可表示的连接参数;如果某种节点无法由 Shadowrocket native syntax 无损表示,应明确报错。同时请为这两个场景添加完整输出的回归测试。 The VMess WS/TLS issue has been fixed, but two similar issues remain: D — VLESS WebSocket parameters are dropped
E — Shadowsocks v2ray-plugin parameters are dropped A WebSocket Please serialize every representable connection parameter. If a node cannot be represented losslessly in Shadowrocket native syntax, return a clear error instead. Full-output regression tests should also be added for both cases. |
|
能否先自己 review 一下……现在这样有点折腾人。 重新 review 最新提交后,D/E 已解决,但以下问题仍然存在,建议在 merge 前处理: F. VMess cipher 被静默改写 当前只校验 G. Hysteria2 Gecko 被静默改成 Salamander
H. WireGuard CIDR 冲突未被发现 例如同时提供 I. 内部校验错误泄漏到非 native 输出
J. 不完整的 Reality 配置仍会被静默降级
Could you please review the changes yourself first? The repeated back-and-forth is becoming a bit exhausting. After reviewing the latest changes again, D/E have been fixed, but the following issues still remain and should be addressed before merging: F. The VMess cipher is silently rewritten The current validation only checks the type of G. Hysteria2 Gecko is silently converted to Salamander
H. Conflicting WireGuard CIDRs are not detected For example, providing both I. Internal validation errors leak into non-native output
J. Incomplete Reality configurations are still silently downgraded
|
|
麻烦再看一下这些问题(有些好像 AI 判断不准确, 还是需要人工核实下) 以下是针对 K — 域名解析后,native 导出失败 订阅启用内置 L — Hysteria 的两种认证编码被混淆 两个节点分别使用 M — WebSocket Host 的大小写变体被静默丢弃 检查逻辑接受任意大小写的 Host,但序列化只读取 代码位置 · Mihomo 使用 http.Header 处理 WS headers N — key 大小写变体可以绕过原始输入校验 现有 parser 会把 当前完整测试为 869 passing,以上情况已做代码级独立复现;尚未进行 Shadowrocket 真机导入和连接测试,实际客户端影响仍需人工核实。 Please take another look at these issues (some of the AI's assessments may be inaccurate, so they still need human verification). This follow-up review targets K — Domain resolution causes native export to fail Enabling the built-in L — Hysteria's two authentication encodings are conflated Otherwise identical nodes using Code · Mihomo authentication implementation M — WebSocket Host casing variants are silently dropped The validation accepts any casing of Host, but serialization only reads Code · Mihomo handles WS headers through http.Header N — Key casing variants bypass raw-input validation The existing parser lowercases The full suite currently reports 869 passing, and the cases above were independently reproduced at the code level. Shadowrocket import and connection testing on a real device has not been performed; actual client impact still needs human verification. |
Handle native input cases that could be changed or dropped during normalization, including conflicting aliases, duplicate options and URI-specific aliases. Add regression tests for parsing, native output and download routes. Keep the latest upstream QX password parsing changes while preserving the native validation added by this PR.
|
You're right. I went through it again and found a few things I had missed before. I've fixed the issues I was able to reproduce and added regression tests around the native parsing and output paths. I also synced with the latest master and kept the upstream QX password parsing changes while preserving the native validation added by this PR. The targeted tests (791), full test suite (1531), and build are all passing. Thanks for pointing this out and for taking the time to review the changes. I'll keep working on any remaining issues, though there may be some cases that I'm not able to resolve on my own. |
Adds opt-in native proxy output for Shadowrocket subscription and collection downloads. YAML-compatible output remains the default. Supported native protocol subsets include Shadowsocks, VMess, VLESS, HTTP/HTTPS, SOCKS5/SOCKS5-TLS, Trojan, Hysteria, Hysteria2, TUIC, Juicity, WireGuard, and Snell v2. Unsupported native configurations fail explicitly rather than losing connection parameters.
Input validation and review fixes
Native validation runs before lossy normalization and generic export filtering. It checks scalar types, VMess AEAD/alterId consistency, mandatory TLS flags, aliases, credentials, transport fields, and WireGuard addresses.
bogusfail before falling back toauto. Supported values and equivalent cipher aliases remain accepted. Coverage includes Clash JSON, VMess share links, and Loon/Surge inputs. Loon/Surge parser fallbacks report the original failure before replacing the cipher, while non-native fallback behavior remains unchanged.Regression tests cover direct production, Clash parsing/normalization, native subscription and collection downloads, complete valid output strings, non-native JSON/YAML/URI exports, private metadata cloning, and cases previously filtered to empty output. Collection errors preserve the native validation reason.
Additional review fixes
ports,hop-interval, andhop-interval-maxbefore shared normalization can delete malformed values. Coverage includes objects, zero, false, empty strings, invalid strings and reversed ranges for Hysteria/Hysteria2.Validation
1b0e4a6f62ced7e3e083f7fa847f9e92aaef8ce9: no conflicts; 879 passing, including all final changes.git diff --check: passed.Client verification
Real-device Shadowrocket import and connection testing has not been performed. Automated checks do not establish client-version compatibility or actual TLS/SNI, WebSocket, UDP, authentication, and WireGuard connectivity. Existing dependency build warnings remain. Maintainer review and client verification are still required before treating the feature as release-ready.