feat(core): add SSH data access proxy CLI and core managers

This commit is contained in:
2026-05-30 10:02:08 +00:00
commit 47d9846c93
23 changed files with 10399 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { SshClient } from './classes.sshclient.js';
import type { IProxyRequest } from './types.js';
export class PortProxy {
constructor(private sshClient = new SshClient()) {}
public buildArgs(request: IProxyRequest): string[] {
this.validateLocalForward(request.localForward);
return this.sshClient.buildSshArgs(request.host, {
localForwards: [request.localForward],
extraArgs: ['-N'],
exitOnForwardFailure: true,
});
}
public async start(request: IProxyRequest): Promise<number> {
return this.sshClient.spawnInteractive('ssh', this.buildArgs(request));
}
private validateLocalForward(localForward: string): void {
const parts = localForward.split(':');
if (parts.length < 3) {
throw new Error('Local forward must look like <localPort>:<remoteHost>:<remotePort>');
}
}
}