Denozordec d7a63f0da3
Publish telemt-api gateway Docker image / test (push) Failing after 17s
Publish telemt-api gateway Docker image / build-and-push (push) Has been skipped
Add GeoIP support for unique IP aggregation
- Introduced GeoIP configuration options in config.example.yaml to enable geolocation lookups for the /api/agg/unique-ips endpoint.
- Updated the aggregate handler to include optional GeoIP data in responses, enriching unique IP information with country and city details, as well as ASN data if available.
- Enhanced documentation in AGGREGATE.md and README.md to reflect the new GeoIP functionality and its usage.
- Added a dependency on the geoip2-golang library in go.mod for GeoIP lookups.
- Modified tests to accommodate the new GeoIP integration in the aggregate handler.
2026-03-30 01:47:08 +07:00
2026-03-29 22:51:02 +07:00
2026-03-29 22:51:02 +07:00
2026-03-29 22:51:02 +07:00

telemt-api

HTTP‑шлюз на Go для Telemt Control API: один порт, белый список IP (CIDR), маршруты вида /api/{alias}/…{base_url}/v1/…, агрегация нескольких инстансов — /api/agg/…, метрики Prometheus на /metrics.

Быстрый старт (Linux)

Предполагается установлены Docker и Docker Compose v2.

Рекомендуется брать уже собранный образ из Container Registry Gitea (после каждого push в репозиторий CI обновляет теги, в том числе latest):

# при необходимости (закрытый registry): логин Gitea + PAT с read:package
docker login git.shts.su

docker pull git.shts.su/denozord/telemt-api:latest

Конфиг возьмите из репозитория или создайте свой config.yaml (см. config.example.yaml):

git clone <url-репозитория> && cd telemt-api
cp config.example.yaml config.yaml
# отредактируйте config.yaml: servers, whitelist_cidrs или allow_all для разработки

docker run -d --name telemt-gateway \
  -p 8080:8080 \
  -v "$(pwd)/config.yaml:/etc/telemt-gateway/config.yaml:ro" \
  -e CONFIG_PATH=/etc/telemt-gateway/config.yaml \
  git.shts.su/denozord/telemt-api:latest

curl -sS http://127.0.0.1:8080/health
curl -sS http://127.0.0.1:8080/api/main_srv/health

Обновление образа: docker pull git.shts.su/denozord/telemt-api:latest и пересоздайте контейнер (docker rm -f telemt-gateway и снова docker run …).

Compose

Тот же образ подтягивается из registry (без локальной сборки):

git clone <url-репозитория> && cd telemt-api
docker compose pull
docker compose up -d
docker compose logs -f gateway

Локальная сборка образа

Если нужен образ из исходников на этой машине: docker build -t telemt-api-gateway:local . и в docker run укажите тег telemt-api-gateway:local. Подробнее — docs/GATEWAY_RUN.md.

Документация

Документ Содержание
docs/GATEWAY_RUN.md Полная инструкция: конфиг, pull/registry, Docker CLI, Compose, CI/CD, неполадки
docs/API.md Контракт Telemt Control API (/v1/…)
docs/AGGREGATE.md Агрегирующие эндпоинты шлюза (/api/agg/…)
docs/GEOIP.md GeoLite2 City (страна/город) и опционально ASN (номер AS, организация) для IP в unique-ips

Сборка и тесты без Docker

go mod tidy && go test ./...

CI/CD

В репозитории: .gitea/workflows/docker.yaml — тесты Go, сборка и публикация образа в Container Registry Gitea (см. раздел «Обновление и CI/CD» в docs/GATEWAY_RUN.md).

S
Description
Telemt API MultiProxy
Readme
1.9 MiB
Languages
Svelte 67.4%
Go 20.9%
TypeScript 10.3%
CSS 1%
Dockerfile 0.2%
Other 0.2%