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 = ['126.96.36.199', '188.8.131.52', '184.108.40.206']; $subMuncher = new SubMuncher(); $shortList = $subMuncher->consolidate($longList, 1); // $shortList is ['220.127.116.11/30'] echo $subMuncher->getLeakTotal(); // Outputs "1" - 18.104.22.168 was leaked.