mybase 1.1.11 → 1.1.12
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/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This function should be used for testing purposes only
|
|
5
5
|
* This function is not suitable for production use
|
|
6
6
|
* @param timeout the timeout for each port check
|
|
7
|
-
* @param fromPort the first port number to check defaults to
|
|
8
|
-
* @param untilPort the last port number to check defaults to
|
|
7
|
+
* @param fromPort the first port number to check defaults to 1025
|
|
8
|
+
* @param untilPort the last port number to check defaults to 65534
|
|
9
9
|
* @param tries the number of tries to find a port number
|
|
10
10
|
* @param host the host to bind to
|
|
11
11
|
*/
|
|
@@ -40,12 +40,12 @@ const net = __importStar(require("net"));
|
|
|
40
40
|
* This function should be used for testing purposes only
|
|
41
41
|
* This function is not suitable for production use
|
|
42
42
|
* @param timeout the timeout for each port check
|
|
43
|
-
* @param fromPort the first port number to check defaults to
|
|
44
|
-
* @param untilPort the last port number to check defaults to
|
|
43
|
+
* @param fromPort the first port number to check defaults to 1025
|
|
44
|
+
* @param untilPort the last port number to check defaults to 65534
|
|
45
45
|
* @param tries the number of tries to find a port number
|
|
46
46
|
* @param host the host to bind to
|
|
47
47
|
*/
|
|
48
|
-
function randomTCPPort(timeout = 1000, fromPort =
|
|
48
|
+
function randomTCPPort(timeout = 1000, fromPort = 1025, untilPort = 65534, tries = 1000, host = '127.0.0.1') {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
50
|
// check if the given port range is valid
|
|
51
51
|
if (fromPort > untilPort)
|
|
@@ -6,12 +6,12 @@ import * as net from 'net'
|
|
|
6
6
|
* This function should be used for testing purposes only
|
|
7
7
|
* This function is not suitable for production use
|
|
8
8
|
* @param timeout the timeout for each port check
|
|
9
|
-
* @param fromPort the first port number to check defaults to
|
|
10
|
-
* @param untilPort the last port number to check defaults to
|
|
9
|
+
* @param fromPort the first port number to check defaults to 1025
|
|
10
|
+
* @param untilPort the last port number to check defaults to 65534
|
|
11
11
|
* @param tries the number of tries to find a port number
|
|
12
12
|
* @param host the host to bind to
|
|
13
13
|
*/
|
|
14
|
-
export async function randomTCPPort(timeout:number=1000,fromPort:number=
|
|
14
|
+
export async function randomTCPPort(timeout:number=1000,fromPort:number=1025,untilPort:number=65534,tries=1000,host='127.0.0.1') : Promise<number|false> {
|
|
15
15
|
// check if the given port range is valid
|
|
16
16
|
if (fromPort>untilPort) return false
|
|
17
17
|
// check if the given port range is valid
|