MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / buildTunnelArgs

Function buildTunnelArgs

src/cli/ssh-tunnel.ts:26–37  ·  view source on GitHub ↗
(o: TunnelOpts)

Source from the content-addressed store, hash-verified

24
25/** Build the `ssh` argv for a no-shell local port-forward with keepalive. PURE. */
26export function buildTunnelArgs(o: TunnelOpts): string[] {
27 const args = [
28 '-N', // no remote command — forward only
29 '-o', 'ServerAliveInterval=30', // keep the tunnel from idling out
30 '-o', 'ExitOnForwardFailure=yes', // fail fast if the local port is taken
31 '-L', `${o.localPort}:localhost:${o.remotePort}`,
32 ];
33 if (o.port) args.push('-p', String(o.port));
34 if (o.identityFile) args.push('-i', o.identityFile);
35 args.push(`${o.user ? `${o.user}@` : ''}${o.host}`);
36 return args;
37}
38
39/** Open the tunnel; resolves with a `close()` once ssh is spawned. Rejects if ssh exits early. */
40export async function openTunnel(o: TunnelOpts): Promise<{ close: () => void }> {

Callers 3

ssh-tunnel.test.tsFile · 0.90
index.tsFile · 0.85
openTunnelFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected