Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a30582fa38 | ||
|
|
5b1ce14467 | ||
|
|
264b438cdb | ||
|
|
f699aefa58 | ||
|
|
8d40e76637 | ||
|
|
e2b4becfd6 | ||
|
|
e4ef2d8645 | ||
|
|
bfc28503d5 | ||
|
|
d759f883f4 | ||
|
|
64373fdf3c | ||
|
|
1dd566593e | ||
|
|
560c1f22c4 | ||
|
|
171b85f627 | ||
|
|
734b83b2b8 |
No files matched your search
@@ -0,0 +1,60 @@
|
|||||||
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
APP_NAME: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
attestations: write
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Get version from tag
|
||||||
|
id: version_reader
|
||||||
|
run: |
|
||||||
|
VERSION=${GITHUB_REF_NAME#v}
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: docker-container
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push Docker image
|
||||||
|
id: push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
||||||
|
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
|
||||||
|
build-args: |
|
||||||
|
app_name=${{ env.APP_NAME }}
|
||||||
|
version=${{ steps.version_reader.outputs.version }}
|
||||||
|
- name: Generate artifact attestation
|
||||||
|
uses: actions/attest-build-provenance@v2
|
||||||
|
with:
|
||||||
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
||||||
|
subject-digest: ${{ steps.push.outputs.digest }}
|
||||||
|
push-to-registry: true
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
include:
|
||||||
|
- project: '$CI_PROJECT_PATH'
|
||||||
|
file: '/ci-isp-go-service.yml'
|
||||||
+73
-60
@@ -1,66 +1,79 @@
|
|||||||
|
version: "2"
|
||||||
run:
|
run:
|
||||||
allow-parallel-runners: true
|
allow-parallel-runners: true
|
||||||
issues:
|
|
||||||
exclude-rules:
|
|
||||||
- path: controller #достаточное кол-во контекса на уровне контроллеров
|
|
||||||
linters:
|
|
||||||
- wrapcheck
|
|
||||||
- path: transaction #транзакции прозрачны
|
|
||||||
linters:
|
|
||||||
- wrapcheck
|
|
||||||
- path: middleware #отсутствует необходимость оборачивать ошибки
|
|
||||||
linters:
|
|
||||||
- wrapcheck
|
|
||||||
- path: proxy
|
|
||||||
linters:
|
|
||||||
- gochecknoglobals
|
|
||||||
- mnd
|
|
||||||
- path: httperrors #отсутствует необходимость оборачивать ошибки
|
|
||||||
linters:
|
|
||||||
- wrapcheck
|
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
default: all
|
||||||
disable:
|
disable:
|
||||||
- goimports #у нас собственные правила форматирования импортов
|
- contextcheck # не имеет смысла
|
||||||
- wsl #расставление пробелов очень индивидуально
|
- depguard # не всегда имеет смысл
|
||||||
- exhaustivestruct #не имеет смысла
|
- dupword # не имеет смысла
|
||||||
- varnamelen #очень индивидуально (db)
|
- exhaustruct # не имеет смысла
|
||||||
- exhaustruct #не имеет смысла
|
- godot # не актуально для swagger
|
||||||
- golint #устарел
|
- godox # не позволяет оставлять todo
|
||||||
- contextcheck #не имеет смысла
|
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
|
||||||
- gci #у нас собственные правила форматирования импортов
|
- nlreturn # не всегда имеет смысл
|
||||||
- gofumpt #у нас собственные правила форматирования импортов
|
- nolintlint # Goland все равно форматирует с отступом
|
||||||
- nolintlint #Goland все равно форматирует с отступом
|
- perfsprint # мнимая производительность в угоду читаемости
|
||||||
- nlreturn #не всегда имеет смысл
|
- tagalign # не всегда имеет смысл
|
||||||
- godot #не актуально для свагера
|
|
||||||
- ifshort #приняли решение, что мы так не пишем if err := ...; err != nil {}
|
|
||||||
- godox #не позволяет оставлять todo
|
|
||||||
- maligned #аллокацией памяти для структур конфликтует с удобством их чтения
|
|
||||||
- nosnakecase #не позволяет заводить пакеты используя snake_case
|
|
||||||
- depguard #не всегда имеет смысл
|
|
||||||
- dupword #не имеет смысла
|
|
||||||
- tagalign #не всегда имеет смысл
|
|
||||||
- musttag #у нас собственные правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внених для нас структур
|
|
||||||
- perfsprint #мнимая производительность в угоду читаемости
|
|
||||||
- testpackage
|
- testpackage
|
||||||
linters-settings:
|
- varnamelen # очень индивидуально (db)
|
||||||
funlen:
|
- wsl # расставление пробелов очень индивидуально
|
||||||
lines: 80
|
settings:
|
||||||
lll:
|
cyclop:
|
||||||
line-length: 150
|
max-complexity: 15 # по умолчанию 10 мало
|
||||||
cyclop:
|
funlen:
|
||||||
max-complexity: 15 #по умолчанию 10 мало
|
lines: 80
|
||||||
revive:
|
lll:
|
||||||
|
line-length: 150
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
- name: var-naming # отключаем Id -> ID
|
||||||
|
disabled: true
|
||||||
|
staticcheck:
|
||||||
|
checks: # отключаем Id -> ID
|
||||||
|
- -ST1000
|
||||||
|
- -ST1016
|
||||||
|
- -ST1020
|
||||||
|
- -ST1021
|
||||||
|
- -ST1022
|
||||||
|
testifylint:
|
||||||
|
disable:
|
||||||
|
- compares
|
||||||
|
- equal-values
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
rules:
|
rules:
|
||||||
- name: var-naming #отключаем Id -> ID
|
- linters:
|
||||||
disabled: true
|
- wrapcheck
|
||||||
stylecheck:
|
path: controller # достаточное кол-во контекста на уровне контроллеров
|
||||||
checks: #отключаем Id -> ID
|
- linters:
|
||||||
- "-ST1000"
|
- wrapcheck
|
||||||
- "-ST1016"
|
path: transaction # транзакции прозрачны
|
||||||
- "-ST1020"
|
- linters:
|
||||||
- "-ST1021"
|
- wrapcheck
|
||||||
- "-ST1022"
|
path: middleware #отсутствует необходимость оборачивать ошибки
|
||||||
testifylint:
|
- linters:
|
||||||
disable:
|
- gochecknoglobals
|
||||||
- compares
|
- mnd
|
||||||
|
path: proxy
|
||||||
|
- linters:
|
||||||
|
- wrapcheck
|
||||||
|
path: httperrors #отсутствует необходимость оборачивать ошибки
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
@@ -1,3 +1,23 @@
|
|||||||
|
### v5.2.9
|
||||||
|
* взаимодействие напрямую с `redis` заменено на взаимодействие с `isp-lock-service`
|
||||||
|
### v5.2.8
|
||||||
|
* добавлена обработка эндпоинта в двух форматах: с `/` в начале и без
|
||||||
|
* обновлены зависимости
|
||||||
|
### v5.2.7
|
||||||
|
* добавлен `Dockerfile` и скрипт для сборки и публикации образа в `GitHub Contaier Registry`
|
||||||
|
* обновлены зависимости
|
||||||
|
### v5.2.6
|
||||||
|
* исправлен баг с отсутствием проверки разрешенных действий
|
||||||
|
### v5.2.5
|
||||||
|
* добавлено новое поле `enableForceUnescapingUnicode` в конфигурации для очистки тела запроса от экранирования unicode символов при логирование
|
||||||
|
* реализована поддержка очистки тела запроса от экранирования unicode символов для корректного логирования
|
||||||
|
* обновлены зависимости
|
||||||
|
### v5.2.4
|
||||||
|
* обновлены зависимости
|
||||||
|
### v5.2.3
|
||||||
|
* добавлен заголовок `X-Request-Id` в ответ при проксировании grpc
|
||||||
|
* обновлены зависимости
|
||||||
|
* обновлена версия go до 1.24
|
||||||
### v5.2.1
|
### v5.2.1
|
||||||
* добавлен параметр для настройки проброса `requestId` из заголовка запроса
|
* добавлен параметр для настройки проброса `requestId` из заголовка запроса
|
||||||
* добавлено логирование содержимого заголовка `requestId` из заголовка запроса (поле `clientRequestId`)
|
* добавлено логирование содержимого заголовка `requestId` из заголовка запроса (поле `clientRequestId`)
|
||||||
|
|||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
FROM golang:1.24-alpine as builder
|
||||||
|
WORKDIR /build
|
||||||
|
ARG version
|
||||||
|
ENV version_env=$version
|
||||||
|
ARG app_name
|
||||||
|
ENV app_name_env=$app_name
|
||||||
|
COPY . .
|
||||||
|
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||||
|
--mount=type=bind,source=go.sum,target=go.sum \
|
||||||
|
--mount=type=bind,source=go.mod,target=go.mod \
|
||||||
|
go mod download -x
|
||||||
|
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||||
|
--mount=type=bind,target=. \
|
||||||
|
go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||||
|
|
||||||
|
FROM alpine:3.21
|
||||||
|
|
||||||
|
RUN apk add --no-cache tzdata
|
||||||
|
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||||
|
RUN echo "Europe/Moscow" > /etc/timezone
|
||||||
|
|
||||||
|
ARG UID=10001
|
||||||
|
RUN adduser \
|
||||||
|
--disabled-password \
|
||||||
|
--gecos "" \
|
||||||
|
--home "/nonexistent" \
|
||||||
|
--shell "/sbin/nologin" \
|
||||||
|
--no-create-home \
|
||||||
|
--uid "${UID}" \
|
||||||
|
appuser
|
||||||
|
|
||||||
|
RUN mkdir -p /app/data
|
||||||
|
RUN chown appuser:appuser /app/data
|
||||||
|
VOLUME /app/data
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ARG app_name
|
||||||
|
ENV app_name_env=$app_name
|
||||||
|
COPY --from=builder main /app/$app_name_env
|
||||||
|
COPY /conf/config.yml /app/config.yml
|
||||||
|
COPY /conf/default_remote_config.json* /app/default_remote_config.json
|
||||||
|
|
||||||
|
ENTRYPOINT /app/$app_name_env
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
FROM dockerhub.mos.ru/mosos/arbat:15.5 as builder
|
||||||
|
RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.24 git
|
||||||
|
WORKDIR /build
|
||||||
|
ARG version
|
||||||
|
ENV version_env=$version
|
||||||
|
ARG app_name
|
||||||
|
ENV app_name_env=$app_name
|
||||||
|
COPY . .
|
||||||
|
ENV GOPROXY=https://repo-mirror.mos.ru/repository/go-public
|
||||||
|
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||||
|
|
||||||
|
FROM dockerhub.mos.ru/mosos/arbat:15.5
|
||||||
|
|
||||||
|
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||||
|
RUN echo "Europe/Moscow" > /etc/timezone
|
||||||
|
|
||||||
|
ARG UID=10001
|
||||||
|
RUN useradd \
|
||||||
|
--home "/nonexistent" \
|
||||||
|
--shell "/sbin/nologin" \
|
||||||
|
--no-create-home \
|
||||||
|
--uid "${UID}" \
|
||||||
|
--user-group \
|
||||||
|
appuser
|
||||||
|
|
||||||
|
RUN mkdir -p /app/data
|
||||||
|
RUN chown appuser:appuser /app/data
|
||||||
|
VOLUME /app/data
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ARG app_name
|
||||||
|
ENV app_name_env=$app_name
|
||||||
|
COPY --from=builder main /app/$app_name_env
|
||||||
|
COPY /conf/config.yml /app/config.yml
|
||||||
|
COPY /conf/default_remote_config.json* /app/default_remote_config.json
|
||||||
|
COPY /migrations /app/migrations
|
||||||
|
|
||||||
|
ENTRYPOINT /app/$app_name_env
|
||||||
+18
-47
@@ -3,7 +3,6 @@ package assembly
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"isp-gate-service/conf"
|
"isp-gate-service/conf"
|
||||||
"isp-gate-service/routes"
|
"isp-gate-service/routes"
|
||||||
|
|
||||||
@@ -22,9 +21,9 @@ type Assembly struct {
|
|||||||
server *http.Server
|
server *http.Server
|
||||||
logger *log.Adapter
|
logger *log.Adapter
|
||||||
routes *routes.Routes
|
routes *routes.Routes
|
||||||
redisCli redis.UniversalClient
|
|
||||||
systemCli *client.Client
|
systemCli *client.Client
|
||||||
adminCli *client.Client
|
adminCli *client.Client
|
||||||
|
lockerCli *client.Client
|
||||||
|
|
||||||
locations []conf.Location
|
locations []conf.Location
|
||||||
grpcClientByModuleName map[string]*client.Client
|
grpcClientByModuleName map[string]*client.Client
|
||||||
@@ -62,11 +61,14 @@ func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.WithMessage(err, "create system cli")
|
return nil, errors.WithMessage(err, "create system cli")
|
||||||
}
|
}
|
||||||
|
|
||||||
adminCli, err := client.Default()
|
adminCli, err := client.Default()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.WithMessage(err, "create admin cli")
|
return nil, errors.WithMessage(err, "create admin cli")
|
||||||
}
|
}
|
||||||
|
lockerCli, err := client.Default()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "create isp-lock-service client")
|
||||||
|
}
|
||||||
|
|
||||||
return &Assembly{
|
return &Assembly{
|
||||||
boot: boot,
|
boot: boot,
|
||||||
@@ -78,6 +80,7 @@ func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
|
|||||||
httpHostManagerByModuleName: httpHostManagerByModuleName,
|
httpHostManagerByModuleName: httpHostManagerByModuleName,
|
||||||
systemCli: systemCli,
|
systemCli: systemCli,
|
||||||
adminCli: adminCli,
|
adminCli: adminCli,
|
||||||
|
lockerCli: lockerCli,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,32 +93,24 @@ func (a *Assembly) ReceiveConfig(ctx context.Context, remoteConfig []byte) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
a.logger.Fatal(ctx, errors.WithMessage(err, "upgrade remote config"))
|
a.logger.Fatal(ctx, errors.WithMessage(err, "upgrade remote config"))
|
||||||
}
|
}
|
||||||
err = newCfg.Validate()
|
|
||||||
if err != nil {
|
|
||||||
a.logger.Fatal(ctx, errors.WithMessage(err, "invalid remote config"))
|
|
||||||
}
|
|
||||||
|
|
||||||
a.logger.SetLevel(newCfg.Logging.LogLevel)
|
a.logger.SetLevel(newCfg.Logging.LogLevel)
|
||||||
|
|
||||||
var newRedisCli redis.UniversalClient
|
locator := NewLocator(
|
||||||
if newCfg.Redis != nil {
|
a.logger,
|
||||||
newRedisCli = a.redisClient(*newCfg.Redis)
|
a.grpcClientByModuleName,
|
||||||
}
|
a.httpHostManagerByModuleName,
|
||||||
|
a.routes,
|
||||||
locator := NewLocator(a.logger, a.grpcClientByModuleName, a.httpHostManagerByModuleName, a.routes, a.systemCli, a.adminCli)
|
a.systemCli,
|
||||||
|
a.adminCli,
|
||||||
handler, err := locator.Handler(newCfg, a.locations, newRedisCli)
|
a.lockerCli,
|
||||||
|
)
|
||||||
|
handler, err := locator.Handler(newCfg, a.locations)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "locator handler")
|
return errors.WithMessage(err, "locator handler")
|
||||||
}
|
}
|
||||||
|
|
||||||
a.server.Upgrade(handler)
|
a.server.Upgrade(handler)
|
||||||
|
|
||||||
if a.redisCli != nil {
|
|
||||||
_ = a.redisCli.Close()
|
|
||||||
a.redisCli = newRedisCli
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,9 +125,9 @@ func (a *Assembly) Runners() []app.Runner {
|
|||||||
for moduleName, upgrader := range a.httpHostManagerByModuleName {
|
for moduleName, upgrader := range a.httpHostManagerByModuleName {
|
||||||
eventHandler.RequireModule(moduleName, upgrader)
|
eventHandler.RequireModule(moduleName, upgrader)
|
||||||
}
|
}
|
||||||
|
|
||||||
eventHandler.RequireModule("isp-system-service", a.systemCli)
|
eventHandler.RequireModule("isp-system-service", a.systemCli)
|
||||||
eventHandler.RequireModule("msp-admin-service", a.adminCli)
|
eventHandler.RequireModule("msp-admin-service", a.adminCli)
|
||||||
|
eventHandler.RequireModule("isp-lock-service", a.lockerCli)
|
||||||
|
|
||||||
return []app.Runner{
|
return []app.Runner{
|
||||||
app.RunnerFunc(func(ctx context.Context) error {
|
app.RunnerFunc(func(ctx context.Context) error {
|
||||||
@@ -154,31 +149,7 @@ func (a *Assembly) Closers() []app.Closer {
|
|||||||
for _, cliCloser := range a.grpcClientByModuleName {
|
for _, cliCloser := range a.grpcClientByModuleName {
|
||||||
closers = append(closers, cliCloser)
|
closers = append(closers, cliCloser)
|
||||||
}
|
}
|
||||||
closers = append(closers, a.systemCli, a.adminCli, app.CloserFunc(func() error {
|
closers = append(closers, a.systemCli, a.adminCli, a.lockerCli)
|
||||||
if a.redisCli != nil {
|
|
||||||
return a.redisCli.Close()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}))
|
|
||||||
|
|
||||||
return closers
|
return closers
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:ireturn
|
|
||||||
func (a *Assembly) redisClient(config conf.Redis) redis.UniversalClient {
|
|
||||||
if config.Sentinel != nil {
|
|
||||||
return redis.NewFailoverClient(&redis.FailoverOptions{
|
|
||||||
MasterName: config.Sentinel.MasterName,
|
|
||||||
SentinelAddrs: config.Sentinel.Addresses,
|
|
||||||
SentinelUsername: config.Sentinel.Username,
|
|
||||||
SentinelPassword: config.Sentinel.Password,
|
|
||||||
Username: config.Username,
|
|
||||||
Password: config.Password,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return redis.NewClient(&redis.Options{
|
|
||||||
Addr: config.Address,
|
|
||||||
Username: config.Username,
|
|
||||||
Password: config.Password,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
+21
-14
@@ -12,8 +12,6 @@ import (
|
|||||||
"isp-gate-service/service"
|
"isp-gate-service/service"
|
||||||
|
|
||||||
mux2 "github.com/gorilla/mux"
|
mux2 "github.com/gorilla/mux"
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/txix-open/isp-kit/grpc/client"
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
"github.com/txix-open/isp-kit/lb"
|
"github.com/txix-open/isp-kit/lb"
|
||||||
@@ -27,6 +25,7 @@ type Locator struct {
|
|||||||
routes *routes.Routes
|
routes *routes.Routes
|
||||||
systemCli *client.Client
|
systemCli *client.Client
|
||||||
adminCli *client.Client
|
adminCli *client.Client
|
||||||
|
lockerCli *client.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLocator(
|
func NewLocator(
|
||||||
@@ -36,6 +35,7 @@ func NewLocator(
|
|||||||
routes *routes.Routes,
|
routes *routes.Routes,
|
||||||
systemCli *client.Client,
|
systemCli *client.Client,
|
||||||
adminCli *client.Client,
|
adminCli *client.Client,
|
||||||
|
lockerCli *client.Client,
|
||||||
) Locator {
|
) Locator {
|
||||||
return Locator{
|
return Locator{
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@@ -44,10 +44,11 @@ func NewLocator(
|
|||||||
routes: routes,
|
routes: routes,
|
||||||
systemCli: systemCli,
|
systemCli: systemCli,
|
||||||
adminCli: adminCli,
|
adminCli: adminCli,
|
||||||
|
lockerCli: lockerCli,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli redis.UniversalClient) (http.Handler, error) {
|
func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Handler, error) { // nolint:funlen
|
||||||
systemRepo := repository.NewSystem(l.systemCli)
|
systemRepo := repository.NewSystem(l.systemCli)
|
||||||
adminRepo := repository.NewAdmin(l.adminCli)
|
adminRepo := repository.NewAdmin(l.adminCli)
|
||||||
|
|
||||||
@@ -64,11 +65,9 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
|
|||||||
systemRepo,
|
systemRepo,
|
||||||
)
|
)
|
||||||
|
|
||||||
dailyLimitRepo := repository.NewDailyLimit(redisCli)
|
lockRepo := repository.NewLocker(l.lockerCli)
|
||||||
dailyLimitService := service.NewDailyLimit(dailyLimitRepo, config.DailyLimits)
|
dailyLimitService := service.NewDailyLimit(lockRepo, config.DailyLimits)
|
||||||
|
throttlingService := service.NewThrottling(lockRepo, config.Throttling)
|
||||||
throttlingRepo := repository.NewThrottling(redisCli)
|
|
||||||
throttlingService := service.NewThrottling(throttlingRepo, config.Throttling)
|
|
||||||
|
|
||||||
mux := mux2.NewRouter()
|
mux := mux2.NewRouter()
|
||||||
for _, location := range locations {
|
for _, location := range locations {
|
||||||
@@ -93,8 +92,12 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
|
|||||||
handler := middleware.Chain(
|
handler := middleware.Chain(
|
||||||
proxyFunc,
|
proxyFunc,
|
||||||
middleware.RequestId(config.EnableClientRequestIdForwarding),
|
middleware.RequestId(config.EnableClientRequestIdForwarding),
|
||||||
middleware.Logger(l.logger, config.Logging.RequestLogEnable, enableBodyLog,
|
middleware.Logger(
|
||||||
config.Logging.SkipBodyLoggingEndpointPrefixes),
|
l.logger, config.Logging.RequestLogEnable,
|
||||||
|
enableBodyLog,
|
||||||
|
config.Logging.SkipBodyLoggingEndpointPrefixes,
|
||||||
|
config.Logging.EnableForceUnescapingUnicode,
|
||||||
|
),
|
||||||
middleware.ErrorHandler(l.logger),
|
middleware.ErrorHandler(l.logger),
|
||||||
middleware.Authenticate(authentication),
|
middleware.Authenticate(authentication),
|
||||||
middleware.AdminAuthenticate(adminService),
|
middleware.AdminAuthenticate(adminService),
|
||||||
@@ -107,19 +110,23 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli
|
|||||||
handler = middleware.Chain(
|
handler = middleware.Chain(
|
||||||
proxyFunc,
|
proxyFunc,
|
||||||
middleware.RequestId(config.EnableClientRequestIdForwarding),
|
middleware.RequestId(config.EnableClientRequestIdForwarding),
|
||||||
middleware.Logger(l.logger, config.Logging.RequestLogEnable, enableBodyLog,
|
middleware.Logger(l.logger, config.Logging.RequestLogEnable,
|
||||||
config.Logging.SkipBodyLoggingEndpointPrefixes),
|
enableBodyLog,
|
||||||
|
config.Logging.SkipBodyLoggingEndpointPrefixes,
|
||||||
|
config.Logging.EnableForceUnescapingUnicode,
|
||||||
|
),
|
||||||
middleware.ErrorHandler(l.logger),
|
middleware.ErrorHandler(l.logger),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
entrypoint := middleware.Entrypoint(
|
entrypoint := middleware.Entrypoint(
|
||||||
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd,gomnd
|
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd
|
||||||
handler,
|
handler,
|
||||||
l.logger,
|
|
||||||
middleware.EntryPointConfig{
|
middleware.EntryPointConfig{
|
||||||
WithPrefix: location.WithPrefix,
|
WithPrefix: location.WithPrefix,
|
||||||
PathPrefix: location.PathPrefix,
|
PathPrefix: location.PathPrefix,
|
||||||
},
|
},
|
||||||
|
l.routes,
|
||||||
|
l.logger,
|
||||||
)
|
)
|
||||||
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
|
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
"logLevel": "debug",
|
"logLevel": "debug",
|
||||||
"requestLogEnable": true,
|
"requestLogEnable": true,
|
||||||
"bodyLogEnable": false,
|
"bodyLogEnable": false,
|
||||||
"skipBodyLoggingEndpointPrefixes": []
|
"skipBodyLoggingEndpointPrefixes": [],
|
||||||
|
"enableForceUnescapingUnicode": false
|
||||||
},
|
},
|
||||||
"caching": {
|
"caching": {
|
||||||
"authenticationDataInSec": 60,
|
"authenticationDataInSec": 60,
|
||||||
|
|||||||
+1
-26
@@ -4,7 +4,6 @@ package conf
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
"github.com/txix-open/isp-kit/rc/schema"
|
"github.com/txix-open/isp-kit/rc/schema"
|
||||||
"github.com/txix-open/jsonschema"
|
"github.com/txix-open/jsonschema"
|
||||||
@@ -18,7 +17,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Remote struct {
|
type Remote struct {
|
||||||
Redis *Redis `schema:"Настройки Redis,обязательно, если используется механизм суточных ограничений или ограничений пропускной способности"`
|
|
||||||
Http Http `schema:"Настройки HTTP"`
|
Http Http `schema:"Настройки HTTP"`
|
||||||
Logging Logging `schema:"Настройки логирования"`
|
Logging Logging `schema:"Настройки логирования"`
|
||||||
Caching Caching `schema:"Настройки кеширования"`
|
Caching Caching `schema:"Настройки кеширования"`
|
||||||
@@ -37,6 +35,7 @@ type Logging struct {
|
|||||||
RequestLogEnable bool `schema:"Включить логирование запросов"`
|
RequestLogEnable bool `schema:"Включить логирование запросов"`
|
||||||
BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"`
|
BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"`
|
||||||
SkipBodyLoggingEndpointPrefixes []string `schema:"регулярные выражения для отключения логирования"`
|
SkipBodyLoggingEndpointPrefixes []string `schema:"регулярные выражения для отключения логирования"`
|
||||||
|
EnableForceUnescapingUnicode bool `schema:"Включить перевод тел запроса из unicode в utf-8, должно быть включено логирование тел запросов и ответов"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Caching struct {
|
type Caching struct {
|
||||||
@@ -53,27 +52,3 @@ type Throttling struct {
|
|||||||
ApplicationId int `validate:"required" schema:"ID приложения"`
|
ApplicationId int `validate:"required" schema:"ID приложения"`
|
||||||
RequestsPerSeconds int `validate:"required,min=1,max=1000" schema:"Запросов в секунду,не конфликтует с суточными ограничениями, алгоритм не работает на значениях больше 1000"`
|
RequestsPerSeconds int `validate:"required,min=1,max=1000" schema:"Запросов в секунду,не конфликтует с суточными ограничениями, алгоритм не работает на значениях больше 1000"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Redis struct {
|
|
||||||
Address string `schema:"Адрес,обязателено, если sentinel не указан"`
|
|
||||||
Username string `schema:"Имя пользовтаеля"`
|
|
||||||
Password string `schema:"Пароль"`
|
|
||||||
Sentinel *RedisSentinel `schema:"Настройки sentinel,обязательно, если address не указан"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RedisSentinel struct {
|
|
||||||
Addresses []string `validate:"required" schema:"Адреса нод в кластере"`
|
|
||||||
MasterName string `validate:"required" schema:"Имя мастера"`
|
|
||||||
Username string `schema:"Имя пользовтаеля в sentinel"`
|
|
||||||
Password string `schema:"Пароль в sentinel"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Remote) Validate() error {
|
|
||||||
if (len(r.Throttling) > 0 || len(r.DailyLimits) > 0) && r.Redis == nil {
|
|
||||||
return errors.New("redis is required if dailyLimits or throttling were specified")
|
|
||||||
}
|
|
||||||
if r.Redis != nil && r.Redis.Sentinel == nil && r.Redis.Address == "" {
|
|
||||||
return errors.New("invalid redis config. sentinel or address are required")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IncrementRequest struct {
|
||||||
|
Key string
|
||||||
|
Today time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
type IncrementResponse struct {
|
||||||
|
Value uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type RateLimiterRequest struct {
|
||||||
|
Key string
|
||||||
|
MaxRps int
|
||||||
|
}
|
||||||
|
|
||||||
|
type RateLimiterResponse struct {
|
||||||
|
Allow bool
|
||||||
|
Remaining int
|
||||||
|
RetryAfter time.Duration
|
||||||
|
}
|
||||||
@@ -1,74 +1,78 @@
|
|||||||
module isp-gate-service
|
module isp-gate-service
|
||||||
|
|
||||||
go 1.23
|
go 1.24
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-redis/redis_rate/v10 v10.0.1
|
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/gorilla/mux v1.8.1
|
github.com/gorilla/mux v1.8.1
|
||||||
github.com/gorilla/websocket v1.5.1
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/redis/go-redis/v9 v9.3.0
|
github.com/redis/go-redis/v9 v9.11.0
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.10.0
|
||||||
github.com/tomakado/websocketproxy v0.1.0
|
github.com/tomakado/websocketproxy v0.1.0
|
||||||
github.com/txix-open/isp-kit v1.38.1
|
github.com/txix-open/isp-kit v1.52.1
|
||||||
github.com/txix-open/jsonschema v1.2.0
|
github.com/txix-open/jsonschema v1.3.0
|
||||||
golang.org/x/net v0.28.0
|
golang.org/x/net v0.41.0
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822
|
||||||
google.golang.org/grpc v1.65.0
|
google.golang.org/grpc v1.73.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
|
||||||
|
github.com/txix-open/etp/v4 v4.0.1 // indirect
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/buger/jsonparser v1.1.1 // indirect
|
github.com/buger/jsonparser v1.1.1 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/coder/websocket v1.8.12 // indirect
|
github.com/coder/websocket v1.8.13 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||||
github.com/getsentry/sentry-go v0.28.1 // indirect
|
github.com/getsentry/sentry-go v0.33.0 // indirect
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/julienschmidt/httprouter v1.3.0 // indirect
|
github.com/julienschmidt/httprouter v1.3.0 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.9.0 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/prometheus/client_golang v1.19.1 // indirect
|
github.com/prometheus/client_golang v1.22.0 // indirect
|
||||||
github.com/prometheus/client_model v0.6.1 // indirect
|
github.com/prometheus/client_model v0.6.2 // indirect
|
||||||
github.com/prometheus/common v0.55.0 // indirect
|
github.com/prometheus/common v0.64.0 // indirect
|
||||||
github.com/prometheus/procfs v0.15.1 // indirect
|
github.com/prometheus/procfs v0.16.1 // indirect
|
||||||
github.com/txix-open/bellows v1.2.0 // indirect
|
github.com/txix-open/bellows v1.2.0 // indirect
|
||||||
github.com/txix-open/etp/v3 v3.2.0
|
github.com/txix-open/etp/v3 v3.2.0
|
||||||
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 // indirect
|
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
|
||||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
go.opentelemetry.io/otel v1.36.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
go.opentelemetry.io/otel/metric v1.36.0 // indirect
|
||||||
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
|
go.opentelemetry.io/otel/sdk v1.36.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
go.opentelemetry.io/otel/trace v1.36.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
go.opentelemetry.io/proto/otlp v1.7.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
go.uber.org/zap v1.27.0 // indirect
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
golang.org/x/crypto v0.26.0 // indirect
|
golang.org/x/crypto v0.39.0 // indirect
|
||||||
golang.org/x/sys v0.24.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
golang.org/x/text v0.17.0 // indirect
|
golang.org/x/text v0.26.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
|
||||||
google.golang.org/protobuf v1.34.2 // indirect
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
@@ -12,10 +12,12 @@ github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMU
|
|||||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
|
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
|
||||||
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -23,15 +25,15 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
|
|||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4=
|
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4=
|
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||||
github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k=
|
github.com/getsentry/sentry-go v0.33.0 h1:YWyDii0KGVov3xOaamOnF0mjOrqSjBqwv48UEzn7QFg=
|
||||||
github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg=
|
github.com/getsentry/sentry-go v0.33.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE=
|
||||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
@@ -40,34 +42,37 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
|||||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-redis/redis_rate/v10 v10.0.1 h1:calPxi7tVlxojKunJwQ72kwfozdy25RjA0bCj1h0MUo=
|
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||||
github.com/go-redis/redis_rate/v10 v10.0.1/go.mod h1:EMiuO9+cjRkR7UvdvwMO7vbgqJkltQHtwbdIQvaBKIU=
|
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||||
github.com/go-resty/resty/v2 v2.14.0 h1:/rhkzsAqGQkozwfKS5aFAbb6TyKd3zyFRWcdRXLPCAU=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/go-resty/resty/v2 v2.14.0/go.mod h1:IW6mekUOsElt9C7oWr0XRt9BNSD6D5rr9mhk6NjmNHg=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 h1:CWyXh/jylQWp2dtiV33mY4iSSp6yf4lmn+c7/tN+ObI=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0/go.mod h1:nCLIt0w3Ept2NwF8ThLmrppXsfT07oC8k0XNDxd8sVU=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||||
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
@@ -83,20 +88,20 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
|
github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
|
||||||
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
|
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
|
||||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||||
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
|
github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4=
|
||||||
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
|
github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
|
||||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
|
||||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||||
github.com/redis/go-redis/v9 v9.3.0 h1:RiVDjmig62jIWp7Kk4XVLs0hzV6pI3PyTnnL0cnn0u0=
|
github.com/redis/go-redis/v9 v9.11.0 h1:E3S08Gl/nJNn5vkxd2i78wZxWAPNZgUNTp8WIJUAiIs=
|
||||||
github.com/redis/go-redis/v9 v9.3.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
github.com/redis/go-redis/v9 v9.11.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
@@ -105,22 +110,25 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
|
|||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tomakado/websocketproxy v0.1.0 h1:e037TLXDvEYYHlxHE5pqmj/DytFKm2NRn7i4wbVzIyE=
|
github.com/tomakado/websocketproxy v0.1.0 h1:e037TLXDvEYYHlxHE5pqmj/DytFKm2NRn7i4wbVzIyE=
|
||||||
github.com/tomakado/websocketproxy v0.1.0/go.mod h1:EXg/3jcTJYZ04Hsf93RpY90FYA9lj1Sl+VM7lZI6xpM=
|
github.com/tomakado/websocketproxy v0.1.0/go.mod h1:EXg/3jcTJYZ04Hsf93RpY90FYA9lj1Sl+VM7lZI6xpM=
|
||||||
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
||||||
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
||||||
github.com/txix-open/etp/v3 v3.2.0 h1:EgTchT8VtCYV1iEo/y4jII3/NybrXiQDE0y6pmS350M=
|
github.com/txix-open/etp/v3 v3.2.0 h1:EgTchT8VtCYV1iEo/y4jII3/NybrXiQDE0y6pmS350M=
|
||||||
github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0=
|
github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0=
|
||||||
github.com/txix-open/grmq v1.6.0 h1:V4QRb0sI2CMfdMaMsFGvGvUIDGad5vr3khNU7A3LlP8=
|
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
|
||||||
github.com/txix-open/grmq v1.6.0/go.mod h1:s+NNNv42+32yLpjvl2tpqtyBbMB9e7kKFee3lfa/dyo=
|
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
|
||||||
github.com/txix-open/isp-kit v1.38.1 h1:IYsiW2xc06//xQsWcHX9A1GXCGTXQRXbUqotcxa6eDY=
|
github.com/txix-open/grmq v1.8.1 h1:bcPLuYZXJ+1h9D3w7JYzUTypnQsw9XAT0Ftl/Fu+cZA=
|
||||||
github.com/txix-open/isp-kit v1.38.1/go.mod h1:uVn5y71Rg8jlFjFK3+QCh9uw1O7mcK+1grCNFZRWhME=
|
github.com/txix-open/grmq v1.8.1/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
|
||||||
github.com/txix-open/jsonschema v1.2.0 h1:B8TrdSsPhDvYv67oi/LVqf7/+PuqFlMsNwUzGeHfl1s=
|
github.com/txix-open/isp-kit v1.52.1 h1:OjwfUNL50RyhEedFc7ZI+X6YXg47yF88bQyfghbbyag=
|
||||||
github.com/txix-open/jsonschema v1.2.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
github.com/txix-open/isp-kit v1.52.1/go.mod h1:OkscabRkpFGjUOFrbPM7yTKD/Br2/iv5/PWr/T2Jtd4=
|
||||||
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 h1:Z0Sqf+U+Sc6hfIXtRCIZlbJprkCjwMFbS4ZbEPQ44To=
|
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
|
||||||
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99/go.mod h1:pA0NYmhL0uEkkxj55S+S7MZU4e2QIt46x9XSrzrWc3c=
|
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
||||||
|
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
|
||||||
|
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA=
|
||||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
@@ -130,48 +138,52 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
|
|||||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0 h1:IVtyPth4Rs5P8wIf0mP2KVKFNTJ4paX9qQ4Hkh5gFdc=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.53.0/go.mod h1:ImRBLMJv177/pwiLZ7tU7HDGNdBv7rS0HQ99eN/zBl8=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0/go.mod h1:CosX/aS4eHnG9D7nESYpV753l4j9q5j3SL/PUYd2lR8=
|
||||||
go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU=
|
||||||
go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY=
|
go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI=
|
go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 h1:dNzwXjZKpMpE2JhmO+9HsPl42NIXFIFSUSSs0fiqra0=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0/go.mod h1:90PoxvaEB5n6AOdZvi+yWJQoE95U8Dhhw2bSyRqnTD0=
|
||||||
go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0 h1:nRVXXvf78e00EwY6Wp0YII8ww2JVWshZ20HfTlE11AM=
|
||||||
go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.36.0/go.mod h1:r49hO7CgrxY9Voaj3Xe8pANWtr0Oq916d0XAmOoCZAQ=
|
||||||
go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE=
|
go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE=
|
||||||
go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg=
|
go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs=
|
||||||
go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g=
|
go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs=
|
||||||
go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI=
|
go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY=
|
||||||
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
|
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
|
||||||
go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
|
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
|
||||||
|
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
|
||||||
|
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.7.0 h1:jX1VolD6nHuFzOYso2E73H85i92Mv8JQYk0K9vz09os=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.7.0/go.mod h1:fSKjH6YJ7HDlwzltzyMj036AJ3ejJLCgCSHGj4efDDo=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||||
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||||
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
|
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||||
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 h1:+/tmTy5zAieooKIXfzDm9KiA3Bv6JBwriRN9LY+yayk=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 h1:oWVWY3NzT7KJppx2UKhKmzPq4SRe0LdCijVRwvGeikY=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988/go.mod h1:4+X6GvPs+25wZKbQq9qyAXrwIRExv7w0Ea6MgZLZiDM=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822/go.mod h1:h3c4v36UTKzUiuaOKQ6gr3S+0hovBtUrXzTG/i3+XEc=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 h1:V71AcdLZr2p8dC9dbOIMCpqi4EmRl8wUwnJzXXLmbmc=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||||
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
|
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
|
||||||
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
|
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
|
||||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
|||||||
@@ -9,23 +9,23 @@ import (
|
|||||||
type HttpError struct {
|
type HttpError struct {
|
||||||
statusCode int
|
statusCode int
|
||||||
userMessage string
|
userMessage string
|
||||||
details []interface{}
|
details []any
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(statusCode int, userMessage string, internalError error) HttpError {
|
func New(statusCode int, userMessage string, internalError error) *HttpError {
|
||||||
return HttpError{
|
return &HttpError{
|
||||||
statusCode: statusCode,
|
statusCode: statusCode,
|
||||||
userMessage: userMessage,
|
userMessage: userMessage,
|
||||||
err: internalError,
|
err: internalError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e HttpError) Error() string {
|
func (e *HttpError) Error() string {
|
||||||
return e.err.Error()
|
return e.err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e HttpError) WriteError(w http.ResponseWriter) error {
|
func (e *HttpError) WriteError(w http.ResponseWriter) error {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(e.statusCode)
|
w.WriteHeader(e.statusCode)
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
@@ -36,6 +36,6 @@ func (e HttpError) WriteError(w http.ResponseWriter) error {
|
|||||||
return json.NewEncoder(w).Encode(data)
|
return json.NewEncoder(w).Encode(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *HttpError) WithDetails(details ...interface{}) {
|
func (e *HttpError) WithDetails(details ...any) {
|
||||||
e.details = details
|
e.details = details
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type AdminMethodStore interface {
|
type AdminMethodStore interface {
|
||||||
IsInnerEndpoint(path string) bool
|
IsInnerEndpoint(endpoint string) bool
|
||||||
RequiredAdminPermission(path string) (string, bool)
|
RequiredAdminPermission(endpoint string) (string, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
type AdminAuthorizer interface {
|
type AdminAuthorizer interface {
|
||||||
|
|||||||
+13
-10
@@ -1,13 +1,10 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
"isp-gate-service/request"
|
"isp-gate-service/request"
|
||||||
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EntryPointConfig struct {
|
type EntryPointConfig struct {
|
||||||
@@ -15,15 +12,21 @@ type EntryPointConfig struct {
|
|||||||
WithPrefix bool
|
WithPrefix bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func Entrypoint(maxReqBodySize int64, next Handler, logger log.Logger, cfg EntryPointConfig) http.Handler {
|
type EndpointResolver interface {
|
||||||
|
ResolveEndpoint(path string, cfg EntryPointConfig) string
|
||||||
|
}
|
||||||
|
|
||||||
|
func Entrypoint(
|
||||||
|
maxReqBodySize int64,
|
||||||
|
next Handler,
|
||||||
|
cfg EntryPointConfig,
|
||||||
|
entryPointResolver EndpointResolver,
|
||||||
|
logger log.Logger,
|
||||||
|
) http.Handler {
|
||||||
return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
|
return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
|
||||||
req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize)
|
req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize)
|
||||||
|
|
||||||
endpoint := req.URL.Path
|
endpoint := entryPointResolver.ResolveEndpoint(req.URL.Path, cfg)
|
||||||
if !cfg.WithPrefix {
|
|
||||||
prefix := fmt.Sprintf("%s/", cfg.PathPrefix)
|
|
||||||
endpoint = strings.TrimPrefix(req.URL.Path, prefix)
|
|
||||||
}
|
|
||||||
ctx := request.NewContext(req, writer, endpoint)
|
ctx := request.NewContext(req, writer, endpoint)
|
||||||
|
|
||||||
err := next.Handle(ctx)
|
err := next.Handle(ctx)
|
||||||
|
|||||||
+29
-5
@@ -3,6 +3,7 @@ package middleware
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/txix-open/isp-kit/json"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -14,6 +15,10 @@ import (
|
|||||||
"isp-gate-service/request"
|
"isp-gate-service/request"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
unicodeEscapePrefix = []byte("\\u") // nolint:gochecknoglobals
|
||||||
|
)
|
||||||
|
|
||||||
type scSource interface {
|
type scSource interface {
|
||||||
StatusCode() int
|
StatusCode() int
|
||||||
}
|
}
|
||||||
@@ -43,11 +48,12 @@ func (w *writerWrapper) WriteHeader(statusCode int) {
|
|||||||
w.ResponseWriter.WriteHeader(statusCode)
|
w.ResponseWriter.WriteHeader(statusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Logger(
|
func Logger( // nolint:gocognit
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
enableRequestLogging bool,
|
enableRequestLogging bool,
|
||||||
enableBodyLogging bool,
|
enableBodyLogging bool,
|
||||||
skipBodyLoggingEndpointPrefixes []string,
|
skipBodyLoggingEndpointPrefixes []string,
|
||||||
|
enableForceUnescapingUnicode bool,
|
||||||
) Middleware {
|
) Middleware {
|
||||||
return func(next Handler) Handler {
|
return func(next Handler) Handler {
|
||||||
return HandlerFunc(func(ctx *request.Context) error {
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
@@ -108,10 +114,13 @@ func Logger(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if logBodyFromCurrenRequest {
|
if logBodyFromCurrenRequest {
|
||||||
fields = append(fields,
|
if enableForceUnescapingUnicode && bytes.Contains(buf.RequestBody(), unicodeEscapePrefix) {
|
||||||
log.ByteString("request", buf.RequestBody()),
|
fields = append(fields, log.ByteString("request", forceUnescapingUnicode(buf.RequestBody())))
|
||||||
log.ByteString("response", buf.ResponseBody()),
|
} else {
|
||||||
)
|
fields = append(fields, log.ByteString("request", buf.RequestBody()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fields = append(fields, log.ByteString("response", buf.ResponseBody()))
|
||||||
}
|
}
|
||||||
logger.Debug(ctx.Context(), "log request", fields...)
|
logger.Debug(ctx.Context(), "log request", fields...)
|
||||||
|
|
||||||
@@ -119,3 +128,18 @@ func Logger(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func forceUnescapingUnicode(data []byte) []byte {
|
||||||
|
var body any
|
||||||
|
err := json.Unmarshal(data, &body)
|
||||||
|
if err != nil {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
newData, err := json.Marshal(body)
|
||||||
|
if err != nil {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
return newData
|
||||||
|
}
|
||||||
+10
-5
@@ -68,10 +68,12 @@ func (p Grpc) Handle(ctx *request.Context) error {
|
|||||||
return errors.WithMessage(err, "grpc: read body")
|
return errors.WithMessage(err, "grpc: read body")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestId := requestid.FromContext(ctx.Context())
|
||||||
md := metadata.MD{
|
md := metadata.MD{
|
||||||
grpc.ProxyMethodNameHeader: {ctx.Endpoint()},
|
grpc.ProxyMethodNameHeader: {ctx.Endpoint()},
|
||||||
requestid.RequestIdHeader: {requestid.FromContext(ctx.Context())},
|
requestid.Header: {requestId},
|
||||||
}
|
}
|
||||||
|
|
||||||
if !p.skipAuth {
|
if !p.skipAuth {
|
||||||
authData, err := ctx.GetAuthData()
|
authData, err := ctx.GetAuthData()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -96,7 +98,7 @@ func (p Grpc) Handle(ctx *request.Context) error {
|
|||||||
return p.handleError(err, ctx.ResponseWriter())
|
return p.handleError(err, ctx.ResponseWriter())
|
||||||
}
|
}
|
||||||
|
|
||||||
return p.writeResponse(http.StatusOK, result.GetBytesBody(), ctx.ResponseWriter())
|
return p.writeResponse(http.StatusOK, result.GetBytesBody(), requestId, ctx.ResponseWriter())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Grpc) handleError(err error, w http.ResponseWriter) error {
|
func (p Grpc) handleError(err error, w http.ResponseWriter) error {
|
||||||
@@ -115,7 +117,7 @@ func (p Grpc) handleError(err error, w http.ResponseWriter) error {
|
|||||||
case *isp.Message:
|
case *isp.Message:
|
||||||
switch {
|
switch {
|
||||||
case typeOfDetail.GetBytesBody() != nil:
|
case typeOfDetail.GetBytesBody() != nil:
|
||||||
return p.writeResponse(statusCode, typeOfDetail.GetBytesBody(), w)
|
return p.writeResponse(statusCode, typeOfDetail.GetBytesBody(), "", w)
|
||||||
case typeOfDetail.GetListBody() != nil:
|
case typeOfDetail.GetListBody() != nil:
|
||||||
return p.writeProto(statusCode, typeOfDetail.GetListBody(), w)
|
return p.writeProto(statusCode, typeOfDetail.GetListBody(), w)
|
||||||
case typeOfDetail.GetStructBody() != nil:
|
case typeOfDetail.GetStructBody() != nil:
|
||||||
@@ -138,11 +140,14 @@ func (p Grpc) writeProto(statusCode int, proto interface{}, w http.ResponseWrite
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "marshal grpc details to json")
|
return errors.WithMessage(err, "marshal grpc details to json")
|
||||||
}
|
}
|
||||||
return p.writeResponse(statusCode, data, w)
|
return p.writeResponse(statusCode, data, "", w)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Grpc) writeResponse(statusCode int, data []byte, w http.ResponseWriter) error {
|
func (p Grpc) writeResponse(statusCode int, data []byte, requestId string, w http.ResponseWriter) error {
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
if requestId != "" {
|
||||||
|
w.Header().Set(requestid.Header, requestId)
|
||||||
|
}
|
||||||
w.WriteHeader(statusCode)
|
w.WriteHeader(statusCode)
|
||||||
_, err := w.Write(data)
|
_, err := w.Write(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+1
-2
@@ -18,7 +18,6 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint:gomnd
|
|
||||||
var (
|
var (
|
||||||
httpTransport = &http.Transport{
|
httpTransport = &http.Transport{
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
@@ -91,7 +90,7 @@ func (p Http) Handle(ctx *request.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) error {
|
func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) error {
|
||||||
header.Set(requestid.RequestIdHeader, requestid.FromContext(ctx.Context()))
|
header.Set(requestid.Header, requestid.FromContext(ctx.Context()))
|
||||||
if !skipAuth {
|
if !skipAuth {
|
||||||
authData, err := ctx.GetAuthData()
|
authData, err := ctx.GetAuthData()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ func NewWs(hostManager HttpHostManager, skipAuth bool) Ws {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gomnd
|
|
||||||
func (ws Ws) Handle(ctx *request.Context) error {
|
func (ws Ws) Handle(ctx *request.Context) error {
|
||||||
host, err := ws.hostManager.Next()
|
host, err := ws.hostManager.Next()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
package repository
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DailyLimit struct {
|
|
||||||
cli redis.UniversalClient
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDailyLimit(cli redis.UniversalClient) DailyLimit {
|
|
||||||
return DailyLimit{
|
|
||||||
cli: cli,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r DailyLimit) Increment(ctx context.Context, applicationId int, today time.Time) (int64, error) {
|
|
||||||
key := r.key(applicationId, today)
|
|
||||||
value, err := r.cli.Incr(ctx, key).Result()
|
|
||||||
if err != nil {
|
|
||||||
return 0, errors.WithMessage(err, "incr")
|
|
||||||
}
|
|
||||||
|
|
||||||
if value == 1 {
|
|
||||||
err := r.cli.ExpireNX(ctx, key, 24*time.Hour).Err() //nolint:mnd,gomnd
|
|
||||||
if err != nil {
|
|
||||||
return 0, errors.WithMessage(err, "expire nx")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return value, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r DailyLimit) key(applicationId int, today time.Time) string {
|
|
||||||
y, m, d := today.Date()
|
|
||||||
return fmt.Sprintf("daily_limit:%d:%d-%d-%d", applicationId, y, m, d)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
"isp-gate-service/entity"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
incrementEndpoint = "isp-lock-service/daily_limit/increment"
|
||||||
|
rateLimitEndpoint = "isp-lock-service/rate_limit"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Locker struct {
|
||||||
|
cli *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLocker(cli *client.Client) Locker {
|
||||||
|
return Locker{
|
||||||
|
cli: cli,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r Locker) Increment(ctx context.Context, key string, today time.Time) (int64, error) {
|
||||||
|
resp := new(entity.IncrementResponse)
|
||||||
|
err := r.cli.Invoke(incrementEndpoint).
|
||||||
|
JsonRequestBody(entity.IncrementRequest{
|
||||||
|
Key: key,
|
||||||
|
Today: today,
|
||||||
|
}).
|
||||||
|
JsonResponseBody(resp).
|
||||||
|
Do(ctx)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return 0, errors.WithMessagef(err, "invoke isp-lock-service: '%s'", incrementEndpoint)
|
||||||
|
default:
|
||||||
|
return int64(resp.Value), nil //nolint:gosec
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r Locker) IsAllowRequestPerSecond(ctx context.Context, key string, rate int) (*entity.RateLimiterResponse, error) {
|
||||||
|
resp := new(entity.RateLimiterResponse)
|
||||||
|
err := r.cli.Invoke(rateLimitEndpoint).
|
||||||
|
JsonRequestBody(entity.RateLimiterRequest{
|
||||||
|
Key: key,
|
||||||
|
MaxRps: rate,
|
||||||
|
}).
|
||||||
|
JsonResponseBody(resp).
|
||||||
|
Do(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessagef(err, "invoke isp-lock-service: '%s'", rateLimitEndpoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package repository
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/go-redis/redis_rate/v10"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Throttling struct {
|
|
||||||
cli *redis_rate.Limiter
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewThrottling(cli redis.UniversalClient) Throttling {
|
|
||||||
return Throttling{
|
|
||||||
cli: redis_rate.NewLimiter(cli),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Throttling) IsAllowRequestPerSecond(ctx context.Context, applicationId int, rate int) (*domain.RateLimitResult, error) {
|
|
||||||
result, err := r.cli.Allow(ctx, r.key(applicationId), redis_rate.PerSecond(rate))
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessage(err, "redis_rate/Allow")
|
|
||||||
}
|
|
||||||
return &domain.RateLimitResult{
|
|
||||||
Allow: result.Allowed > 0,
|
|
||||||
Remaining: result.Remaining,
|
|
||||||
RetryAfter: result.RetryAfter,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Throttling) key(applicationId int) string {
|
|
||||||
return fmt.Sprintf("throttling:%d", applicationId)
|
|
||||||
}
|
|
||||||
@@ -35,7 +35,7 @@ func (r RedisAuthCache) Get(ctx context.Context, token string) (*domain.AuthData
|
|||||||
return nil, errors.WithMessage(err, "pipelined")
|
return nil, errors.WithMessage(err, "pipelined")
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := results[1].(*redis.StringCmd).Result()
|
data, err := results[1].(*redis.StringCmd).Result() // nolint: forcetypeassert
|
||||||
if errors.Is(err, redis.Nil) {
|
if errors.Is(err, redis.Nil) {
|
||||||
return nil, domain.ErrAuthenticationCacheMiss
|
return nil, domain.ErrAuthenticationCacheMiss
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func (r RedisAuthzCache) Get(ctx context.Context, applicationId int, endpoint st
|
|||||||
return false, errors.WithMessage(err, "pipelined")
|
return false, errors.WithMessage(err, "pipelined")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = result[1].(*redis.StringCmd).Result()
|
_, err = result[1].(*redis.StringCmd).Result() // nolint: forcetypeassert
|
||||||
if errors.Is(err, redis.Nil) {
|
if errors.Is(err, redis.Nil) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-4
@@ -2,27 +2,34 @@ package routes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"isp-gate-service/middleware"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/txix-open/isp-kit/cluster"
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Routes struct {
|
type Routes struct {
|
||||||
|
allEndpoints map[string]bool
|
||||||
innerEndpoints map[string]bool
|
innerEndpoints map[string]bool
|
||||||
requiredPermissions map[string]string
|
requiredPermissions map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRoutes() *Routes {
|
func NewRoutes() *Routes {
|
||||||
return &Routes{
|
return &Routes{
|
||||||
|
allEndpoints: make(map[string]bool),
|
||||||
innerEndpoints: make(map[string]bool),
|
innerEndpoints: make(map[string]bool),
|
||||||
requiredPermissions: make(map[string]string),
|
requiredPermissions: make(map[string]string),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig) error {
|
func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig) error {
|
||||||
|
newAllEndpoints := make(map[string]bool)
|
||||||
newInnerMethods := make(map[string]bool)
|
newInnerMethods := make(map[string]bool)
|
||||||
newRequiredPermissions := make(map[string]string)
|
newRequiredPermissions := make(map[string]string)
|
||||||
for _, backend := range routes {
|
for _, backend := range routes {
|
||||||
for _, v := range backend.Endpoints {
|
for _, v := range backend.Endpoints {
|
||||||
|
newAllEndpoints[v.Path] = true
|
||||||
if v.Inner {
|
if v.Inner {
|
||||||
newInnerMethods[v.Path] = true
|
newInnerMethods[v.Path] = true
|
||||||
}
|
}
|
||||||
@@ -33,17 +40,47 @@ func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.allEndpoints = newAllEndpoints
|
||||||
s.innerEndpoints = newInnerMethods
|
s.innerEndpoints = newInnerMethods
|
||||||
s.requiredPermissions = newRequiredPermissions
|
s.requiredPermissions = newRequiredPermissions
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Routes) IsInnerEndpoint(path string) bool {
|
func (s *Routes) ResolveEndpoint(path string, cfg middleware.EntryPointConfig) string {
|
||||||
return s.innerEndpoints[path]
|
if cfg.WithPrefix {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
prefix := fmt.Sprintf("%s/", cfg.PathPrefix)
|
||||||
|
noPrefixPath := strings.TrimPrefix(path, prefix)
|
||||||
|
ok := s.allEndpoints[noPrefixPath]
|
||||||
|
if ok {
|
||||||
|
return noPrefixPath
|
||||||
|
}
|
||||||
|
|
||||||
|
invertedLeadingSlash := invertLeadingSlash(noPrefixPath)
|
||||||
|
ok = s.allEndpoints[invertedLeadingSlash]
|
||||||
|
if ok {
|
||||||
|
return invertedLeadingSlash
|
||||||
|
}
|
||||||
|
|
||||||
|
return noPrefixPath // pdp-webapi-service(анонсирует вот такой ендпоинт GET /api/:token/profile/me/:blocks) hack =(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Routes) RequiredAdminPermission(path string) (string, bool) {
|
func (s *Routes) IsInnerEndpoint(endpoint string) bool {
|
||||||
perm, ok := s.requiredPermissions[path]
|
return s.innerEndpoints[endpoint]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Routes) RequiredAdminPermission(endpoint string) (string, bool) {
|
||||||
|
perm, ok := s.requiredPermissions[endpoint]
|
||||||
return perm, ok
|
return perm, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func invertLeadingSlash(path string) string {
|
||||||
|
path, withoutSlash := strings.CutPrefix(path, "/")
|
||||||
|
if withoutSlash {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return "/" + path
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@@ -9,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type DailyLimitRepo interface {
|
type DailyLimitRepo interface {
|
||||||
Increment(ctx context.Context, applicationId int, today time.Time) (int64, error)
|
Increment(ctx context.Context, key string, today time.Time) (int64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DailyLimit struct {
|
type DailyLimit struct {
|
||||||
@@ -34,10 +35,16 @@ func (s DailyLimit) IncrementAndCheck(ctx context.Context, applicationId int) (b
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
newValue, err := s.repo.Increment(ctx, applicationId, time.Now())
|
key := s.key(applicationId, time.Now())
|
||||||
|
newValue, err := s.repo.Increment(ctx, key, time.Now())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.WithMessage(err, "increment")
|
return false, errors.WithMessage(err, "increment")
|
||||||
}
|
}
|
||||||
|
|
||||||
return newValue <= limit, nil
|
return newValue <= limit, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s DailyLimit) key(applicationId int, today time.Time) string {
|
||||||
|
y, m, d := today.Date()
|
||||||
|
return fmt.Sprintf("isp-gate-service::daily-limit::%d:%d-%d-%d", applicationId, y, m, d)
|
||||||
|
}
|
||||||
+17
-6
@@ -2,22 +2,24 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"isp-gate-service/conf"
|
"isp-gate-service/conf"
|
||||||
"isp-gate-service/domain"
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ThrottlingRepo interface {
|
type LockRepo interface {
|
||||||
IsAllowRequestPerSecond(ctx context.Context, applicationId int, rate int) (*domain.RateLimitResult, error)
|
IsAllowRequestPerSecond(ctx context.Context, key string, rate int) (*entity.RateLimiterResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Throttling struct {
|
type Throttling struct {
|
||||||
repo ThrottlingRepo
|
repo LockRepo
|
||||||
limits map[int]int
|
limits map[int]int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewThrottling(repo ThrottlingRepo, configs []conf.Throttling) Throttling {
|
func NewThrottling(repo LockRepo, configs []conf.Throttling) Throttling {
|
||||||
limits := make(map[int]int)
|
limits := make(map[int]int)
|
||||||
for _, config := range configs {
|
for _, config := range configs {
|
||||||
limits[config.ApplicationId] = config.RequestsPerSeconds
|
limits[config.ApplicationId] = config.RequestsPerSeconds
|
||||||
@@ -38,10 +40,19 @@ func (s Throttling) AllowRateLimit(ctx context.Context, applicationId int) (*dom
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := s.repo.IsAllowRequestPerSecond(ctx, applicationId, rate)
|
key := s.key(applicationId)
|
||||||
|
result, err := s.repo.IsAllowRequestPerSecond(ctx, key, rate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.WithMessage(err, "is allow request per second")
|
return nil, errors.WithMessage(err, "is allow request per second")
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return &domain.RateLimitResult{
|
||||||
|
Allow: result.Allow,
|
||||||
|
Remaining: result.Remaining,
|
||||||
|
RetryAfter: result.RetryAfter,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s Throttling) key(applicationId int) string {
|
||||||
|
return fmt.Sprintf("isp-gate-service::rate-limit::%d", applicationId)
|
||||||
}
|
}
|
||||||
+46
-38
@@ -15,9 +15,8 @@ import (
|
|||||||
"isp-gate-service/domain"
|
"isp-gate-service/domain"
|
||||||
"isp-gate-service/routes"
|
"isp-gate-service/routes"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
etp "github.com/txix-open/etp/v3"
|
"github.com/txix-open/etp/v3"
|
||||||
"github.com/txix-open/etp/v3/msg"
|
"github.com/txix-open/etp/v3/msg"
|
||||||
"github.com/txix-open/isp-kit/cluster"
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
"github.com/txix-open/isp-kit/http/httpcli"
|
"github.com/txix-open/isp-kit/http/httpcli"
|
||||||
@@ -49,7 +48,7 @@ type HappyPathTestSuite struct {
|
|||||||
|
|
||||||
func (s *HappyPathTestSuite) TestGrpcProxy() {
|
func (s *HappyPathTestSuite) TestGrpcProxy() {
|
||||||
test, require := test.New(s.T())
|
test, require := test.New(s.T())
|
||||||
config, redisCli, systemCli, adminCli := s.commonDependencies(test)
|
config, systemCli, adminCli := s.commonDependencies(test)
|
||||||
|
|
||||||
requestId := requestid.Next()
|
requestId := requestid.Next()
|
||||||
targetService, targetCli := grpct.NewMock(test)
|
targetService, targetCli := grpct.NewMock(test)
|
||||||
@@ -72,12 +71,21 @@ func (s *HappyPathTestSuite) TestGrpcProxy() {
|
|||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
require.EqualValues("1", adminId)
|
require.EqualValues("1", adminId)
|
||||||
|
|
||||||
return response{Id: req.Id} //nolint:gosimple
|
return response{Id: req.Id}
|
||||||
})
|
})
|
||||||
targetClients := map[string]*client.Client{"target": targetCli}
|
targetClients := map[string]*client.Client{"target": targetCli}
|
||||||
logger, err := log.New(log.WithLevel(log.DebugLevel))
|
logger, err := log.New(log.WithLevel(log.DebugLevel))
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli, adminCli)
|
|
||||||
|
routes := routes.NewRoutes()
|
||||||
|
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
|
||||||
|
Endpoints: []cluster.EndpointDescriptor{{
|
||||||
|
Path: "endpoint",
|
||||||
|
}},
|
||||||
|
}})
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
locator := assembly.NewLocator(logger, targetClients, nil, routes, systemCli, adminCli, nil)
|
||||||
|
|
||||||
locations := []conf.Location{{
|
locations := []conf.Location{{
|
||||||
SkipAuth: false,
|
SkipAuth: false,
|
||||||
@@ -85,7 +93,7 @@ func (s *HappyPathTestSuite) TestGrpcProxy() {
|
|||||||
Protocol: "grpc",
|
Protocol: "grpc",
|
||||||
TargetModule: "target",
|
TargetModule: "target",
|
||||||
}}
|
}}
|
||||||
handler, err := locator.Handler(config, locations, redisCli)
|
handler, err := locator.Handler(config, locations)
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
|
|
||||||
srv := httptest.NewServer(handler)
|
srv := httptest.NewServer(handler)
|
||||||
@@ -106,26 +114,35 @@ func (s *HappyPathTestSuite) TestGrpcProxy() {
|
|||||||
|
|
||||||
func (s *HappyPathTestSuite) TestHttpProxy() {
|
func (s *HappyPathTestSuite) TestHttpProxy() {
|
||||||
test, require := test.New(s.T())
|
test, require := test.New(s.T())
|
||||||
config, redisCli, systemCli, adminCli := s.commonDependencies(test)
|
config, systemCli, adminCli := s.commonDependencies(test)
|
||||||
|
|
||||||
requestId := requestid.Next()
|
requestId := requestid.Next()
|
||||||
targetService := httpt.NewMock(test)
|
targetService := httpt.NewMock(test)
|
||||||
targetService.POST("/endpoint", func(ctx context.Context, httpReq *http.Request, req request) response {
|
targetService.POST("/endpoint", func(ctx context.Context, httpReq *http.Request, req request) response {
|
||||||
assertHeaders(require, requestId, ctx, httpReq.Header)
|
assertHeaders(require, requestId, ctx, httpReq.Header)
|
||||||
return response{Id: req.Id} //nolint:gosimple
|
return response{Id: req.Id}
|
||||||
})
|
})
|
||||||
targetUrl, err := url.Parse(targetService.BaseURL())
|
targetUrl, err := url.Parse(targetService.BaseURL())
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
rr := lb.NewRoundRobin([]string{targetUrl.Host})
|
rr := lb.NewRoundRobin([]string{targetUrl.Host})
|
||||||
targetClients := map[string]*lb.RoundRobin{"target": rr}
|
targetClients := map[string]*lb.RoundRobin{"target": rr}
|
||||||
locator := assembly.NewLocator(test.Logger(), nil, targetClients, routes.NewRoutes(), systemCli, adminCli)
|
|
||||||
|
routes := routes.NewRoutes()
|
||||||
|
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
|
||||||
|
Endpoints: []cluster.EndpointDescriptor{{
|
||||||
|
Path: "/endpoint",
|
||||||
|
}},
|
||||||
|
}})
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
locator := assembly.NewLocator(test.Logger(), nil, targetClients, routes, systemCli, adminCli, nil)
|
||||||
locations := []conf.Location{{
|
locations := []conf.Location{{
|
||||||
SkipAuth: false,
|
SkipAuth: false,
|
||||||
PathPrefix: "/api",
|
PathPrefix: "/api",
|
||||||
Protocol: "http",
|
Protocol: "http",
|
||||||
TargetModule: "target",
|
TargetModule: "target",
|
||||||
}}
|
}}
|
||||||
handler, err := locator.Handler(config, locations, redisCli)
|
handler, err := locator.Handler(config, locations)
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
|
|
||||||
srv := httptest.NewServer(handler)
|
srv := httptest.NewServer(handler)
|
||||||
@@ -146,7 +163,7 @@ func (s *HappyPathTestSuite) TestHttpProxy() {
|
|||||||
|
|
||||||
func (s *HappyPathTestSuite) TestWsProxy() { // nolint: funlen
|
func (s *HappyPathTestSuite) TestWsProxy() { // nolint: funlen
|
||||||
test, require := test.New(s.T())
|
test, require := test.New(s.T())
|
||||||
config, redisCli, systemCli, adminCli := s.commonDependencies(test)
|
config, systemCli, adminCli := s.commonDependencies(test)
|
||||||
|
|
||||||
requestId := requestid.Next()
|
requestId := requestid.Next()
|
||||||
wsServer := etp.NewServer(etp.WithServerReadLimit(2048))
|
wsServer := etp.NewServer(etp.WithServerReadLimit(2048))
|
||||||
@@ -165,14 +182,23 @@ func (s *HappyPathTestSuite) TestWsProxy() { // nolint: funlen
|
|||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
rr := lb.NewRoundRobin([]string{targetUrl.Host})
|
rr := lb.NewRoundRobin([]string{targetUrl.Host})
|
||||||
targetClients := map[string]*lb.RoundRobin{"target": rr}
|
targetClients := map[string]*lb.RoundRobin{"target": rr}
|
||||||
locator := assembly.NewLocator(test.Logger(), nil, targetClients, routes.NewRoutes(), systemCli, adminCli)
|
|
||||||
|
routes := routes.NewRoutes()
|
||||||
|
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
|
||||||
|
Endpoints: []cluster.EndpointDescriptor{{
|
||||||
|
Path: "/service",
|
||||||
|
}},
|
||||||
|
}})
|
||||||
|
require.NoError(err)
|
||||||
|
|
||||||
|
locator := assembly.NewLocator(test.Logger(), nil, targetClients, routes, systemCli, adminCli, nil)
|
||||||
locations := []conf.Location{{
|
locations := []conf.Location{{
|
||||||
SkipAuth: false,
|
SkipAuth: false,
|
||||||
PathPrefix: "/ws",
|
PathPrefix: "/ws",
|
||||||
Protocol: "ws",
|
Protocol: "ws",
|
||||||
TargetModule: "target",
|
TargetModule: "target",
|
||||||
}}
|
}}
|
||||||
handler, err := locator.Handler(config, locations, redisCli)
|
handler, err := locator.Handler(config, locations)
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
srv := httptest.NewServer(handler)
|
srv := httptest.NewServer(handler)
|
||||||
|
|
||||||
@@ -215,17 +241,17 @@ func (s wsEventHandlerMock) Handle(_ context.Context, conn *etp.Conn, event msg.
|
|||||||
|
|
||||||
func (s *HappyPathTestSuite) TestAdminAuthorization() {
|
func (s *HappyPathTestSuite) TestAdminAuthorization() {
|
||||||
test, require := test.New(s.T())
|
test, require := test.New(s.T())
|
||||||
config, redisCli, systemCli, adminCli := s.commonDependencies(test)
|
config, systemCli, adminCli := s.commonDependencies(test)
|
||||||
|
|
||||||
targetService, targetCli := grpct.NewMock(test)
|
targetService, targetCli := grpct.NewMock(test)
|
||||||
targetService.Mock("endpoint", func(ctx context.Context, authData grpc.AuthData, req request) response {
|
targetService.Mock("endpoint", func(ctx context.Context, authData grpc.AuthData, req request) response {
|
||||||
return response{Id: req.Id} //nolint:gosimple
|
return response{Id: req.Id}
|
||||||
})
|
})
|
||||||
targetClients := map[string]*client.Client{"target": targetCli}
|
targetClients := map[string]*client.Client{"target": targetCli}
|
||||||
logger, err := log.New(log.WithLevel(log.DebugLevel))
|
logger, err := log.New(log.WithLevel(log.DebugLevel))
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
routes := routes.NewRoutes()
|
routes := routes.NewRoutes()
|
||||||
locator := assembly.NewLocator(logger, targetClients, nil, routes, systemCli, adminCli)
|
locator := assembly.NewLocator(logger, targetClients, nil, routes, systemCli, adminCli, nil)
|
||||||
|
|
||||||
locations := []conf.Location{{
|
locations := []conf.Location{{
|
||||||
SkipAuth: false,
|
SkipAuth: false,
|
||||||
@@ -233,7 +259,7 @@ func (s *HappyPathTestSuite) TestAdminAuthorization() {
|
|||||||
Protocol: "grpc",
|
Protocol: "grpc",
|
||||||
TargetModule: "target",
|
TargetModule: "target",
|
||||||
}}
|
}}
|
||||||
handler, err := locator.Handler(config, locations, redisCli)
|
handler, err := locator.Handler(config, locations)
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
|
|
||||||
err = routes.ReceiveRoutes(context.Background(), cluster.RoutingConfig{{
|
err = routes.ReceiveRoutes(context.Background(), cluster.RoutingConfig{{
|
||||||
@@ -277,27 +303,9 @@ func (s *HappyPathTestSuite) TestAdminAuthorization() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// nolint:ireturn
|
// nolint:ireturn
|
||||||
func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, redis.UniversalClient, *client.Client, *client.Client) {
|
func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, *client.Client, *client.Client) {
|
||||||
require := test.Assert()
|
|
||||||
redisCli := NewRedis(test)
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
s.T().Cleanup(func() {
|
|
||||||
_, err := redisCli.Pipelined(ctx, func(p redis.Pipeliner) error {
|
|
||||||
p.Select(ctx, 0)
|
|
||||||
p.FlushDB(ctx)
|
|
||||||
p.Select(ctx, 1)
|
|
||||||
p.FlushDB(ctx)
|
|
||||||
p.Select(ctx, 2)
|
|
||||||
p.FlushDB(ctx)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
require.NoError(err)
|
|
||||||
})
|
|
||||||
|
|
||||||
config := conf.Remote{
|
config := conf.Remote{
|
||||||
Redis: &conf.Redis{Address: redisCli.address},
|
Http: conf.Http{MaxRequestBodySizeInMb: 1, ProxyTimeoutInSec: 15},
|
||||||
Http: conf.Http{MaxRequestBodySizeInMb: 1, ProxyTimeoutInSec: 15},
|
|
||||||
Logging: conf.Logging{LogLevel: log.DebugLevel, RequestLogEnable: true, BodyLogEnable: true,
|
Logging: conf.Logging{LogLevel: log.DebugLevel, RequestLogEnable: true, BodyLogEnable: true,
|
||||||
SkipBodyLoggingEndpointPrefixes: []string{"endpoint"}},
|
SkipBodyLoggingEndpointPrefixes: []string{"endpoint"}},
|
||||||
Caching: conf.Caching{AuthorizationDataInSec: 1, AuthenticationDataInSec: 1},
|
Caching: conf.Caching{AuthorizationDataInSec: 1, AuthenticationDataInSec: 1},
|
||||||
@@ -336,7 +344,7 @@ func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, r
|
|||||||
return domain.AdminAuthorizeResponse{Authorized: false}
|
return domain.AdminAuthorizeResponse{Authorized: false}
|
||||||
})
|
})
|
||||||
|
|
||||||
return config, redisCli, systemCli, adminCli
|
return config, systemCli, adminCli
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHappyPathTestSuite(t *testing.T) {
|
func TestHappyPathTestSuite(t *testing.T) {
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ func main() {
|
|||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
config := conf.Remote{
|
config := conf.Remote{
|
||||||
Redis: &conf.Redis{Address: "localhost:6379"},
|
|
||||||
Http: conf.Http{MaxRequestBodySizeInMb: 1, ProxyTimeoutInSec: 15},
|
Http: conf.Http{MaxRequestBodySizeInMb: 1, ProxyTimeoutInSec: 15},
|
||||||
Logging: conf.Logging{LogLevel: log.DebugLevel, RequestLogEnable: true, BodyLogEnable: true},
|
Logging: conf.Logging{LogLevel: log.DebugLevel, RequestLogEnable: true, BodyLogEnable: true},
|
||||||
Caching: conf.Caching{AuthorizationDataInSec: 15, AuthenticationDataInSec: 15},
|
Caching: conf.Caching{AuthorizationDataInSec: 15, AuthenticationDataInSec: 15},
|
||||||
@@ -85,14 +84,14 @@ func main() {
|
|||||||
})
|
})
|
||||||
targetClients := map[string]*client.Client{"target": targetCli}
|
targetClients := map[string]*client.Client{"target": targetCli}
|
||||||
logger, _ = log.New(log.WithLevel(log.DebugLevel))
|
logger, _ = log.New(log.WithLevel(log.DebugLevel))
|
||||||
locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli, adminCli)
|
locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli, adminCli, nil)
|
||||||
locations := []conf.Location{{
|
locations := []conf.Location{{
|
||||||
SkipAuth: false,
|
SkipAuth: false,
|
||||||
PathPrefix: "/api",
|
PathPrefix: "/api",
|
||||||
Protocol: "grpc",
|
Protocol: "grpc",
|
||||||
TargetModule: "target",
|
TargetModule: "target",
|
||||||
}}
|
}}
|
||||||
handler, _ := locator.Handler(config, locations, redisCli)
|
handler, _ := locator.Handler(config, locations)
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: "localhost:8000",
|
Addr: "localhost:8000",
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package tests
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/txix-open/isp-kit/test"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Redis struct {
|
|
||||||
address string
|
|
||||||
redis.UniversalClient
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRedis(test *test.Test) Redis {
|
|
||||||
redisHost := test.Config().Optional().String("REDIS_HOST", "localhost")
|
|
||||||
redisPort := test.Config().Optional().String("REDIS_PORT", "6379")
|
|
||||||
addr := fmt.Sprintf("%s:%s", redisHost, redisPort)
|
|
||||||
cli := redis.NewClient(&redis.Options{Addr: addr})
|
|
||||||
return Redis{UniversalClient: cli, address: addr}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Redis) Address() string {
|
|
||||||
return r.address
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user