diff --git a/src/cli-standalone.cjs b/src/cli-standalone.cjs index 5531603..8acf717 100644 --- a/src/cli-standalone.cjs +++ b/src/cli-standalone.cjs @@ -27,6 +27,9 @@ program .description('Node.js client for the relay tunnel service') .version('1.4.2'); +// Libère le raccourci -h pour l'option --host et déplace l'aide sur -H +program.helpOption('-H, --help', 'Display help for command'); + program .command('set-token ') .description('Save an authentication token for future use') diff --git a/src/cli.cjs b/src/cli.cjs index a76224b..8a0e4e1 100755 --- a/src/cli.cjs +++ b/src/cli.cjs @@ -27,6 +27,9 @@ program .description('Node.js client for the relay tunnel service') .version('1.5.1'); +// Libère le raccourci -h pour l'option --host et déplace l'aide sur -H +program.helpOption('-H, --help', 'Display help for command'); + program .command('set-token ') .description('Save an authentication token for future use') diff --git a/src/tunnel/tunnel-service.js b/src/tunnel/tunnel-service.js index 5bc9de8..0578d76 100644 --- a/src/tunnel/tunnel-service.js +++ b/src/tunnel/tunnel-service.js @@ -113,7 +113,11 @@ function startHeartbeatMonitoring(socket, lastHeartbeatReceived) { export async function connectAndServe(options, failureTracker = null) { debug('Starting tunnel service'); - + + // Normalize local host value early so it can be reused consistently + const localHost = options.host || 'localhost'; + options.host = localHost; + // Validate and use user-defined timeout or default to 30 seconds let timeoutSeconds = parseInt(options.timeout); if (isNaN(timeoutSeconds) || timeoutSeconds < 1 || timeoutSeconds > 300) { @@ -321,9 +325,9 @@ export async function connectAndServe(options, failureTracker = null) { // For TCP: publicAddr is like "tcp.relais.dev:12345" -> we need host and port separately const [publicHost, publicPort] = publicAddr.split(':'); const tunnelTypeLabel = options.type === 'tcp' ? 'TCP' : 'HTTP'; - + tunnelHealthChecker = new TunnelHealthChecker({ - localHost: options.host || 'localhost', + localHost, localPort: parseInt(options.port), tunnelType: options.type || 'http', publicUrl: publicHost,