api-response-manager 2.6.6 → 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.
Files changed (2) hide show
  1. package/commands/tunnel.js +21 -15
  2. package/package.json +1 -1
@@ -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 and start local proxy
156
+ // Show TCP/SSH specific info
157
157
  if (isTcpTunnel && message.tcpHost && message.tcpPort) {
158
- // Start a local TCP proxy that transparently handles subdomain multiplexing
159
- startLocalTcpProxy(subdomain, message.tcpHost, message.tcpPort, silent);
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
  }
@@ -612,17 +611,24 @@ function startLocalTcpProxy(subdomain, remoteHost, remotePort, silent) {
612
611
  });
613
612
  });
614
613
 
615
- // Listen on port 0 to get a random available port
616
- localProxyServer.listen(0, '127.0.0.1', () => {
614
+ // Listen on port 0 to get a random available port, bind to 0.0.0.0 for network access
615
+ localProxyServer.listen(0, '0.0.0.0', () => {
617
616
  const localPort = localProxyServer.address().port;
618
617
 
619
618
  if (!silent) {
620
619
  console.log(chalk.yellow.bold('šŸ”Œ SSH/TCP Tunnel Ready!\n'));
621
- console.log(chalk.white(' Connect via SSH:\n'));
622
- console.log(chalk.cyan.bold(` ssh <username>@localhost -p ${localPort}\n`));
623
- console.log(chalk.gray(' SSH with Key:'));
624
- console.log(chalk.cyan(` ssh -i ~/.ssh/your_key <username>@localhost -p ${localPort}\n`));
625
- console.log(chalk.gray.italic(` Replace <username> with your device's SSH username\n`));
620
+
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`));
627
+
628
+ console.log(chalk.white.bold(' šŸ’» Connect from this machine:\n'));
629
+ console.log(chalk.cyan(` ssh <user>@localhost -p ${localPort}\n`));
630
+
631
+ console.log(chalk.gray.italic(' Replace <user> with the remote device\'s SSH username\n'));
626
632
  }
627
633
  });
628
634
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-response-manager",
3
- "version": "2.6.6",
3
+ "version": "2.6.8",
4
4
  "description": "Command-line interface for API Response Manager",
5
5
  "main": "index.js",
6
6
  "bin": {