Feature: switch hosts to the experimental UDP and KCP transports

The switch only offered direct TCP, WS and WSS; UDP and KCP are now
experimental menu entries, and the radio item follows the real transport.

The server maps ghost/UDPOption to real listeners (a "UDP;KCP" setup
used to collapse to one UDP port). A switch sends the master address and
that transport's port, refused behind an upper-level FRP. The client
persists the override, recreates its connection object when the transport
changes, and disconnects an unacknowledged switch after 60 s so the 300 s
revert can run. TCP/WS/WSS behaviour is unchanged.

Reconnecting a KCP client reused the same object: a fresh std::thread
over the old one aborted the process and leaked the ikcp session;
ConnectServer now joins the update thread and releases the session first,
and the UDP one also clears the stale login-ack flag. KCP contexts no
longer touch the shared listener socket: CancelIO is a no-op, Disconnect
looks up by IP:port and defers deletion behind the receive thread's
reference, COMMAND_BYE leaves the socket alone, and Disconnect stays
silent like UDP's. Oversized messages are delivered in chunks.

A datagram host has no disconnect event, so a new login for the same id
was parked as standby for up to 120 s while the client gave up after
60 s; a UDP/KCP or different-transport login now replaces it immediately.

The new labels, prompts and settings hint are translated in the
en_US/de_DE/zh_TW packs; UDPOption also accepts 0/1 in port order.
Verified: Debug build; switch directions plus KCP delete/reconnect/file-transfer tested.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-29 20:34:08 +01:00
1 parent 914553ab4e
commit dfac2b5179
21 files changed
+534 -91

No files matched your search

+8
View File
@@ -2222,6 +2222,14 @@ WSS
选中的主机里有客户端版本不支持协议切换(需要新版客户端)=選取的主機中有用戶端版本不支援協定切換(需要新版用戶端)
确定把选中主机切回直连 TCP 吗?\n(客户端立即断线重连;若直连端口不可达,5 分钟后自动回退到当前入口)=確定將選取主機切回直連 TCP 嗎?\n(用戶端立即斷線重連;若直連連接埠不可達,5 分鐘後自動回退到目前入口)
确定切换选中主机的传输协议吗?\n(客户端立即断线重连,正在进行的远程会话会中断;新入口 5 分钟内连不上将自动回退)=確定切換選取主機的傳輸協定嗎?\n(用戶端立即斷線重連,正在進行的遠端工作階段會中斷;新入口 5 分鐘內連不上將自動回退)
UDP(测试)=UDP(測試)
KCP(测试)=KCP(測試)
选中的主机里有客户端版本不支持切到实验传输 UDP/KCP(需要新版 Windows 客户端)=選取的主機中有用戶端版本不支援切換到實驗傳輸 UDP/KCP(需要新版 Windows 用戶端)
当前主控走上级 FRP 代理,FRP 只转发 TCP,无法切换到实验传输=目前主控走上一層 FRP 代理,FRP 只轉發 TCP,無法切換到實驗傳輸
无法确定主控的公网地址,不能切换到实验传输=無法確定主控的公網位址,不能切換到實驗傳輸
主控没有配置该传输的监听端口:请在设置的 ghost/UDPOption 里加上对应条目=主控沒有設定該傳輸的監聽連接埠:請在設定的 ghost/UDPOption 裡加上對應項目
确定把选中主机切到测试传输吗?\n(UDP/KCP 为实验协议,可能不稳定;客户端立即断线重连,300 秒内连不上会自动回退到切换前的入口)=確定將選取主機切換到測試傳輸嗎?\n(UDP/KCP 為實驗協定,可能不穩定;用戶端立即斷線重連,300 秒內連不上會自動回退到切換前的入口)
UDP 协议参数与监听端口按顺序一一对应:例如监听端口填 6543;7543,这里就填 UDP;KCP。=UDP 協定參數與監聽連接埠依序一一對應;例如監聽連接埠填 6543;7543,這裡就填 UDP;KCP。
; ===== Status Bar TLS/MCP =====
TLS: 有=TLS: 有
TLS: 无=TLS: 無