athlon1600/php-cidr-range-optimizer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

athlon1600/php-cidr-range-optimizer

最新稳定版本:v1.0.2

Composer 安装命令:

composer require athlon1600/php-cidr-range-optimizer

包简介

Given a list of IP ranges, merge them into the smallest possible list of CIDRs.

README 文档

README

Minimum PHP Version GitHub Workflow Status (with event)

Given a list of IP address ranges, minify that list to the smallest possible size by performing the following optimizations:

  • removing invalid IP addresses/ranges from the list
  • removing duplicates
  • removing IP ranges already covered by larger ranges in the list
  • merging adjacent IP ranges into larger, contiguous blocks

⭐ Demo

An online tool that uses a near exact version of this library:

Installation

composer require athlon1600/php-cidr-range-optimizer

Usage

Build your list of IP ranges into CIDRList object, then use RangeOptimizer class to optimize it. Example:

use ProxyNova\RangeOptimizer\CIDRList;
use ProxyNova\RangeOptimizer\RangeOptimizer;

$ranges = CIDRList::fromArray([
    "192.168.1.0/26",
    "192.168.1.64/27",
    "192.168.1.96/27",
    "10.1.0.0/26",
    "10.1.0.64/26"
]);

// returns new optimized CIDRList object
$optimized = RangeOptimizer::optimize($ranges);

echo $optimized;

Output:

10.1.0.0/25
192.168.1.0/25

统计信息

  • 总下载量: 77
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固