mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
Introduce workspace-aware System side panel with remote process/tmux/Docker management, terminal popup for interactive attach, capability warmup, review-hardened IPC, performance optimizations, toast action errors, and SSH channel recovery on reconnect.
28 lines
814 B
JavaScript
28 lines
814 B
JavaScript
"use strict";
|
|
|
|
/** Best-effort check that an ssh2 Client transport is still usable. */
|
|
function isSshConnAlive(conn) {
|
|
if (!conn) return false;
|
|
const sock = conn._sock;
|
|
if (sock && sock.destroyed) return false;
|
|
return true;
|
|
}
|
|
|
|
/** True when conn.exec failed because the underlying transport/channel is gone. */
|
|
function isTransportExecError(message) {
|
|
const msg = String(message || "").toLowerCase();
|
|
return (
|
|
msg.includes("not connected")
|
|
|| msg.includes("connection lost")
|
|
|| msg.includes("socket hang up")
|
|
|| msg.includes("econnreset")
|
|
|| msg.includes("closed")
|
|
|| msg.includes("destroyed")
|
|
|| msg.includes("channel open failure")
|
|
|| msg.includes("unable to exec")
|
|
|| msg.includes("no response")
|
|
);
|
|
}
|
|
|
|
module.exports = { isSshConnAlive, isTransportExecError };
|