mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
5c8bc923e9
Follow-up to the maintainer review on PR #947 — terminal SSH was the only path that honored per-host keepalive overrides. SFTP and port forwarding share the same NetcattyJumpHost type but their builders weren't resolving keepalive per-hop, and their bridges hardcoded the old 10s/3 defaults. Net result: a router-as-bastion in a chain still got killed when reached via the SFTP file panel or a port-forwarding tunnel, even though the user had toggled per-host override. Plumbing: - useSftpHostCredentials / buildSftpHostCredentials: accept optional terminalSettings; call resolveHostKeepalive() for the target and each jump entry; emit keepaliveInterval / keepaliveCountMax in the returned NetcattySSHOptions. - useSftpConnections + useSftpState + SftpStateOptions thread the setting down. SftpSidePanel passes the global terminalSettings prop it already has from TerminalLayer. - portForwardingService.startPortForward: accepts terminalSettings as an 8th argument, resolves per-host (target + each jump), and populates the bridge payload. - usePortForwardingState.startTunnel and usePortForwardingAutoStart forward the new parameter; App.tsx supplies terminalSettings (via a ref in the once-on-launch auto-start effect so changing global keepalive later doesn't re-fire it). Bridges: - sftpBridge.cjs target connect: now also reads keepaliveCountMax from options (was hardcoded 3). 10s/3 stays as the bridge-level fallback to preserve the #669 protection when the renderer hasn't supplied a value. - sftpBridge.cjs jump hop: reads jump.keepaliveInterval / jump.keepaliveCountMax, then falls back to the target-call options (matches the symmetric SSH bridge change). - portForwardingBridge.cjs: reads keepaliveInterval / keepaliveCountMax from the IPC payload; same 10s/3 fallback. Types: - NetcattyJumpHost already grew keepalive fields earlier; this commit also adds them to PortForwardOptions so the IPC contract is explicit. End-to-end: a chain `[router-as-bastion, cloud-host]` with the router host's keepaliveOverride=true / interval=0 now correctly disables keepalive on the router hop for terminal SSH AND SFTP AND port forwarding, while the cloud target still gets the resolved 30s/10 default for each path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>