ssh-tunneling
Advanced tools
Comparing version 1.1.19 to 1.1.20
@@ -1,2 +0,2 @@ | ||
export declare const checkPortAvailable: (port: number) => Promise<unknown>; | ||
export declare const checkPortAvailable: (port: number, host?: string) => Promise<boolean>; | ||
/** | ||
@@ -3,0 +3,0 @@ * @description check whether port is idle and then return another idle port if the port pass in is unavailable |
@@ -8,6 +8,6 @@ "use strict"; | ||
const net_1 = __importDefault(require("net")); | ||
const checkPortAvailable = (port) => { | ||
const checkPortAvailable = (port, host) => { | ||
return new Promise((resolve) => { | ||
const server = net_1.default.createServer() | ||
.listen(port) | ||
.listen(port, host) | ||
.on('listening', () => { | ||
@@ -32,3 +32,8 @@ resolve(true); | ||
} | ||
const isAvailable = await (0, exports.checkPortAvailable)(port); | ||
// check the * | ||
let isAvailable = await (0, exports.checkPortAvailable)(port); | ||
if (isAvailable) { | ||
// check the localhost | ||
isAvailable = await (0, exports.checkPortAvailable)(port, '127.0.0.1'); | ||
} | ||
if (!isAvailable) { | ||
@@ -35,0 +40,0 @@ return (0, exports.getAvailablePort)(port + 1); |
{ | ||
"private": false, | ||
"name": "ssh-tunneling", | ||
"version": "1.1.19", | ||
"version": "1.1.20", | ||
"description": "a ssh-tunneling client for nodejs", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
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
45926
862