From f58cd01c2d199947a94c5e2f431a3267790d701d Mon Sep 17 00:00:00 2001 From: "john.ewalt" Date: Fri, 3 May 2024 13:43:21 -0600 Subject: [PATCH] fix: getServer() should get all IP addresses getServer() should include the first and the last ip address in the subnet. closes #71 --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 66dd8b5..0c4e895 100644 --- a/src/index.js +++ b/src/index.js @@ -65,8 +65,8 @@ function getServers () { if (address.family === 'IPv4' && !address.internal) { var subnet = ip.subnet(address.address, address.netmask) var current = ip.toLong(subnet.firstAddress) - var last = ip.toLong(subnet.lastAddress) - 1 - while (current++ < last) result.push(ip.fromLong(current)) + var last = ip.toLong(subnet.lastAddress) + while (current <= last) result.push(ip.fromLong(current++)) } } }