@cubetiq/hlt
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -0,1 +1,17 @@ | ||
### 11/07/2023 (1.0.8) | ||
- Support tunnel with host with port | ||
* Prev | ||
``` | ||
hlt start 8080 -h 192.168.1.1 | ||
``` | ||
- New | ||
``` | ||
hlt start 192.168.1.1:8080 | ||
``` | ||
### 11/07/2023 (1.0.7) | ||
@@ -2,0 +18,0 @@ |
@@ -295,7 +295,47 @@ "use strict"; | ||
this.start = function (clientOptions) { return __awaiter(_this, void 0, void 0, function () { | ||
var port, _a, options, configDir, config, configFilename, configFilePath; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
var port, address, _a, options, _b, host, portStr, _c, host, portStr, configDir, config, configFilename, configFilePath; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
port = clientOptions.port, _a = clientOptions.options, options = _a === void 0 ? {} : _a; | ||
port = clientOptions.port, address = clientOptions.address, _a = clientOptions.options, options = _a === void 0 ? {} : _a; | ||
// Load host and port check | ||
if (!port) { | ||
if (!address) { | ||
console.error("port or address is required!"); | ||
return [2 /*return*/]; | ||
} | ||
_b = address.split(":"), host = _b[0], portStr = _b[1]; | ||
if (!host || !portStr) { | ||
console.error("invalid address!"); | ||
return [2 /*return*/]; | ||
} | ||
options.host = host; | ||
try { | ||
options.port = parseInt(portStr); | ||
} | ||
catch (e) { | ||
console.error("invalid port!"); | ||
return [2 /*return*/]; | ||
} | ||
} | ||
else { | ||
if (address) { | ||
_c = address.split(":"), host = _c[0], portStr = _c[1]; | ||
if (host) { | ||
options.host = host; | ||
} | ||
if (portStr) { | ||
try { | ||
options.port = parseInt(portStr); | ||
console.log("default port: ".concat(port, " will be ignored and override by port: ").concat(options.port)); | ||
} | ||
catch (e) { | ||
options.port = port; | ||
} | ||
} | ||
} | ||
else { | ||
options.port = port; | ||
} | ||
} | ||
configDir = path.resolve(os.homedir(), constant_1.PROFILE_PATH); | ||
@@ -308,3 +348,2 @@ if (!fs.existsSync(configDir)) { | ||
configFilePath = path.resolve(configDir, configFilename); | ||
// console.log(`config file: ${configFilePath}`); | ||
if (fs.existsSync(configFilePath)) { | ||
@@ -329,3 +368,3 @@ config = JSON.parse(fs.readFileSync(configFilePath, "utf8")); | ||
} | ||
options.port = port; | ||
// options.port = port; | ||
options.token = config.token; | ||
@@ -347,4 +386,3 @@ options.access = config.access; | ||
case 1: | ||
_b.sent(); | ||
// console.log("client started!"); | ||
_d.sent(); | ||
return [2 /*return*/, this]; | ||
@@ -351,0 +389,0 @@ } |
@@ -98,6 +98,9 @@ "use strict"; | ||
.description("start a connection with specific port") | ||
.argument("<port>", "local server port number", function (value) { | ||
.argument("<port> | <address>", "local server port number or address", function (value) { | ||
if ((0, util_1.isValidHost)(value)) { | ||
return value; | ||
} | ||
var port = parseInt(value, 10); | ||
if (isNaN(port)) { | ||
throw new commander_1.InvalidArgumentError("Not a number."); | ||
throw new commander_1.InvalidArgumentError("Not a number or valid address."); | ||
} | ||
@@ -113,5 +116,6 @@ return port; | ||
.option("-o, --origin <string>", "change request origin") | ||
.action(function (port, options) { | ||
.action(function (portOrAddress, options) { | ||
(0, api_1.startClient)({ | ||
port: port, | ||
port: portOrAddress, | ||
address: portOrAddress, | ||
options: options, | ||
@@ -118,0 +122,0 @@ }); |
{ | ||
"name": "@cubetiq/hlt", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "A lightweight http tunnel client using nodejs and socket.io client", | ||
@@ -5,0 +5,0 @@ "main": "dist/cli.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62871
1261