From fd0232debc015c6eca612d5001ea5c1387a06fe3 Mon Sep 17 00:00:00 2001 From: Rekryt Date: Wed, 14 May 2025 22:27:17 +0300 Subject: [PATCH] feat: make IPv6 CIDR prefix cap configurable via SYS_IP6_SUBNET_PREFIX_CAP env variable --- .env.example | 1 + README.en.md | 27 ++++++++++++++------------- README.md | 1 + src/Domain/Helper/IP6Helper.php | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.env.example b/.env.example index 3af9b8b..4e66c6c 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,7 @@ SYS_DNS_RESOLVE_IP4="true" SYS_DNS_RESOLVE_IP6="true" SYS_DNS_RESOLVE_CHUNK_SIZE="10" SYS_DNS_RESOLVE_DELAY="100" +SYS_IP6_SUBNET_PREFIX_CAP="64" SYS_MEMORY_LIMIT="1024M" SYS_TIMEZONE="Europe/Moscow" DEBUG="true" \ No newline at end of file diff --git a/README.en.md b/README.en.md index d7c7b3a..7224610 100644 --- a/README.en.md +++ b/README.en.md @@ -92,19 +92,20 @@ cp .env.example .env If needed, edit the `.env` file: -| property | default value | description | -|----------------------------|---------------|-----------------------------------------------------------------| -| COMPOSE_PROJECT_NAME | iplist | Name of the compose project | -| STORAGE_SAVE_INTERVAL | 120 | Cache save interval for whois (seconds) | -| SYS_DNS_RESOLVE_IP4 | true | Resolve IPv4 addresses | -| SYS_DNS_RESOLVE_IP6 | true | Resolve IPv6 addresses | -| SYS_DNS_RESOLVE_CHUNK_SIZE | 10 | Chunk size for retrieving DNS records | -| SYS_DNS_RESOLVE_DELAY | 100 | Delay between receiving dns records (milliseconds) | -| SYS_MEMORY_LIMIT | 1024M | Memory limit | -| SYS_TIMEZONE | Europe/Moscow | List of URLs to obtain initial CIDRv4 zones for IPv4 addresses | -| HTTP_HOST | 0.0.0.0 | IP of network interface (default is all interfaces) | -| HTTP_PORT | 8080 | Server network port (default 8080) | -| DEBUG | true | Determines the logging level | +| property | default value | description | +|----------------------------|---------------|----------------------------------------------------------------| +| COMPOSE_PROJECT_NAME | iplist | Name of the compose project | +| STORAGE_SAVE_INTERVAL | 120 | Cache save interval for whois (seconds) | +| SYS_DNS_RESOLVE_IP4 | true | Resolve IPv4 addresses | +| SYS_DNS_RESOLVE_IP6 | true | Resolve IPv6 addresses | +| SYS_DNS_RESOLVE_CHUNK_SIZE | 10 | Chunk size for retrieving DNS records | +| SYS_DNS_RESOLVE_DELAY | 100 | Delay between receiving dns records (milliseconds) | +| SYS_IP6_SUBNET_PREFIX_CAP | 64 | The maximum allowed IPv6 subnet prefix length | +| SYS_MEMORY_LIMIT | 1024M | Memory limit | +| SYS_TIMEZONE | Europe/Moscow | List of URLs to obtain initial CIDRv4 zones for IPv4 addresses | +| HTTP_HOST | 0.0.0.0 | IP of network interface (default is all interfaces) | +| HTTP_PORT | 8080 | Server network port (default 8080) | +| DEBUG | true | Determines the logging level | You can access the service in your browser via the HTTP protocol on port 8080: ``` diff --git a/README.md b/README.md index 0800ff9..715c656 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ cp .env.example .env | SYS_DNS_RESOLVE_IP6 | true | Получать ipv6 адреса | | SYS_DNS_RESOLVE_CHUNK_SIZE | 10 | Размер чанка для получения dns записей | | SYS_DNS_RESOLVE_DELAY | 100 | Задержка между получением dns записей (миллисекунды) | +| SYS_IP6_SUBNET_PREFIX_CAP | 64 | Максимально допустимая длина префикса IPv6-подсети | | SYS_MEMORY_LIMIT | 1024M | Предельное кол-во памяти. | | SYS_TIMEZONE | Europe/Moscow | Список URL для получения начальных CIDRv4 зон ipv4 адресов | | HTTP_HOST | 0.0.0.0 | IP сетевого интерфейса (по умолчанию все интерфейсы) | diff --git a/src/Domain/Helper/IP6Helper.php b/src/Domain/Helper/IP6Helper.php index e9828c9..e4bdbc3 100644 --- a/src/Domain/Helper/IP6Helper.php +++ b/src/Domain/Helper/IP6Helper.php @@ -101,7 +101,7 @@ class IP6Helper { foreach (explode(' ', $search) as $cidr) { if (str_contains($cidr, '/')) { [$address, $prefix] = explode('/', trim($cidr)); - $subnets[] = $address . '/' . min($prefix, 64); + $subnets[] = $address . '/' . min($prefix, \OpenCCK\getEnv('SYS_IP6_SUBNET_PREFIX_CAP') ?? 64); } } }