修复 在使用 -allip 参数时 /32 子网掩码识别为两个 IP 的问题

This commit is contained in:
xiu2 2022-02-19 17:36:13 +08:00
parent e3c0a3a742
commit 01b105d42d
1 changed files with 3 additions and 4 deletions

View File

@ -27,6 +27,9 @@ func InitRandSeed() {
}
func randIPEndWith(num byte) byte {
if num == 0 { // 对于 /32 这种单独的 IP
return byte(0)
}
return byte(rand.Intn(int(num)))
}
@ -86,10 +89,6 @@ func (r *IPRanges) getIPRange() (minIP, hosts byte) {
hosts = 255
return
}
if total == 0 {
hosts = 1
return
}
hosts = byte(total)
return
}