silverstripeltd/submuncher

1.0 2018-04-22 21:31 UTC

This package is not auto-updated.

Last update: 2024-09-24 17:21:57 UTC


README

缩短CIDR列表的工具。

受 @andrewandante https://github.com/andrewandante/submuncher 启发。

承诺

该工具承诺将列表缩短到期望的最大大小。它还承诺所有输入地址都将包含在输出CIDR中。

它不能保证输出列表不会包含(泄漏)非输入IP。换句话说,它通过合并CIDR并使其更大来合并列表。

算法旨在最小化泄漏的大小。

示例

$longList = ['1.1.1.0', '1.1.1.1', '1.1.1.2'];
$subMuncher = new SubMuncher();
$shortList = $subMuncher->consolidate($longList, 1);
// $shortList is ['1.1.1.0/30']
echo $subMuncher->getLeakTotal();
// Outputs "1" - 1.1.1.3 was leaked.