Enhance configuration and documentation for CIDR and IP handling. Updated config.example.yaml to include additional whitelisted IPs and new server entries. Improved GATEWAY_RUN.md to clarify CIDR and single IP usage. Implemented parseCIDROrIP function in config.go for better validation of IP formats in whitelist and trusted proxies.
Publish telemt-api gateway Docker image / test (push) Successful in 39s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 1m45s

This commit is contained in:
Denozordec
2026-03-30 00:00:49 +07:00
parent 073d2b2c09
commit e58f504395
4 changed files with 56 additions and 7 deletions
+15 -3
View File
@@ -9,8 +9,10 @@ listen: ":8080"
allow_all: false
# CIDR allowlist when allow_all is false. Empty list denies all clients.
# Можно указывать и одиночный IP (будет трактован как /32 или /128), и CIDR.
whitelist_cidrs:
- "127.0.0.1/32"
- "203.0.113.5"
- "::1/128"
# Docker bridge (adjust to your environment):
# - "172.16.0.0/12"
@@ -24,8 +26,18 @@ trusted_proxies: []
servers:
- alias: main_srv
base_url: http://127.0.0.1:9091
# Default path prefix on upstream (Telemt Control API uses /v1).
path_prefix: /v1
# Optional: name of environment variable whose value is sent as Authorization
# to this upstream (exact string, Telemt auth_header semantics).
# authorization_env: TELEMT_API_AUTH
# ivx: порт 9091 как у типичного Telemt API; при необходимости — https и другой порт.
- alias: gt1
base_url: http://gt1.ivx.su:9091
path_prefix: /v1
- alias: gt2
base_url: http://gt2.ivx.su:9091
path_prefix: /v1
- alias: gt3
base_url: http://gt3.ivx.su:9091
path_prefix: /v1