From cbc8877b4d34308d8b3d3d999235dfb7eaaa93e6 Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Tue, 6 Aug 2024 20:21:53 +0300 Subject: [PATCH] fix: logic --- lib/Server.js | 6 +++--- test/cli/host-option.test.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Server.js b/lib/Server.js index 5099b6cbc1..6e8aa557de 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -464,12 +464,12 @@ class Server { static async getHostname(hostname) { if (hostname === "local-ip") { return ( - Server.internalIPSync("v4") || Server.internalIPSync("v6") || "0.0.0.0" + Server.findIp("v4", false) || Server.findIp("v6", false) || "0.0.0.0" ); } else if (hostname === "local-ipv4") { - return Server.internalIPSync("v4") || "0.0.0.0"; + return Server.findIp("v4", false) || "0.0.0.0"; } else if (hostname === "local-ipv6") { - return Server.internalIPSync("v6") || "::"; + return Server.findIp("v6", false) || "::"; } return hostname; diff --git a/test/cli/host-option.test.js b/test/cli/host-option.test.js index 6355b42df1..7bac842e2c 100644 --- a/test/cli/host-option.test.js +++ b/test/cli/host-option.test.js @@ -4,8 +4,8 @@ const { testBin, normalizeStderr } = require("../helpers/test-bin"); const port = require("../ports-map")["cli-host"]; const Server = require("../../lib/Server"); -const localIPv4 = Server.internalIPSync("v4"); -const localIPv6 = Server.internalIPSync("v6"); +const localIPv4 = Server.findIp("v4", false); +const localIPv6 = Server.findIp("v6", false); describe('"host" CLI option', () => { it('should work using "--host 0.0.0.0" (IPv4)', async () => {