mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 03:50:52 +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.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
export const isSessionError = (err: unknown): boolean => {
|
|
if (!(err instanceof Error)) return false;
|
|
const msg = err.message.toLowerCase();
|
|
return (
|
|
msg.includes("session not found") ||
|
|
msg.includes("sftp session") ||
|
|
msg.includes("session lost") ||
|
|
msg.includes("channel not ready") ||
|
|
msg.includes("readdir is not a function") ||
|
|
msg.includes("channel closed") ||
|
|
msg.includes("connection closed") ||
|
|
msg.includes("connection reset") ||
|
|
msg.includes("write after end") ||
|
|
msg.includes("no response") ||
|
|
msg.includes("not connected") ||
|
|
msg.includes("client disconnected") ||
|
|
msg.includes("timed out")
|
|
);
|
|
};
|
|
|
|
const SFTP_IPC_ERROR_PREFIX = /^Error invoking remote method 'netcatty:[^']+':\s*/i;
|
|
|
|
/** Drop Electron IPC wrapper so dialogs can show the server error. */
|
|
export function unwrapSftpIpcError(err: unknown): string {
|
|
const raw = err instanceof Error ? err.message : String(err ?? "");
|
|
const unwrapped = raw.replace(SFTP_IPC_ERROR_PREFIX, "").replace(/^Error:\s*/, "").trim();
|
|
return unwrapped || raw;
|
|
}
|
|
|
|
export { isMissingStatError } from "../../../domain/sftpStatError";
|