feat: add TCP Server, UDP Server, and COM port forwarding modes

Extend Mode constants (3=TCPServer, 4=UDPServer, 5=COMPort) with
explicit values. Refactor Target to support multiple connection types
(listener+conns map, packetConn, serialPort). Add acceptLoop,
readLoopPacket, readLoopSerial. Mode-aware Broadcast dispatches to
all accepted conns (TCP-S), known remotes (UDP-S), or serial port.
Update flag help, command completions, and TUI panel hints.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
JiXieShi
2026-05-23 23:10:02 +08:00
parent d8fc9d7374
commit 30d6c2bc3c
6 changed files with 367 additions and 57 deletions
+2 -2
View File
@@ -99,8 +99,8 @@ func (d *Dispatcher) registerAll() {
d.register(RuntimeCommand{
Name: ".forward",
Usage: ".forward <list|add|remove|enable|disable|update|stats>",
Description: "manage forwarding at runtime",
Usage: ".forward <list|add|remove|enable|disable|update>",
Description: "manage forwarding (tcp/udp/tcp-s/udp-s/com)",
Handler: d.handleForwardCommand,
Completer: completeForward,
})