Direct/Freedom outbound: Better Compatibility#6058
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
|
这种情况有几种可能,比如 VLESS 没走 XUDP,就不会赋值 b.UDP,之前 ipsBlocked 是没问题的,现在 dial 那里放过了 UDP |
|
怕耽误发版标记为 draft #6027 (comment) 之前说了一大堆 0 人在意 |
|
主要是想兼容老哥的 happyeyeballs 这些边角的 BUG 早就存在了 |
|
还有其它一些情况会导致序号 6,但我看了下代码倒是又发现了别的问题,如果 UDP 那里
这个断言失败,就不会走到自定义的 PacketReader/Writer,而是 buf.PacketReader/buf.SequentialWriter,绕过了过滤逻辑 |
|
那再包一层,我开个 PR 单独修这几项呗 |
|
你开个 PR,这样吧:
|
|
#6058 (comment) 基本上只是因为 NG 自定义 dialer,然后又出现了域名的问题,还是先不管它吧,你先把上面的 1 给 PR 了 |
|
毕竟这些 feature 理论上不该冲突,只是得益于屎山代码。。。 |
|
并非“理论上不该冲突”,这里的一些东西它理论上就是冲突的,因为 finalRules 要求在 freedom 这步就解析出 IP,这必然要跳过 sockopt 的 domainStrategy 和 happyEyeballs;就算这俩能读取,你要配置 dialerProxy 的话那还是控制不了它最终实际上 dial 到哪,此时 finalRules 可能根本就没意义;NG 自定义 dialer 可能有自定义域名解析策略等,这就更不该提前解析出 IP 了 并非“屎山”而是可能的用法太多了,我的意思是这个特性目前只针对服务端,先不考虑客户端的那些情况
|
|
ok 明白了 漏掉了 TCP 那个客户端行为在墙眼里是什么样 |
那取决于被代理的应用了,代理层 dial 是成功了不会 retry,但应用层可能发现一发数据就被关连接,所以可能会重试几次 |
|
根据 #6060 更新下文档然后 rebase 一下,剩下的讨论在这里进行 其实也没那么复杂,#6058 (comment) 都列举清楚了,区分服务端/客户端后就清晰很多 |
|
文档改好了,UDP 断言失败不会逐包过滤暂时没提 |
|
|
|
只有 freedom 才需要最终过滤 |
|
Xray-core/proxy/freedom/freedom.go Lines 318 to 326 in 228f1e1 this code disable both xray and go happyEyeballs, also so it is possible that an ipv6 is selected but our server has ipv4 only. so we should filter IPs before we choose one at random (use /// but it is still possible that our server has an inactive ipv6 interface or one ip type is disabled at target-side, so disabling happyEyeballs is not good idea at all. so |
Xray-core/transport/internet/dialer.go Line 254 in 228f1e1 we can check |
|
为了让你的 udpdomain 和 happyeyeballs 行为一致 既然已经偷看了,那就没必要改 dialer 让能传递多个 dest 下去 |
|
??? you can prioritize ipv4 when selecting ip, but most of the time ipv6 has better performance and it is not future-proof. I don't understand your resistance to using xray-happyEyeballs (this is not about the properties of happyEyeballs-v2, this is about the essential properties of happyEyeballs-v1) /// I still think we should remove multiple-domain-udp-cone support, anyway we can keep it and have duplicate finalRules-code in freedom (or keep finalRules-code in freedom and just pass the filtered-ips via ctx) |
不能因为你的两个功能互相打架就把其中之一删掉 finalrules udpdomain 都和 happyeyeballs 冲突 以及 ipv6 跨国路由绝大多数情况下都比 ipv4 烂 |
|
|
|
首先你这玩意也就客户端用 就别为这个东西再大肆破坏现有结构了 |
|
再多 thumbs down 你的 udpdomain 还是和 happyeyeballs 打架 |
|
it seems prefect. |
|
thx |
|
回头等讨论出结果我再 rebase |
|
现在是 Direct/Freedom 除了直接转发之外还干了路由和 Block/Blackhole 的活 这样的话,不如:
|
|
@RPRX 想要 DomainStrategy AsIs 服务器端时 v4 优先 是不是单给 freedom 开个选项好点。比如 |
a2c3f75 to
d39965f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
这样 @RPRX 想要的 v4 优先不会和 finalRules 耦合在一起 然后绝大部分 AsIs 的用户本就没要求,现在静默走了 v4 服务端和客户端都是一样的行为,以前的版本客户端 direct 也不会 v4 优先 |
|
review 的时候意识到还有个 targetStrategy... 唉 |
This is basically for non-freedom outbounds, you can restrict it to non-freedom outbounds. |
proxySettings.tag 会绕过传输层导致 sockopt.domainStrategy 无效,因此不能这样做 现在针对 targetStrategy 也处理好兼容了 此 PR 之前,实际上有 3 套策略来源:freedom.domainStrategy、targetStrategy、sockopt.domainStrategy 现在把 freedom 自己那套废掉,只保留两套:targetStrategy 和 sockopt.domainStrategy 在兼容旧 freedom.domainStrategy 时: 有 proxySettings.tag 且不是 transportLayer,则迁到 targetStrategy UDP domain 现在统一走 ResolveStrategy() 先看 targetStrategy RPRX 要的 v4 优先,设计成了 privacyGuard,它也是类似的策略 有 proxySettings.tag,改 targetStrategy |
|
|
|
文档也准备好了 |
|
proxySettings 删了吧,GUI 都没这选项 |
|
|
|
addressPortStrategy 这东西本来也不是设计给 Freedom 用的,只有 HappyEyeballs 是 |
这玩意是挺迷的估计历史遗留产物,文档以前也没说清楚,以前一直不知道“底层传输”到底是啥翻源码才知道
要兼容老哥的眼球就只能看 sockopt.domainStrategy 了
也不是故意写的,纯粹是代码写成这样自然兼容了它,需要显式屏蔽吗? |
…(freedom compatibility) XTLS#6261 — Handle ECH H2C query correctly (Fangliding) - dnsQuery: h2c scheme → https,修复 ECH 配置查询 XTLS#6254 — brutal finalmask (LjhAUMEM) - 新增 force-brutal finalmask 类型,配合 tcp-brutal 内核模块 - 7 文件新增,全新增模块 XTLS#6058 — Direct/Freedom Better Compatibility (Meo597) - strategy 类型从 [][]byte → [11][3]byte 更安全 - freedom 出站新增 DomainStrategy / targetStrategy 支持 - 兼容旧的 freedom.domainStrategy 配置
按照下面的讨论,现在是这样的:
freedom.domainStrategy 已经干掉了,自动兼容旧配置并提醒用户
freedom 新增选项
privacyGuard,它有三种状态:未设置、显式 true、显式 false翻译下就是“用户有策略听用户的,否则 v4 优先”
翻译下就是“一旦显式设置,必须保证 v4 优先”
finalRules 现在不会覆写 IP,而且 freedom 也不允许覆写 IP,都是偷看 sockopt 策略,解析出来判所有 IP
意思是在 freedom 真的是最终出站时绝对有效,但若还有 sockopt.dialerProxy、proxySettings.tag、sockopt.addressPortStrategy 时则尽力而为
UDP domain 有更好的兼容性不再偏好 v4,无论用户设了哪个 strategy 都会和 TCP 行为完全一致