Skip to content

Commit

Permalink
fix: getServer() should get all IP addresses
Browse files Browse the repository at this point in the history
getServer() should include the first and the last ip address in the
subnet.

closes #71
  • Loading branch information
john.ewalt committed Jun 3, 2024
1 parent 8763bbd commit f58cd01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++))
}
}
}
Expand Down

0 comments on commit f58cd01

Please sign in to comment.