Functional Weave
Code in Rust

net.cidr-hosts@1.0.0

README.md

636 bytes · view raw

# net.cidr-hosts

Expand an IPv4 block into its usable host addresses, first to last, for a
ping or port sweep.

- "Usable" follows `net.cidr`'s `cidrInfo`: the network and broadcast
  addresses are left out from /0 to /30; a /31 gives both addresses (RFC
  3021) and a /32 the one.
- Host bits in the block are dropped, so `10.0.0.13/29` sweeps `10.0.0.8/29`.
- `maxCount` is required. A sweep of `10.0.0.0/8` (16,777,214 hosts) is
  almost always a typo for a /28; the call fails and says how many hosts the
  block has instead of quietly building a sixteen-million-item list.
- IPv4 only: an IPv6 /64 cannot be swept by enumeration.