mihomo
mihomo copied to clipboard
[Bug]终于找到 hysteria2 在 1.18.1 以后加入端口跳跃后 出现 断流问题 的根源了
Verify steps
- [X] I have read the documentation and understand the meaning of all configuration items I have written, avoiding a large number of seemingly useful options or default values.
- [X] I have not reviewed the documentation and resolve this issue.
- [X] I have not searched the Issue Tracker for the problem I am going to raise.
- [X] I have tested with the latest Alpha branch version, and the issue still persists.
- [X] I have provided server and client configuration files and processes that can reproduce the issue locally, rather than a desensitized complex client configuration file.
- [X] I have provided the simplest configuration that can reproduce the error I reported, rather than relying on remote servers, TUN, graphical client interfaces, or other closed-source software.
- [X] I have provided complete configuration files and logs, rather than providing only parts that I believe are useful due to confidence in my own intelligence.
Operating System
MacOS, Windows
System Version
mac 14, win 11
Mihomo Version
1.18.2-1.18.4-alpha
Configuration File
- name: 🇦🇪美国1
type: hysteria2
server: us1.jichangnode.xyz
port: 25000
ports: 20000-30000
password: 3f663871-d2d4-4f78-8a3b-4ee4b55fce73
skip-cert-verify: true
Description
当一个节点使用DNS负载均衡有多个IP地址时,会出现断流。
我的节点us1.jichangnode.xyz下有2个IP地址解析: 1.1.1.1 2.2.2.2 且2个服务器hy2server的配置完全相同(开放相同的端口,相同的用户,甚至相同的系统版本和硬件配置)。
我测试了: 单独连接IP 1.1.1.1和2.2.2.2--->正常,不会断流 域名下只有单个IP解析--->正常,不会断流 域名有2个以上解析--->3-5分钟内断流,10-30秒自动恢复
猜想: 因为端口跳跃的引入,莫名触发了bug连接域名下的另外一个IP,但quic连接迁移的特性,连接到另外一个IP的时候并没有带认证头等信息,导致断流;而等10-30秒后再次端口跳跃,触发返回之前的IP,恢复连接。
Reproduction Steps
1.服务器地址使用域名 2.域名下解析有多个IP地址(DNS负载均衡) 3.使用1.18.2以后内核连接该域名,观察一般在3-5分钟内必出现断流,10-30秒后能自动恢复。
Logs
打开debug后,日志中没有出现有价值的报错。
端口跳跃本质上是用于同一个服务器的,并没有考虑到服务器域名会解析出多IP的情况
如果你多个 IP 不是同一台服务器请分离使用
端口跳跃本质上是用于同一个服务器的,并没有考虑到服务器域名会解析出多IP的情况
这方面能否完善一下呢? 测试案例1: 我这边还测试了hy2原版client,有端口跳跃,连接相同us1.jichangnode.xyz域名,未出现断流的情况。
测试案例2: meta内核hy1,相同域名,开启端口跳跃,也是多个解析IP,也没有断流情况。
所以能否请您再review一遍端口跳跃的相关代码,确定下是不是这个跳跃触发了跳IP的操作。 在1.18.1之前,我一直也是1个域名下多个IP的负载方案。
如果你多个 IP 不是同一台服务器请分离使用
使用dns负载均衡主要有如下使用场景: 1.单台服务器流量有限,使用dns负载均衡,可以粗粒度的把流量分摊到多台服务器(特别是以月为时间单位来看,使用了dns负载均衡后,多台服务器流量使用近似) 2.相同地区,相同服务商的线路相同,用户连接一个节点,自动负载均衡,防止用户扎堆在某一台服务器上,缓解服务器CPU压力。
试一下 https://github.com/MetaCubeX/mihomo/commit/8861eaf9033db6d1db2da5f59962770884f92013