port forward: one tunnel per mapping, bound to the authenticated target

The login latches `PortForward.host`/`port` into the session scope and
approval is shown that target, but a window-wide tunnel let any later
`open` name another target with only `enable-tunnel` rechecked. A
tunnel now belongs to one listener and serves the one target its login
authenticated: the controlled side refuses an `open` for any other
target, and a window with several targets uses one connection each,
approved on its own.

With one owner per tunnel the claim needs no waiters: `Establishing`,
`Claim::Wait` and `wait_ready` go, and `try_claim` becomes a plain
read. The CM label that followed a tunnel's targets goes with them; a
row shows its mapping's target, as before.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
This commit is contained in:
rustdesk
2026-09-04 16:48:53 +08:00
parent babac46999
commit c109145c54
12 changed files with 79 additions and 234 deletions

View File

@@ -768,16 +768,6 @@ class ServerModel with ChangeNotifier {
}
}
void updatePortForward(Map<String, dynamic> evt) {
final id = int.tryParse(evt['id']?.toString() ?? '');
final portForward = evt['port_forward']?.toString() ?? '';
if (id == null || portForward.isEmpty) return;
final index = _clients.indexWhere((c) => c.id == id);
if (index < 0) return;
_clients[index].portForward = portForward;
notifyListeners();
}
void androidUpdatekeepScreenOn() async {
if (!isAndroid) return;
var floatingWindowDisabled =