Skip to content

Instantly share code, notes, and snippets.

@intolerance
Last active October 17, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save intolerance/13f657d3765d9e950178f1bf4418d1c9 to your computer and use it in GitHub Desktop.
Save intolerance/13f657d3765d9e950178f1bf4418d1c9 to your computer and use it in GitHub Desktop.
Netmask for IP traversing
import { Netmask } from 'netmask';
const block = new Netmask('192.168.150.0/21'); // 21 === 255.255.248.0 subnet
console.log(block.mask);
block.forEach(comp => {
console.log(comp);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment