Skip to content

11.0.0

Latest
Compare
Choose a tag to compare
@silverwind silverwind released this 24 Jul 19:36
· 9 commits to master since this release
11.0.0
c26e235

expandCidr now returns a generator instead of array to enable immediate consumption of generated IPs and eliminate a potential memory/performance problem in the module. To migrate previous Array use cases:

expandCidr(nets) -> Array.from(expandCidr(nets))

Be aware that passing large networks that contain millions of IPs can result in memory exhaustion and slow execution time. It's recommended to validate the amount of IPs first, for example, like this:

const {start, end} = parseCidr(net);
if (end - start >= 1000000n) {
  throw new Error("Too many IPs");
}