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