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
@@ -2192,6 +2192,14 @@ WSS
选中的主机里有客户端版本不支持协议切换(需要新版客户端)=Einige ausgewaehlte Hosts laufen mit einem Client ohne Protokollwechsel-Unterstuetzung (neuerer Client erforderlich)
确定把选中主机切回直连 TCP 吗?\n(客户端立即断线重连;若直连端口不可达,5 分钟后自动回退到当前入口)=Ausgewaehlte Hosts zurueck auf direktes TCP schalten?\n(Clients verbinden sich sofort neu; ist der direkte Port nicht erreichbar, fallen sie nach 5 Minuten auf den aktuellen Eingang zurueck)
确定切换选中主机的传输协议吗?\n(客户端立即断线重连,正在进行的远程会话会中断;新入口 5 分钟内连不上将自动回退)=Transportprotokoll der ausgewaehlten Hosts umschalten?\n(Clients verbinden sich sofort neu, laufende Sitzungen werden unterbrochen; ist der neue Eingang 5 Minuten lang nicht erreichbar, wird automatisch zurueckgefallen)
UDP(测试)=UDP (Test)
KCP(测试)=KCP (Test)
选中的主机里有客户端版本不支持切到实验传输 UDP/KCP(需要新版 Windows 客户端)=Einige ausgewaehlte Hosts nutzen einen Client ohne Unterstuetzung fuer experimentelle Transporte (UDP/KCP); ein neuerer Windows-Client ist erforderlich
当前主控走上级 FRP 代理,FRP 只转发 TCP,无法切换到实验传输=Der Master laeuft hinter einem uebergeordneten FRP-Proxy, der nur TCP weiterleitet; Wechsel zu einem experimentellen Transport nicht moeglich
无法确定主控的公网地址,不能切换到实验传输=Oeffentliche Adresse des Masters konnte nicht ermittelt werden; Wechsel zu einem experimentellen Transport nicht moeglich
主控没有配置该传输的监听端口:请在设置的 ghost/UDPOption 里加上对应条目=Fuer diesen Transport ist kein Listen-Port konfiguriert; bitte einen passenden ghost/UDPOption-Eintrag in den Einstellungen ergaenzen
确定把选中主机切到测试传输吗?\n(UDP/KCP 为实验协议,可能不稳定;客户端立即断线重连,300 秒内连不上会自动回退到切换前的入口)=Ausgewaehlte Hosts auf einen experimentellen Transport umschalten?\n(UDP/KCP sind experimentell und ggf. instabil; Clients verbinden sich sofort neu und fallen nach 300 Sekunden ohne Verbindung auf den vorherigen Eingang zurueck)
UDP 协议参数与监听端口按顺序一一对应:例如监听端口填 6543;7543,这里就填 UDP;KCP。=UDP-Parameter entsprechen den Listen-Ports in Reihenfolge; fuer Ports 6543;7543 hier UDP;KCP eintragen.
白名单=Whitelist
确定将选中日志中的 IP 加入白名单吗?=IP aus den ausgewaehlten Log-Eintraegen zur Whitelist hinzufuegen?
已将 %d 个 IP 加入白名单=%d IP(s) zur Whitelist hinzugefuegt