chen08209 说明 Concord 直连 Hysteria 跳端口将更换本地 UDP socket
chen08209 表示,Concord 已在提交 057bbfa1 中实现直连 Hysteria2 和 Hysteria v1 每次跳端口时新建本地 UDP socket,旧 socket 保留到下一次跳转以接收在途回复;两者轮流读取,绑定失败则跳过本次跳转。经过 dialer-proxy 的连接仍复用原 SessionSocket,只改变目标端口。此处有意区别于 mihomo 的 Hysteria2,改为对齐官方 Hysteria2、sing-box 及 mihomo 的 Hysteria v1;连接存活期间继续运行跳转计时器的行为不变,改动将纳入下一次发行。
作者原文@chen08209Implemented in 057bbfa1 (will be included in the next release):
- mihomo's Hysteria2 only changes the destination port on the same local socket; Concord intentionally diverges here to align with the official Hysteria2 client, sing-box, and mihomo's Hysteria v1.
- Direct Hysteria2 (and Hysteria v1) connections now open a new local UDP socket on each port hop via
SocketFactory::bind_udpinsideWrappedSocket, keeping the previous socket readable until the next hop so in-flight replies can still drain.- Reads alternate fairly between the current and previous sockets so continuous traffic on one cannot starve the other, write readiness switches to the new socket across hops, and a bind failure skips the hop without disrupting the connection. Connections over
dialer-proxykeep their existingSessionSocketand only hop the destination port.- Note on Quinn-based servers over IPv6: a client source-port change builds a fresh server path and resets the downstream congestion controller (Concord's own Hysteria2 server now keeps the negotiated Brutal/BBR controller across such migrations, fixed in f5b7fead, see #12).
- On the idle hop-timer observation: all reference clients (mihomo's Hysteria2 and Hysteria v1, sing-box's
sing-quic, and officialapernet/hysteriaudphop) keep the hop timer running while the connection is alive (and Hysteria2 sends 10 s keepalives), so that behavior is kept unchanged.