mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
Add a host and group toggle for bastions that allow one session channel per TCP connection. After the handshake, BHostSSH, TERM-SSHD, and CLOUDBILITY take that path automatically. File transfer uses a separate SFTP login, and the interactive terminal is not given another exec, SFTP, copy/split, or port-forward channel. The manual toggle remains for bastions that still advertise OpenSSH.
32 lines
985 B
TypeScript
32 lines
985 B
TypeScript
import { resolveHostFollowTerminalCwd, resolveSftpFollowTerminalCwdTargetHost } from "../../domain/sftpFollowTerminalCwd";
|
|
|
|
type FollowTerminalCwdHost = {
|
|
sftpFollowTerminalCwd?: boolean;
|
|
};
|
|
|
|
type ShouldProbeCommandCwdOptions = {
|
|
restoreTerminalCwd: boolean;
|
|
visibleSftpHost?: FollowTerminalCwdHost | null;
|
|
sessionHost?: FollowTerminalCwdHost | null;
|
|
globalSftpFollowTerminalCwd: boolean;
|
|
restrictExtraSshChannels?: boolean;
|
|
};
|
|
|
|
export const shouldProbeCommandCwd = ({
|
|
restoreTerminalCwd,
|
|
visibleSftpHost,
|
|
sessionHost,
|
|
globalSftpFollowTerminalCwd,
|
|
restrictExtraSshChannels = false,
|
|
}: ShouldProbeCommandCwdOptions): boolean => {
|
|
if (restrictExtraSshChannels) return false;
|
|
if (restoreTerminalCwd) return true;
|
|
|
|
if (!visibleSftpHost) return false;
|
|
const followHost = resolveSftpFollowTerminalCwdTargetHost(visibleSftpHost, sessionHost);
|
|
return resolveHostFollowTerminalCwd(
|
|
followHost?.sftpFollowTerminalCwd,
|
|
globalSftpFollowTerminalCwd,
|
|
);
|
|
};
|