I would like to find the remaining IPs in a range (CIDR). For example:
prefixLen, bits := n.Mask.Size()
return 1 << (uint64(bits) - uint64(prefixLen)), nil
This return the # of IPs in the range where n
is *net.IPNet
.
But say if I have few addresses that are already given out and want to know how many are left 'starting' from some IP addresses, how can I do it?