Tool for consolidating subnets
Tool for shortening CIDRs lists.
Inspired by @andrewandante https://github.com/andrewandante/submuncher.
The tool promises the list will be shortened to desired maximum size. It also promises all input addresses will be included within the output CIDRs.
It does not guarantee output list will not have ("leak") non-input IPs. In other words, it consolidates the list by merging CIDRs and making them bigger.
Algorithm aims to minimise the leak size.
$longList = ['22.214.171.124', '126.96.36.199', '188.8.131.52']; $subMuncher = new SubMuncher(); $shortList = $subMuncher->consolidate($longList, 1); // $shortList is ['184.108.40.206/30'] echo $subMuncher->getLeakTotal(); // Outputs "1" - 220.127.116.11 was leaked.