MCPcopy Create free account
hub / github.com/bytebase/dbhub / forwardTo

Method forwardTo

src/utils/ssh-tunnel.ts:238–248  ·  view source on GitHub ↗

* Forward a connection through an SSH client to a target host.

(client: Client, targetHost: string, targetPort: number)

Source from the content-addressed store, hash-verified

236 * Forward a connection through an SSH client to a target host.
237 */
238 private forwardTo(client: Client, targetHost: string, targetPort: number): Promise<Duplex> {
239 return new Promise((resolve, reject) => {
240 client.forwardOut('127.0.0.1', 0, targetHost, targetPort, (err, stream) => {
241 if (err) {
242 reject(new Error(`SSH forward error: ${err.message}`));
243 return;
244 }
245 resolve(stream as Duplex);
246 });
247 });
248 }
249
250 /**
251 * Create the local server that tunnels connections to the database.

Callers 1

establishChainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected