Files
telemt-api/config.example.yaml
T
Denozordec a24fc90b39
Publish telemt-api gateway Docker image / test (push) Successful in 30s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 41s
Enhance Mihomo configuration documentation in example YAML
- Expanded comments in `config.example.yaml` to provide detailed guidance on setting up the Mihomo external-controller integration.
- Included typical Docker Compose configuration examples and environment variable usage for better clarity on Mihomo setup.
- Clarified the relationship between the gateway and Mihomo service for improved user understanding.
2026-03-31 00:35:54 +07:00

103 lines
4.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Telemt API gateway — copy to config.yaml and mount into the container.
#
# Semantics: client calls GET /api/{alias}/health
# forwarded to GET {base_url}/v1/health
#
# Web UI (SvelteKit) в образе Docker встроен в тот же процесс: GET / — панель,
# /api/… — API. CORS для панели на том же origin не нужен.
listen: ":8080"
# If true, IP whitelist is not enforced (development only).
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"
# When the direct TCP peer is in these CIDRs, client IP for whitelist is taken
# from X-Forwarded-For (first hop) or X-Real-IP (e.g. behind nginx).
# trusted_proxies:
# - "10.0.0.0/8"
trusted_proxies: []
# CORS только если фронт на другом origin (например Vite :5173 при разработке).
# В production за nginx на одном хосте с шлюзом обычно не требуется.
# cors_allowed_origins:
# - "http://localhost:5173"
# # - "*"
# Опционально: по умолчанию /api/agg/* опрашивает все servers; можно ограничить список и включить кэш ответов:
# aggregate:
# include_aliases:
# - gt1
# - gt2
# cache_ttl_ms: 2000
# Геолокация IP в /api/agg/unique-ips. См. docs/GEOIP.md (City + опционально ASN; Country-only не нужен)
# geoip:
# enabled: true
# database_path: /var/lib/telemt-gateway/GeoLite2-City.mmdb
# download_url: "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb"
# asn_database_path: /var/lib/telemt-gateway/GeoLite2-ASN.mmdb
# asn_download_url: "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb"
servers:
- alias: main_srv
base_url: http://127.0.0.1:9091
path_prefix: /v1
# authorization_env: TELEMT_API_AUTH
#
# --- Mihomo (Clash Meta), раздел «Mihomo» в панели (/servers/{alias}/mihomo) ---
# Клиент: GET /api/{alias}/mihomo/… и WebSocket — шлюз проксирует на external-controller с Bearer.
#
# Типичный compose для самого Mihomo (отдельный файл или сервис рядом с gateway):
# mihomo:
# build: ./mihomo
# container_name: mihomo
# environment:
# - SUB_URL=https://example.com/sub
# - CLASH_SECRET=your-secret-here
# - UPDATE_INTERVAL=86400
# # ports: # публиковать 9090 на хост не обязательно для панели
# # - "9080:9090"
# networks:
# proxy-net:
# ipv4_address: 172.20.0.2 # пример; контроллер слушает на 9090 внутри контейнера
#
# Контейнер gateway (telemt-api) должен быть в той же сети proxy-net, чтобы:
# - резолвилось имя сервиса http://mihomo:9090, или
# - использовался IP внутри сети, например http://172.20.0.2:9090
#
# В environment сервиса gateway (не класть секреты в YAML в git):
# MIHOMO_CONTROLLER_URL=http://mihomo:9090
# TELEMT_MIHOMO_AUTH=Bearer <тот же секрет, что CLASH_SECRET у Mihomo>
#
# Вариант A — URL в YAML:
# mihomo_base_url: http://mihomo:9090
# mihomo_authorization_env: TELEMT_MIHOMO_AUTH
#
# Вариант B — URL из env (удобно в compose, без правки смонтированного config.yaml):
# mihomo_base_url_env: MIHOMO_CONTROLLER_URL
# mihomo_authorization_env: TELEMT_MIHOMO_AUTH
#
# Значение mihomo_authorization_env: полная строка заголовка Authorization (как у authorization_env для Telemt).
# ivx: HTTPS + nginx location /api/ → Telemt; base_url должен заканчиваться на /api/
- alias: gt1
base_url: https://gt1.ivx.su/api/
path_prefix: /v1
- alias: gt2
base_url: https://gt2.ivx.su/api/
path_prefix: /v1
- alias: gt3
base_url: https://gt3.ivx.su/api/
path_prefix: /v1