Direct/Freedom outbound: Better Compatibility#6058
Conversation
|
本来想的是把 finalrules 放到 ctx 在 dialer 取出来再拦 所以做成了偷看 sockopt 缺点大概就是上面的 4 |
|
|
这种情况有几种可能,比如 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 打架 |
|
happyEyeballs-v2 may be more important for client-side, but happyEyeballs-v1 is essential for both sides.
|
There is no conflict happyEyeballs is for tcp and udp-domains is for udp! |
|
freedom 和 sockopt 的 domainstrategy 导致 udpdomain 和 happyeyeballs 的解析行为不一致 |
|
This conflict is between freedom-domainStrategy and sockopt-domainStrategy, not between happyEyeballs and udpdomains, we can simply use sockopt-domainStrategy for udpdmains with some changes in infra. Pointless arguments ... |
|
freedom.domainstrategy asis 要用你的 happyeyeballs 必须得 sockopt 设为非 asis 你如果没明白可以去看文档,当时发现你这个 bug |
??? for AsIs we had go-happyEyeballs, so usually there is no need for my happyEyeballs. I write happyEyeballs because i need build-in-dns but choosing one random ip didn't meet my needs (Iranian society). So it is basically for ForceIP-domainStrategy (it is also v2, which has many advantages and when we need those advantages we could simply use build-in-dns if we want) |
|
因此你的快乐眼球会让你的 UDPDomain 不快乐,这是可接受的 |
|
my happyEyeballs have nothing to do with this problem, you (probably) chose ipv6 for ipv4-only-server and disabled go-happyEyeballs, what does this have to do with my happyEyeballs, which is disabled by default?!! ha... |
|
本质把封在dialer里的史复制了一坨进freedom |
|
干脆让freedom把阻塞请求扔 session.Outbound 里算了 里面弄个finalrule matcher云云的让dialer去弄 下面happyeyeball或者srv做解析的时候都能看到 freedom顶多留个udp过滤 |
|
把 finalrules 塞 session 也没见得好多少 不大规模重构前提下,为了功能绝对正确,不增加用户心智负担,能糊进去就行了 代码是给人用的,封装是给开发者用的,过度追求不破坏封装在我看本末倒置了 udpdomain 也可以完全不管,文档标一下让有需求的用户在路由搞俩 freedom,tcp udp 各一个就完事了 |
|
it seems prefect. |
|
thx |
|
回头等讨论出结果我再 rebase |
|
现在是 Direct/Freedom 除了直接转发之外还干了路由和 Block/Blackhole 的活 这样的话,不如:
|
|
@RPRX 想要 DomainStrategy AsIs 服务器端时 v4 优先 是不是单给 freedom 开个选项好点。比如 |
这样可以让 UDPDomain 的 domainStrategy 跟 happyeyeballs 一致
这样也不用改写目标了,服务端的 happyeyeballs 也可以启用了
addressPortStrategy(query SRV or TXT) #4416 的 SRV/TXT 也可以兼容,但这里是 dial 后封锁UDP 发包那块b.UDP == nil时会漏掉过滤,给补上了不清楚什么情况会走到这里,但我看本来就有原样发出去的行为Direct/Freedom outbound: Add
blockDelaytofinalRules(30~90s by default) #6060 已在 dial 时黑洞了,无需再逐包过滤