api-response-manager 2.6.7 ā 2.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/tunnel.js +16 -14
- package/package.json +1 -1
package/commands/tunnel.js
CHANGED
|
@@ -153,10 +153,14 @@ async function connectTunnelClient(tunnelId, subdomain, localPort, protocol = 'h
|
|
|
153
153
|
console.log(chalk.white('Your local server is now accessible at:'));
|
|
154
154
|
console.log(chalk.cyan.bold(` ${message.publicUrl}\n`));
|
|
155
155
|
|
|
156
|
-
// Show TCP/SSH specific info
|
|
156
|
+
// Show TCP/SSH specific info
|
|
157
157
|
if (isTcpTunnel && message.tcpHost && message.tcpPort) {
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
console.log(chalk.yellow.bold('š SSH/TCP Tunnel Ready!\n'));
|
|
159
|
+
console.log(chalk.white.bold(' š Share this with anyone to connect:\n'));
|
|
160
|
+
console.log(chalk.cyan.bold(` ssh <user>@${message.tcpHost} -p ${message.tcpPort}\n`));
|
|
161
|
+
console.log(chalk.gray(' With SSH Key:'));
|
|
162
|
+
console.log(chalk.cyan(` ssh -i ~/.ssh/your_key <user>@${message.tcpHost} -p ${message.tcpPort}\n`));
|
|
163
|
+
console.log(chalk.gray.italic(' Replace <user> with the remote device\'s SSH username\n'));
|
|
160
164
|
} else {
|
|
161
165
|
// Display QR code for HTTP/HTTPS tunnels (not for TCP/SSH)
|
|
162
166
|
displayQRCode(message.publicUrl);
|
|
@@ -275,11 +279,6 @@ async function connectTunnelClient(tunnelId, subdomain, localPort, protocol = 'h
|
|
|
275
279
|
process.on('SIGINT', () => {
|
|
276
280
|
if (heartbeatInterval) clearInterval(heartbeatInterval);
|
|
277
281
|
console.log(chalk.yellow('\n\nā Stopping tunnel...'));
|
|
278
|
-
// Close local TCP proxy if running
|
|
279
|
-
if (localProxyServer) {
|
|
280
|
-
localProxyServer.close();
|
|
281
|
-
localProxyServer = null;
|
|
282
|
-
}
|
|
283
282
|
ws.close();
|
|
284
283
|
});
|
|
285
284
|
}
|
|
@@ -619,14 +618,17 @@ function startLocalTcpProxy(subdomain, remoteHost, remotePort, silent) {
|
|
|
619
618
|
if (!silent) {
|
|
620
619
|
console.log(chalk.yellow.bold('š SSH/TCP Tunnel Ready!\n'));
|
|
621
620
|
|
|
622
|
-
|
|
623
|
-
|
|
621
|
+
// Build the shareable SSH command
|
|
622
|
+
// Uses FIFO-based ProxyCommand for bidirectional relay through the tunnel server
|
|
623
|
+
const sshCmd = `ssh -o "ProxyCommand=bash -c 'F=\\$(mktemp -u);mkfifo \\$F;nc %h %p <\\$F & printf SUBDOMAIN:${subdomain}\\\\\\\\n >\\$F;cat >\\$F;rm \\$F'" <user>@${remoteHost} -p ${remotePort}`;
|
|
624
|
+
|
|
625
|
+
console.log(chalk.white.bold(' š Share with anyone to connect (Linux/Mac/WSL):\n'));
|
|
626
|
+
console.log(chalk.cyan(` ${sshCmd}\n`));
|
|
624
627
|
|
|
625
|
-
console.log(chalk.white.bold(' š»
|
|
626
|
-
console.log(chalk.cyan(` ssh <
|
|
628
|
+
console.log(chalk.white.bold(' š» Connect from this machine:\n'));
|
|
629
|
+
console.log(chalk.cyan(` ssh <user>@localhost -p ${localPort}\n`));
|
|
627
630
|
|
|
628
|
-
console.log(chalk.gray.italic(' Replace <
|
|
629
|
-
console.log(chalk.gray.italic(' Requires: nc (netcat) ā pre-installed on Linux/Mac/Windows 10+\n'));
|
|
631
|
+
console.log(chalk.gray.italic(' Replace <user> with the remote device\'s SSH username\n'));
|
|
630
632
|
}
|
|
631
633
|
});
|
|
632
634
|
|