Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43ce9babe5 | ||
|
|
418c35f159 | ||
|
|
aab8bcf7e3 | ||
|
|
55befb2d4d | ||
|
|
3ff40fda83 | ||
|
|
d1c78cecf1 | ||
|
|
d3165efc4f | ||
|
|
d380321d8e | ||
|
|
19b0d8f094 | ||
|
|
2a50f7d14f | ||
|
|
26d99675c0 | ||
|
|
e5a14a2729 | ||
|
|
8221c78a5c | ||
|
|
4a4969d9b9 | ||
|
|
49e37dfc8f | ||
|
|
ef3a89a57e | ||
|
|
8dafd6d726 | ||
|
|
1769847222 | ||
|
|
ece991abc0 | ||
|
|
e806c63ca1 | ||
|
|
e36e546c1c | ||
|
|
79ed7bdf22 | ||
|
|
76a9506283 | ||
|
|
44a84e474d | ||
|
|
421685bdef | ||
|
|
f637ef57f7 | ||
|
|
61c5637c3c | ||
|
|
ce9c4928b4 | ||
|
|
53ba7198fe | ||
|
|
b4757898e5 | ||
|
|
5f761b1802 | ||
|
|
9224c71047 | ||
|
|
b8ceaf2f17 | ||
|
|
ada46f175c | ||
|
|
8953ae0e90 | ||
|
|
427d9e25b5 | ||
|
|
eec0f5de66 | ||
|
|
ea59c720f2 | ||
|
|
570a1123dc | ||
|
|
0a1ec74ddb | ||
|
|
91f8e40e70 | ||
|
|
2a2d07dc3d | ||
|
|
f12b8e2b5d | ||
|
|
3152b6390d | ||
|
|
b8b0fbb8fc | ||
|
|
9bf34172a5 | ||
|
|
1217348b28 | ||
|
|
61f0c1a146 | ||
|
|
02f355c54d | ||
|
|
21d36809f7 | ||
|
|
a803438492 | ||
|
|
acd2c86998 | ||
|
|
4147f08c50 | ||
|
|
1cdba5cc36 | ||
|
|
252d400001 | ||
|
|
6806931428 | ||
|
|
534873855d | ||
|
|
c1dd61a423 | ||
|
|
35a389a716 | ||
|
|
18b6634f6b | ||
|
|
72fad31e37 | ||
|
|
44c0bb190b | ||
|
|
2da5167401 | ||
|
|
19211955b2 | ||
|
|
e3f8a4e8bf | ||
|
|
0a5c4f6559 | ||
|
|
e01f9a57d3 | ||
|
|
b1ab4846af | ||
|
|
b5beab71fc | ||
|
|
a4e5e14659 | ||
|
|
1781cd827f | ||
|
|
c0e755c0ed | ||
|
|
1a7f9e2b4c | ||
|
|
e97aea2e6f | ||
|
|
00a5c4729e | ||
|
|
1880bd43e5 | ||
|
|
7677991df3 | ||
|
|
66eedc4026 | ||
|
|
a3f71c2593 | ||
|
|
f339c87eca | ||
|
|
42d2dd18ac | ||
|
|
9bd31bf6c9 | ||
|
|
5ed8f259e4 | ||
|
|
9e994624b7 | ||
|
|
bbf7e2ced1 | ||
|
|
963fd1ae49 | ||
|
|
92a1c0b770 | ||
|
|
44766fff0d | ||
|
|
24058f5b6f | ||
|
|
8c59bb5f79 | ||
|
|
3f870ceeea | ||
|
|
b7a932bfb9 | ||
|
|
e2250121a1 | ||
|
|
9098129967 | ||
|
|
7a03f4e49b | ||
|
|
265dbc6250 | ||
|
|
2e2b903463 | ||
|
|
b4e9c9a563 | ||
|
|
626ffd29e6 | ||
|
|
f1260f0b10 | ||
|
|
7c1747cb13 | ||
|
|
02f37d7426 |
No files matched your search
@@ -18,11 +18,20 @@ linters:
|
|||||||
- varnamelen # очень индивидуально (db)
|
- varnamelen # очень индивидуально (db)
|
||||||
- wsl # расставление пробелов очень индивидуально
|
- wsl # расставление пробелов очень индивидуально
|
||||||
- wsl_v5 # расставление пробелов очень индивидуально
|
- wsl_v5 # расставление пробелов очень индивидуально
|
||||||
|
- godoclint # ругается на // nolint, не удобно
|
||||||
|
- prealloc # слишком аггресивный, в большинстве случаев не требуется
|
||||||
|
- gomodguard # deprecated
|
||||||
|
- goconst # слишком аггресивный
|
||||||
settings:
|
settings:
|
||||||
|
exhaustruct_v5:
|
||||||
|
allow-empty: true
|
||||||
|
explicit-mode: true
|
||||||
cyclop:
|
cyclop:
|
||||||
max-complexity: 15 # по умолчанию 10 мало
|
max-complexity: 15 # по умолчанию 10 мало
|
||||||
funlen:
|
funlen:
|
||||||
lines: 80
|
lines: 80
|
||||||
|
goconst:
|
||||||
|
ignore-tests: true # тестовые фикстуры не выносим в константы
|
||||||
lll:
|
lll:
|
||||||
line-length: 150
|
line-length: 150
|
||||||
revive:
|
revive:
|
||||||
@@ -54,6 +63,13 @@ linters:
|
|||||||
- linters:
|
- linters:
|
||||||
- wrapcheck
|
- wrapcheck
|
||||||
path: transaction # транзакции прозрачны
|
path: transaction # транзакции прозрачны
|
||||||
|
- linters:
|
||||||
|
- unqueryvet
|
||||||
|
- prealloc
|
||||||
|
path: ".*_test\\.go$"
|
||||||
|
- linters:
|
||||||
|
- goconst
|
||||||
|
path: "tests/" # компонентные тесты: фикстуры и моки не выносим в константы
|
||||||
paths:
|
paths:
|
||||||
- third_party$
|
- third_party$
|
||||||
- builtin$
|
- builtin$
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
# v1.9.1
|
||||||
|
* В метод `/rate_limit` добавлены необязательные поля `periodInSec` и `burst`, без них поведение прежнее
|
||||||
|
# v1.9.0
|
||||||
|
* Добавлен метод `/try_lock`
|
||||||
|
# v1.8.0
|
||||||
|
* Для метода `/rate_limit/inmem` добавлено поле `infiniteKey`, чтобы ключ не чистился из памяти
|
||||||
|
# v1.7.0
|
||||||
|
* Добавлена возможность использования inMemRateLimiter с RPS<1
|
||||||
# v1.6.1
|
# v1.6.1
|
||||||
* Обновлены зависимости
|
* Обновлены зависимости
|
||||||
# v1.6.0
|
# v1.6.0
|
||||||
|
|||||||
@@ -3,16 +3,17 @@ package assembly
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
goredislib "github.com/redis/go-redis/v9"
|
|
||||||
"github.com/txix-open/isp-kit/observability/sentry"
|
|
||||||
"github.com/txix-open/isp-kit/rc"
|
|
||||||
"isp-lock-service/conf"
|
"isp-lock-service/conf"
|
||||||
"isp-lock-service/repository"
|
"isp-lock-service/repository"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
goredislib "github.com/redis/go-redis/v9"
|
||||||
|
"github.com/txix-open/isp-kit/observability/sentry"
|
||||||
|
"github.com/txix-open/isp-kit/rc"
|
||||||
|
|
||||||
"github.com/txix-open/isp-kit/app"
|
"github.com/txix-open/isp-kit/app"
|
||||||
"github.com/txix-open/isp-kit/bootstrap"
|
"github.com/txix-open/isp-kit/bootstrap"
|
||||||
"github.com/txix-open/isp-kit/cluster"
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
"github.com/txix-open/isp-kit/grpc"
|
"github.com/txix-open/isp-kit/grpc"
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,14 +2,19 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"isp-lock-service/domain"
|
"isp-lock-service/domain"
|
||||||
|
|
||||||
|
"github.com/go-redsync/redsync/v4"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LockerService interface {
|
type LockerService interface {
|
||||||
Lock(ctx context.Context, req domain.LockRequest) (*domain.LockResponse, error)
|
Lock(ctx context.Context, req domain.LockRequest) (*domain.LockResponse, error)
|
||||||
|
TryLock(ctx context.Context, req domain.LockRequest) (*domain.LockResponse, error)
|
||||||
UnLock(ctx context.Context, req domain.UnLockRequest) (*domain.LockResponse, error)
|
UnLock(ctx context.Context, req domain.UnLockRequest) (*domain.LockResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +44,32 @@ func (l Locker) Lock(ctx context.Context, req domain.LockRequest) (*domain.LockR
|
|||||||
return l.s.Lock(ctx, req)
|
return l.s.Lock(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TryLock
|
||||||
|
// @Tags locker
|
||||||
|
// @Summary однократная попытка взять лок без ретраев
|
||||||
|
// @Description Пытаемся взять лок один раз. В отличие от Lock, не делает повторных попыток. При успехе возвращаем ключ для разблокировки.
|
||||||
|
// @Description При получение ошибки, что лок уже занят, возращаем ошибку с кодом 423.
|
||||||
|
// @Param key query string true "строка для лока"
|
||||||
|
// @Param ttlInSec query int true "число секунд после которых блокировка снимется автоматически"
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {object} domain.LockResponse
|
||||||
|
// @Failure 400 {object} apierrors.Error "lock already taken"
|
||||||
|
// @Router /api/isp-lock-service/try_lock [POST]
|
||||||
|
func (l Locker) TryLock(ctx context.Context, req domain.LockRequest) (*domain.LockResponse, error) {
|
||||||
|
var errTaken *redsync.ErrTaken
|
||||||
|
|
||||||
|
resp, err := l.s.TryLock(ctx, req)
|
||||||
|
switch {
|
||||||
|
case errors.As(err, &errTaken):
|
||||||
|
return nil, apierrors.NewBusinessError(http.StatusLocked, err.Error(), err)
|
||||||
|
case err != nil:
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
// UnLock
|
// UnLock
|
||||||
// @Tags locker
|
// @Tags locker
|
||||||
// @Summary снимаем лок со строки
|
// @Summary снимаем лок со строки
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
type limiterService interface {
|
type limiterService interface {
|
||||||
Limit(ctx context.Context, req domain.RateLimiterRequest) (*domain.RateLimiterResponse, error)
|
Limit(ctx context.Context, req domain.RateLimiterRequest) (*domain.RateLimiterResponse, error)
|
||||||
LimitInMem(ctx context.Context, req domain.RateLimiterRequest) (*domain.InMemRateLimiterResponse, error)
|
LimitInMem(ctx context.Context, req domain.RateLimiterInMemRequest) (*domain.RateLimiterInMemResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type RateLimiter struct {
|
type RateLimiter struct {
|
||||||
@@ -23,6 +23,6 @@ func (c RateLimiter) Limit(ctx context.Context, req domain.RateLimiterRequest) (
|
|||||||
return c.svc.Limit(ctx, req)
|
return c.svc.Limit(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c RateLimiter) LimitInMem(ctx context.Context, req domain.RateLimiterRequest) (*domain.InMemRateLimiterResponse, error) {
|
func (c RateLimiter) LimitInMem(ctx context.Context, req domain.RateLimiterInMemRequest) (*domain.RateLimiterInMemResponse, error) {
|
||||||
return c.svc.LimitInMem(ctx, req)
|
return c.svc.LimitInMem(ctx, req)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package docs
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
// Embedded swagger files.
|
||||||
|
var (
|
||||||
|
//go:embed swagger.json
|
||||||
|
SwaggerJson []byte
|
||||||
|
)
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "Шаблон сервиса",
|
||||||
|
"title": "isp-lock-service",
|
||||||
|
"contact": {},
|
||||||
|
"license": {
|
||||||
|
"name": "GNU GPL v3.0"
|
||||||
|
},
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"host": "localhost:9000",
|
||||||
|
"basePath": "/api/isp-lock-service",
|
||||||
|
"paths": {
|
||||||
|
"/api/isp-lock-service/lock": {
|
||||||
|
"post": {
|
||||||
|
"description": "Возвращаем ключ для разблокировки",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"locker"
|
||||||
|
],
|
||||||
|
"summary": "выставляем лок на строку",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "строка для лока",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "число секунд после которых блокировка снимется автоматически",
|
||||||
|
"name": "ttlInSec",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.LockResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/isp-lock-service/try_lock": {
|
||||||
|
"post": {
|
||||||
|
"description": "Пытаемся взять лок один раз. В отличие от Lock, не делает повторных попыток. При успехе возвращаем ключ для разблокировки.\nПри получение ошибки, что лок уже занят, возращаем ошибку с кодом 423.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"locker"
|
||||||
|
],
|
||||||
|
"summary": "однократная попытка взять лок без ретраев",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "строка для лока",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "число секунд после которых блокировка снимется автоматически",
|
||||||
|
"name": "ttlInSec",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/domain.LockResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "lock already taken",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/apierrors.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/isp-lock-service/unlock": {
|
||||||
|
"post": {
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"locker"
|
||||||
|
],
|
||||||
|
"summary": "снимаем лок со строки",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "строка для лока",
|
||||||
|
"name": "key",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "ключ для разблокировки, полученный из Lock",
|
||||||
|
"name": "lockKey",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"apierrors.Error": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"details": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {}
|
||||||
|
},
|
||||||
|
"errorCode": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"errorMessage": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domain.LockResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"lockKey": {
|
||||||
|
"description": "nolint: tagliatelle",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
basePath: /api/isp-lock-service
|
|
||||||
definitions:
|
|
||||||
domain.LockResponse:
|
|
||||||
properties:
|
|
||||||
lockKey:
|
|
||||||
description: 'nolint: tagliatelle'
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
host: localhost:9000
|
|
||||||
info:
|
|
||||||
contact: {}
|
|
||||||
description: Шаблон сервиса
|
|
||||||
license:
|
|
||||||
name: GNU GPL v3.0
|
|
||||||
title: isp-lock-service
|
|
||||||
version: 1.0.0
|
|
||||||
paths:
|
|
||||||
/api/isp-lock-service/lock:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Возвращаем ключ для разблокировки
|
|
||||||
parameters:
|
|
||||||
- description: строка для лока
|
|
||||||
in: query
|
|
||||||
name: key
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- description: число секунд после которых блокировка снимется автоматически
|
|
||||||
in: query
|
|
||||||
name: ttlInSec
|
|
||||||
required: true
|
|
||||||
type: integer
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/domain.LockResponse'
|
|
||||||
summary: выставляем лок на строку
|
|
||||||
tags:
|
|
||||||
- locker
|
|
||||||
/api/isp-lock-service/unlock:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
parameters:
|
|
||||||
- description: строка для лока
|
|
||||||
in: query
|
|
||||||
name: key
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- description: ключ для разблокировки, полученный из Lock
|
|
||||||
in: query
|
|
||||||
name: lockKey
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
summary: снимаем лок со строки
|
|
||||||
tags:
|
|
||||||
- locker
|
|
||||||
swagger: "2.0"
|
|
||||||
+11
-3
@@ -5,8 +5,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type RateLimiterRequest struct {
|
type RateLimiterRequest struct {
|
||||||
Key string `validate:"required"`
|
Key string `validate:"required"`
|
||||||
MaxRps int `validate:"required"`
|
MaxRps int `validate:"required"`
|
||||||
|
PeriodInSec int
|
||||||
|
Burst int
|
||||||
|
}
|
||||||
|
|
||||||
|
type RateLimiterInMemRequest struct {
|
||||||
|
Key string `validate:"required"`
|
||||||
|
MaxRps float64 `validate:"required"`
|
||||||
|
InfiniteKey bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type RateLimiterResponse struct {
|
type RateLimiterResponse struct {
|
||||||
@@ -15,6 +23,6 @@ type RateLimiterResponse struct {
|
|||||||
RetryAfter time.Duration
|
RetryAfter time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
type InMemRateLimiterResponse struct {
|
type RateLimiterInMemResponse struct {
|
||||||
PassAfter time.Duration
|
PassAfter time.Duration
|
||||||
}
|
}
|
||||||
@@ -1,81 +1,76 @@
|
|||||||
module isp-lock-service
|
module isp-lock-service
|
||||||
|
|
||||||
go 1.25
|
go 1.27
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-redis/redis_rate/v10 v10.0.1
|
github.com/go-redis/redis_rate/v10 v10.0.1
|
||||||
github.com/go-redsync/redsync/v4 v4.14.0
|
github.com/go-redsync/redsync/v4 v4.16.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/redis/go-redis/v9 v9.21.0
|
||||||
github.com/redis/go-redis/v9 v9.16.0
|
github.com/txix-open/isp-kit v1.74.2
|
||||||
github.com/txix-open/isp-kit v1.59.1
|
|
||||||
github.com/txix-open/jsonschema v1.3.0
|
github.com/txix-open/jsonschema v1.3.0
|
||||||
golang.org/x/sync v0.17.0
|
golang.org/x/exp v0.0.0-20260611194520-c48552f49976
|
||||||
golang.org/x/time v0.14.0
|
golang.org/x/sync v0.22.0
|
||||||
)
|
golang.org/x/time v0.15.0
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
|
||||||
go.opentelemetry.io/auto/sdk v1.2.0 // indirect
|
|
||||||
go.yaml.in/yaml/v2 v2.4.3 // 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.6.1 // indirect
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.3 // 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.14 // indirect
|
github.com/coder/websocket v1.8.15 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.15 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/getsentry/sentry-go v0.49.0 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
github.com/go-faker/faker/v4 v4.11.0 // indirect
|
||||||
github.com/getsentry/sentry-go v0.35.2 // indirect
|
github.com/go-logr/logr v1.4.4 // indirect
|
||||||
github.com/go-faker/faker/v4 v4.6.1 // 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/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/klauspost/compress v1.19.2 // indirect
|
||||||
github.com/mailru/easyjson v0.9.1 // indirect
|
github.com/leodido/go-urn v1.5.0 // indirect
|
||||||
|
github.com/mailru/easyjson v0.9.2 // 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/prometheus/client_golang v1.24.1 // indirect
|
||||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
|
||||||
github.com/prometheus/client_model v0.6.2 // indirect
|
github.com/prometheus/client_model v0.6.2 // indirect
|
||||||
github.com/prometheus/common v0.66.1 // indirect
|
github.com/prometheus/common v0.70.1 // indirect
|
||||||
github.com/prometheus/procfs v0.17.0 // indirect
|
github.com/prometheus/procfs v0.21.1 // indirect
|
||||||
github.com/stretchr/testify v1.11.1 // indirect
|
github.com/stretchr/testify v1.12.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/v4 v4.0.1 // indirect
|
github.com/txix-open/etp/v4 v4.1.3 // indirect
|
||||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // 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/otel v1.38.0 // indirect
|
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
|
go.opentelemetry.io/otel v1.46.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0 // indirect
|
||||||
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
|
go.opentelemetry.io/otel/metric v1.46.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
go.opentelemetry.io/otel/sdk v1.46.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
|
go.opentelemetry.io/otel/trace v1.46.0 // indirect
|
||||||
|
go.opentelemetry.io/proto/otlp v1.11.0 // indirect
|
||||||
|
go.uber.org/atomic v1.11.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.28.0 // indirect
|
||||||
golang.org/x/crypto v0.42.0 // indirect
|
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546
|
golang.org/x/crypto v0.55.0 // indirect
|
||||||
golang.org/x/net v0.44.0 // indirect
|
golang.org/x/net v0.58.0 // indirect
|
||||||
golang.org/x/sys v0.36.0 // indirect
|
golang.org/x/sys v0.47.0 // indirect
|
||||||
golang.org/x/text v0.29.0 // indirect
|
golang.org/x/text v0.41.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20260825221802-da73d73af1c5 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 // indirect
|
||||||
google.golang.org/grpc v1.75.1 // indirect
|
google.golang.org/grpc v1.83.2 // indirect
|
||||||
google.golang.org/protobuf v1.36.9 // indirect
|
google.golang.org/protobuf v1.36.12 // 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
|
||||||
)
|
)
|
||||||
@@ -8,30 +8,29 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
|||||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
github.com/buger/jsonparser v1.6.1 h1:I0phFv0PlbLHnM7TZAVjZ2MJ2/eWRTDyuO7GLR98IEs=
|
||||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
github.com/buger/jsonparser v1.6.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
github.com/cenkalti/backoff/v5 v5.0.3/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.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
|
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
|
||||||
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
||||||
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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||||
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/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
|
github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ=
|
||||||
github.com/getsentry/sentry-go v0.35.2 h1:jKuujpRwa8FFRYMIwwZpu83Xh0voll9bmvyc6310WBM=
|
github.com/getsentry/sentry-go v0.49.0 h1:Ehejknu1l023Ub7QoRBVLAI7g3Jnhqku4oWx4B4Sh5s=
|
||||||
github.com/getsentry/sentry-go v0.35.2/go.mod h1:mdL49ixwT2yi57k5eh7mpnDyPybixPzlzEJFu0Z76QA=
|
github.com/getsentry/sentry-go v0.49.0/go.mod h1:nuMJAoCfe1u0Bts2ocyNI+TW8HT84vRMqwA5Qq/SKUI=
|
||||||
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-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k=
|
github.com/go-faker/faker/v4 v4.11.0 h1:HeIFTzafXsgrlxKE2QySGGTQocfGdQ8sGqU2CXvs120=
|
||||||
github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY=
|
github.com/go-faker/faker/v4 v4.11.0/go.mod h1:VFIEwWDd16EdYDLF6NJ5gAAzEp7vz5LgKgJ2iZ17Tdg=
|
||||||
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.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
|
||||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.4/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=
|
||||||
@@ -48,19 +47,19 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC
|
|||||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||||
github.com/go-redis/redis_rate/v10 v10.0.1 h1:calPxi7tVlxojKunJwQ72kwfozdy25RjA0bCj1h0MUo=
|
github.com/go-redis/redis_rate/v10 v10.0.1 h1:calPxi7tVlxojKunJwQ72kwfozdy25RjA0bCj1h0MUo=
|
||||||
github.com/go-redis/redis_rate/v10 v10.0.1/go.mod h1:EMiuO9+cjRkR7UvdvwMO7vbgqJkltQHtwbdIQvaBKIU=
|
github.com/go-redis/redis_rate/v10 v10.0.1/go.mod h1:EMiuO9+cjRkR7UvdvwMO7vbgqJkltQHtwbdIQvaBKIU=
|
||||||
github.com/go-redsync/redsync/v4 v4.14.0 h1:zyxzFJsmQHIPBl8iBT7KFKohWsjsghgGLiP8TnFMLNc=
|
github.com/go-redsync/redsync/v4 v4.16.0 h1:bNcOzeHH9d3s6pghU9NJFMPrQa41f5Nx3L4YKr3BdEU=
|
||||||
github.com/go-redsync/redsync/v4 v4.14.0/go.mod h1:twMlVd19upZ/juvJyJGlQOSQxor1oeHtjs62l4pRFzo=
|
github.com/go-redsync/redsync/v4 v4.16.0/go.mod h1:V4gagqgyASWBZuwx4xGzu72aZNb/6Mo05byUa3mVmKQ=
|
||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/gomodule/redigo v1.9.2 h1:HrutZBLhSIU8abiSfW8pj8mPhOyMYjZT/wcA4/L9L9s=
|
github.com/gomodule/redigo v1.9.3 h1:dNPSXeXv6HCq2jdyWfjgmhBdqnR6PRO3m/G05nvpPC8=
|
||||||
github.com/gomodule/redigo v1.9.2/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw=
|
github.com/gomodule/redigo v1.9.3/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw=
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
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/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
@@ -70,18 +69,20 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
|
|||||||
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.19.2 h1:hMRETovs/pu/dVWN7zIT1PGG8t509MwT6bO7XSi26R8=
|
||||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
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 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
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.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
|
||||||
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
|
github.com/mailru/easyjson v0.9.2 h1:dX8U45hQsZpxd80nLvDGihsQ/OxlvTkVUXH2r/8cb2M=
|
||||||
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
github.com/mailru/easyjson v0.9.2/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=
|
||||||
@@ -95,24 +96,23 @@ github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4
|
|||||||
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
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/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
|
github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=
|
||||||
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
|
github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=
|
||||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||||
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs=
|
github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY=
|
||||||
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA=
|
github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc=
|
||||||
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
|
github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=
|
||||||
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
|
github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
github.com/rabbitmq/amqp091-go v1.14.0 h1:RSaT7aOKt/OrkVUyswPDW29lnRz9psuGmfZFBmLqLek=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
github.com/rabbitmq/amqp091-go v1.14.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||||
github.com/redis/go-redis/v9 v9.16.0 h1:OotgqgLSRCmzfqChbQyG1PHC3tLNR89DG4jdOERSEP4=
|
github.com/redis/go-redis/v9 v9.21.0 h1:FPBE4hhbAke+TLmcY3WkpbDffJEomdqPn3HYiqAtL9E=
|
||||||
github.com/redis/go-redis/v9 v9.16.0/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
|
github.com/redis/go-redis/v9 v9.21.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA=
|
||||||
github.com/redis/rueidis v1.0.64 h1:XqgbueDuNV3qFdVdQwAHJl1uNt90zUuAJuzqjH4cw6Y=
|
github.com/redis/rueidis v1.0.71 h1:pODtnAR5GAB7j4ekhldZ29HKOxe4Hph0GTDGk1ayEQY=
|
||||||
github.com/redis/rueidis v1.0.64/go.mod h1:Lkhr2QTgcoYBhxARU7kJRO8SyVlgUuEkcJO1Y8MCluA=
|
github.com/redis/rueidis v1.0.71/go.mod h1:lfdcZzJ1oKGKL37vh9fO3ymwt+0TdjkkUCJxbgpmcgQ=
|
||||||
github.com/redis/rueidis/rueidiscompat v1.0.64 h1:M8JbLP4LyHQhBLBRsUQIzui8/LyTtdESNIMVveqm4RY=
|
github.com/redis/rueidis/rueidiscompat v1.0.71 h1:wNZ//kEjMZgBM0KCk7ncOX8KmAgROU2kDdDNpwheG4w=
|
||||||
github.com/redis/rueidis/rueidiscompat v1.0.64/go.mod h1:8pJVPhEjpw0izZFSxYwDziUiEYEkEklTSw/nZzga61M=
|
github.com/redis/rueidis/rueidiscompat v1.0.71/go.mod h1:esmCLJvaRzZoKlgB82G1bY7Iky5TnO9Rz+NlhbEccFI=
|
||||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||||
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=
|
||||||
@@ -124,18 +124,18 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||||||
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/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.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
|
||||||
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM=
|
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM=
|
||||||
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
|
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
|
||||||
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/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
|
github.com/txix-open/etp/v4 v4.1.3 h1:u9ZyU2yKGgoQ1/DSaElhazWm8xASdqGEdWjoJ2xQlfo=
|
||||||
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
|
github.com/txix-open/etp/v4 v4.1.3/go.mod h1:9GK+Aje8BmLFq8Hk4j6Qb976LdU9WECCWAuLK1vAKgM=
|
||||||
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM=
|
github.com/txix-open/grmq v1.12.0 h1:lSPYvwLfTL0+b0xDQmuuN6RaKS3NCEJNK9ccWpOWa8Y=
|
||||||
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
|
github.com/txix-open/grmq v1.12.0/go.mod h1:6m9CCTQao/HAFalu5rFOZGJ5KLEP6WzzIwj80Ml3KGE=
|
||||||
github.com/txix-open/isp-kit v1.59.1 h1:a5kdpJQ5C9o9AwONejH5DEhz5wRW+XATSzyHDw7bnF4=
|
github.com/txix-open/isp-kit v1.74.2 h1:DRvnxyB2N3JnrsVnPGHw3GarqcfddQm2He/O8/Cm9eQ=
|
||||||
github.com/txix-open/isp-kit v1.59.1/go.mod h1:Mbprn7ExedjRg4yUPa9xShYx1oMJIU+a19x6ksVubaw=
|
github.com/txix-open/isp-kit v1.74.2/go.mod h1:LEBYertzXLJ3gSuxjeJTUcSGLtf28PZWDHFH9lccCHk=
|
||||||
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
|
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
|
||||||
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
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 h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
|
||||||
@@ -149,58 +149,64 @@ 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/auto/sdk v1.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM=
|
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
|
||||||
go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk=
|
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8=
|
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84=
|
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.71.0 h1:oFNJW32h2SXnET7XXstgT7pVh4vN+jW+GfiIaBguIZE=
|
||||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.71.0/go.mod h1:+H3sPOFwag14eMHTPMElZtV0e4YfVZ/85KgrKUCB5FI=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
|
go.opentelemetry.io/otel v1.46.0 h1:FHt5/CDyVxi/8IM1CH7VE/rRgq3kLHa2mSTVMO8AWyc=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
|
go.opentelemetry.io/otel v1.46.0/go.mod h1:Gj3SEScelsNC45tp4nSxRYlS+f5iez7W8XPMCt905kE=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0 h1:OFnwLJr+pF3iHrlGSzbxyuo6/6HyBlnlN1CWEJmBVcw=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0/go.mod h1:716wFneO0ov19A2beH5hjfh9AK5z/VWNAtDijp1Y0/g=
|
||||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0 h1:KrC1YrQeSt46ITMWAbgQx1M1eV1/1TKzttrBzymPmss=
|
||||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0/go.mod h1:zDSEzoEqsOrgBeGvH66KRgxh90VonFyJqBHA0Pk3+rM=
|
||||||
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
|
go.opentelemetry.io/otel/metric v1.46.0 h1:yBnkXvgV7AXFILZc5K6IZe/CBFF3OS7BJ8ov6/lj0K8=
|
||||||
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
|
go.opentelemetry.io/otel/metric v1.46.0/go.mod h1:iPmdWqifKUdzziPkvvzIJXITl56fQx2mGM/DHLB3/2o=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
|
go.opentelemetry.io/otel/sdk v1.46.0 h1:h5CNQQjEbuQXY/JfZtgt3i7HVFV3aHPO2OAwO2eTYPI=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
|
go.opentelemetry.io/otel/sdk v1.46.0/go.mod h1:GAERFXFt5SYCEB+YiKUbMBeza6UaDH7GmGOZEfh2gSM=
|
||||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
go.opentelemetry.io/otel/sdk/metric v1.46.0 h1:0piZ26EG4RBfebb2jhDH6ERCYHoVWduc3kLgPCwSnSE=
|
||||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
go.opentelemetry.io/otel/sdk/metric v1.46.0/go.mod h1:I1PbKrdVc8Qu8HYVDNtqVIwLwjNrhsV/uFuxfwg8mO4=
|
||||||
go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE=
|
go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu60qs1c=
|
||||||
go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0=
|
go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E=
|
||||||
|
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||||
|
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||||
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.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo=
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q=
|
||||||
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
|
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
|
||||||
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
|
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
|
||||||
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
|
||||||
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
|
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
|
||||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
|
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
|
||||||
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
golang.org/x/exp v0.0.0-20260611194520-c48552f49976 h1:X8Hz2ImujgbmetVuW+w2YkyZChE3cBpZi2P158rTG9M=
|
||||||
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
golang.org/x/exp v0.0.0-20260611194520-c48552f49976/go.mod h1:vnf4pv9iKZXY58sQE1L86zmNWJ4159e1RkcWiLCkeEY=
|
||||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
|
||||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
|
||||||
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
|
||||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
|
||||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
|
||||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ=
|
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw=
|
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w=
|
google.golang.org/genproto/googleapis/api v0.0.0-20260825221802-da73d73af1c5 h1:izFU9hz7aeLI/Mi1J0991ae+xcwRLr7hTqWnB/9aIIU=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og=
|
google.golang.org/genproto/googleapis/api v0.0.0-20260825221802-da73d73af1c5/go.mod h1:3LhxRw4YYkf+ylAfgaY9JlVLFKhokkCV8duhLLe7+t0=
|
||||||
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 h1:1VUiZAXyC+zmiFYi+WLtBzr68Cj8wOofHjjrA/kkizc=
|
||||||
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA=
|
||||||
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
|
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
|
||||||
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
|
||||||
|
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||||
|
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
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=
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"isp-lock-service/routes"
|
"isp-lock-service/routes"
|
||||||
|
|
||||||
"github.com/txix-open/isp-kit/bootstrap"
|
"github.com/txix-open/isp-kit/bootstrap"
|
||||||
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
"github.com/txix-open/isp-kit/shutdown"
|
"github.com/txix-open/isp-kit/shutdown"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,10 +23,9 @@ var (
|
|||||||
// @host localhost:9000
|
// @host localhost:9000
|
||||||
// @BasePath /api/isp-lock-service
|
// @BasePath /api/isp-lock-service
|
||||||
|
|
||||||
//go:generate swag init
|
//go:generate swag init -pd -ot json -eot json
|
||||||
//go:generate rm -f docs/swagger.json docs/docs.go
|
|
||||||
func main() {
|
func main() {
|
||||||
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors())
|
boot := bootstrap.New(version, conf.Remote{}, cluster.Endpoints(routes.EndpointDescriptors()), cluster.GrpcTransport)
|
||||||
app := boot.App
|
app := boot.App
|
||||||
logger := app.Logger()
|
logger := app.Logger()
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"isp-lock-service/conf"
|
"isp-lock-service/conf"
|
||||||
|
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
+18
-1
@@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/go-redsync/redsync/v4/redis/goredis/v9"
|
"github.com/go-redsync/redsync/v4/redis/goredis/v9"
|
||||||
"golang.org/x/exp/rand"
|
"golang.org/x/exp/rand"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
goredislib "github.com/redis/go-redis/v9"
|
goredislib "github.com/redis/go-redis/v9"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -77,6 +77,23 @@ func (l Locker) Lock(ctx context.Context, key string, ttl int) (*domain.LockResp
|
|||||||
return &domain.LockResponse{LockKey: value}, nil
|
return &domain.LockResponse{LockKey: value}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l Locker) TryLock(_ context.Context, key string, ttl int) (*domain.LockResponse, error) {
|
||||||
|
key = makeKey(l.prefix, key)
|
||||||
|
|
||||||
|
mtx := l.cli.NewMutex(key,
|
||||||
|
redsync.WithExpiry(time.Duration(ttl)*time.Second),
|
||||||
|
)
|
||||||
|
|
||||||
|
err := mtx.TryLock()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessagef(err, "fail lock. key=%s", key)
|
||||||
|
}
|
||||||
|
|
||||||
|
value := mtx.Value()
|
||||||
|
|
||||||
|
return &domain.LockResponse{LockKey: value}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (l Locker) UnLock(ctx context.Context, key, lockKey string) (*domain.LockResponse, error) {
|
func (l Locker) UnLock(ctx context.Context, key, lockKey string) (*domain.LockResponse, error) {
|
||||||
key = makeKey(l.prefix, key)
|
key = makeKey(l.prefix, key)
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"isp-lock-service/domain"
|
"isp-lock-service/domain"
|
||||||
|
|
||||||
"github.com/go-redis/redis_rate/v10"
|
"github.com/go-redis/redis_rate/v10"
|
||||||
"github.com/pkg/errors"
|
|
||||||
goredislib "github.com/redis/go-redis/v9"
|
goredislib "github.com/redis/go-redis/v9"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
)
|
)
|
||||||
@@ -29,7 +29,8 @@ type RateLimiter struct {
|
|||||||
type limiter struct {
|
type limiter struct {
|
||||||
*rate.Limiter
|
*rate.Limiter
|
||||||
|
|
||||||
lastUse time.Time
|
lastUse time.Time
|
||||||
|
infiniteKey bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRateLimiter(logger log.Logger, cli goredislib.UniversalClient, cfg conf.Remote) *RateLimiter {
|
func NewRateLimiter(logger log.Logger, cli goredislib.UniversalClient, cfg conf.Remote) *RateLimiter {
|
||||||
@@ -47,8 +48,22 @@ func NewRateLimiter(logger log.Logger, cli goredislib.UniversalClient, cfg conf.
|
|||||||
return limiter
|
return limiter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RateLimiter) Limit(ctx context.Context, key string, maxRps int) (*domain.RateLimiterResponse, error) {
|
func (r *RateLimiter) Limit(ctx context.Context, req domain.RateLimiterRequest) (*domain.RateLimiterResponse, error) {
|
||||||
res, err := r.cli.Allow(ctx, makeKey(r.prefix, key), redis_rate.PerSecond(maxRps))
|
period := time.Second
|
||||||
|
if req.PeriodInSec > 0 {
|
||||||
|
period = time.Duration(req.PeriodInSec) * time.Second
|
||||||
|
}
|
||||||
|
burst := req.Burst
|
||||||
|
if burst <= 0 {
|
||||||
|
burst = req.MaxRps
|
||||||
|
}
|
||||||
|
limit := redis_rate.Limit{
|
||||||
|
Rate: req.MaxRps,
|
||||||
|
Period: period,
|
||||||
|
Burst: burst,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := r.cli.Allow(ctx, makeKey(r.prefix, req.Key), limit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.WithMessage(err, "allow request")
|
return nil, errors.WithMessage(err, "allow request")
|
||||||
}
|
}
|
||||||
@@ -60,24 +75,31 @@ func (r *RateLimiter) Limit(ctx context.Context, key string, maxRps int) (*domai
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RateLimiter) LimitInMem(_ context.Context, key string, maxRps int) (*domain.InMemRateLimiterResponse, error) {
|
func (r *RateLimiter) LimitInMem(_ context.Context, key string, maxRps float64, infiniteKey bool) (*domain.RateLimiterInMemResponse, error) {
|
||||||
key = fmt.Sprintf("%s:::%d", key, maxRps)
|
key = fmt.Sprintf("%s:::%0.5f", key, maxRps)
|
||||||
r.mu.Lock()
|
r.mu.Lock()
|
||||||
defer r.mu.Unlock()
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
lim, ok := r.inMemLimiters[key]
|
lim, ok := r.inMemLimiters[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
lim = &limiter{Limiter: rate.NewLimiter(rate.Limit(maxRps), 1)}
|
lim = &limiter{
|
||||||
|
Limiter: rate.NewLimiter(rate.Limit(maxRps), 1),
|
||||||
|
infiniteKey: infiniteKey,
|
||||||
|
}
|
||||||
|
if maxRps < 1 {
|
||||||
|
lim.ReserveN(time.Now(), 1)
|
||||||
|
}
|
||||||
r.inMemLimiters[key] = lim
|
r.inMemLimiters[key] = lim
|
||||||
}
|
}
|
||||||
lim.lastUse = time.Now()
|
lim.lastUse = time.Now()
|
||||||
|
lim.infiniteKey = infiniteKey
|
||||||
|
|
||||||
res := lim.ReserveN(lim.lastUse, 1)
|
res := lim.ReserveN(lim.lastUse, 1)
|
||||||
if !res.OK() {
|
if !res.OK() {
|
||||||
return nil, errors.Errorf("can't reserve time; key='%s'", key)
|
return nil, errors.Errorf("can't reserve time; key='%s'", key)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &domain.InMemRateLimiterResponse{
|
return &domain.RateLimiterInMemResponse{
|
||||||
PassAfter: res.DelayFrom(lim.lastUse),
|
PassAfter: res.DelayFrom(lim.lastUse),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@@ -92,7 +114,7 @@ func (r *RateLimiter) removeUnusedLimiters(lastUseThreshold time.Duration) int {
|
|||||||
|
|
||||||
limiterCount := len(r.inMemLimiters)
|
limiterCount := len(r.inMemLimiters)
|
||||||
for k, v := range r.inMemLimiters {
|
for k, v := range r.inMemLimiters {
|
||||||
if time.Since(v.lastUse) >= lastUseThreshold {
|
if time.Since(v.lastUse) >= lastUseThreshold && !v.infiniteKey {
|
||||||
delete(r.inMemLimiters, k)
|
delete(r.inMemLimiters, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-1
@@ -2,10 +2,12 @@ package routes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/txix-open/isp-kit/cluster"
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
|
"github.com/txix-open/isp-kit/common_endpoints"
|
||||||
"github.com/txix-open/isp-kit/grpc"
|
"github.com/txix-open/isp-kit/grpc"
|
||||||
"github.com/txix-open/isp-kit/grpc/endpoint"
|
"github.com/txix-open/isp-kit/grpc/endpoint"
|
||||||
|
|
||||||
"isp-lock-service/controller"
|
"isp-lock-service/controller"
|
||||||
|
"isp-lock-service/docs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Controllers struct {
|
type Controllers struct {
|
||||||
@@ -15,7 +17,7 @@ type Controllers struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func EndpointDescriptors() []cluster.EndpointDescriptor {
|
func EndpointDescriptors() []cluster.EndpointDescriptor {
|
||||||
return endpointDescriptors(Controllers{})
|
return concatDescriptors(endpointDescriptors(Controllers{}), commonEndpoints())
|
||||||
}
|
}
|
||||||
|
|
||||||
func Handler(wrapper endpoint.Wrapper, c Controllers) *grpc.Mux {
|
func Handler(wrapper endpoint.Wrapper, c Controllers) *grpc.Mux {
|
||||||
@@ -23,6 +25,9 @@ func Handler(wrapper endpoint.Wrapper, c Controllers) *grpc.Mux {
|
|||||||
for _, descriptor := range endpointDescriptors(c) {
|
for _, descriptor := range endpointDescriptors(c) {
|
||||||
muxer.Handle(descriptor.Path, wrapper.Endpoint(descriptor.Handler))
|
muxer.Handle(descriptor.Path, wrapper.Endpoint(descriptor.Handler))
|
||||||
}
|
}
|
||||||
|
for _, descriptor := range commonEndpoints() {
|
||||||
|
muxer.Handle(descriptor.Path, wrapper.Endpoint(descriptor.Handler))
|
||||||
|
}
|
||||||
return muxer
|
return muxer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +37,11 @@ func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
|
|||||||
Inner: true,
|
Inner: true,
|
||||||
UserAuthRequired: false,
|
UserAuthRequired: false,
|
||||||
Handler: c.Locker.Lock,
|
Handler: c.Locker.Lock,
|
||||||
|
}, {
|
||||||
|
Path: "isp-lock-service/try_lock",
|
||||||
|
Inner: true,
|
||||||
|
UserAuthRequired: false,
|
||||||
|
Handler: c.Locker.TryLock,
|
||||||
}, {
|
}, {
|
||||||
Path: "isp-lock-service/unlock",
|
Path: "isp-lock-service/unlock",
|
||||||
Inner: true,
|
Inner: true,
|
||||||
@@ -64,3 +74,17 @@ func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
|
|||||||
Handler: c.RateLimiter.LimitInMem,
|
Handler: c.RateLimiter.LimitInMem,
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func commonEndpoints() []cluster.EndpointDescriptor {
|
||||||
|
return common_endpoints.CommonEndpoints("isp-lock-service",
|
||||||
|
common_endpoints.WithSwaggerEndpoint(docs.SwaggerJson),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func concatDescriptors(descs ...[]cluster.EndpointDescriptor) []cluster.EndpointDescriptor {
|
||||||
|
result := make([]cluster.EndpointDescriptor, 0)
|
||||||
|
for _, desc := range descs {
|
||||||
|
result = append(result, desc...)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
@@ -5,8 +5,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"isp-lock-service/domain"
|
"isp-lock-service/domain"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dailyLimiterRepo interface {
|
type dailyLimiterRepo interface {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
type LockerRepo interface {
|
type LockerRepo interface {
|
||||||
Lock(ctx context.Context, key string, ttlInSec int) (*domain.LockResponse, error)
|
Lock(ctx context.Context, key string, ttlInSec int) (*domain.LockResponse, error)
|
||||||
|
TryLock(ctx context.Context, key string, ttlInSec int) (*domain.LockResponse, error)
|
||||||
UnLock(ctx context.Context, key, lockKey string) (*domain.LockResponse, error)
|
UnLock(ctx context.Context, key, lockKey string) (*domain.LockResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +31,11 @@ func (l Locker) Lock(ctx context.Context, req domain.LockRequest) (*domain.LockR
|
|||||||
return l.repo.Lock(ctx, req.Key, req.TTLInSec)
|
return l.repo.Lock(ctx, req.Key, req.TTLInSec)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l Locker) TryLock(ctx context.Context, req domain.LockRequest) (*domain.LockResponse, error) {
|
||||||
|
// nolint: wrapcheck
|
||||||
|
return l.repo.TryLock(ctx, req.Key, req.TTLInSec)
|
||||||
|
}
|
||||||
|
|
||||||
func (l Locker) UnLock(ctx context.Context, req domain.UnLockRequest) (*domain.LockResponse, error) {
|
func (l Locker) UnLock(ctx context.Context, req domain.UnLockRequest) (*domain.LockResponse, error) {
|
||||||
// nolint: wrapcheck
|
// nolint: wrapcheck
|
||||||
return l.repo.UnLock(ctx, req.Key, req.LockKey)
|
return l.repo.UnLock(ctx, req.Key, req.LockKey)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type limiterRepo interface {
|
type limiterRepo interface {
|
||||||
Limit(ctx context.Context, key string, maxRps int) (*domain.RateLimiterResponse, error)
|
Limit(ctx context.Context, req domain.RateLimiterRequest) (*domain.RateLimiterResponse, error)
|
||||||
LimitInMem(ctx context.Context, key string, maxRps int) (*domain.InMemRateLimiterResponse, error)
|
LimitInMem(ctx context.Context, key string, maxRps float64, infiniteKey bool) (*domain.RateLimiterInMemResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type rateLimiter struct {
|
type rateLimiter struct {
|
||||||
@@ -20,9 +20,9 @@ func NewRateLimiter(repo limiterRepo) rateLimiter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s rateLimiter) Limit(ctx context.Context, req domain.RateLimiterRequest) (*domain.RateLimiterResponse, error) {
|
func (s rateLimiter) Limit(ctx context.Context, req domain.RateLimiterRequest) (*domain.RateLimiterResponse, error) {
|
||||||
return s.repo.Limit(ctx, req.Key, req.MaxRps) // nolint:wrapcheck
|
return s.repo.Limit(ctx, req) // nolint:wrapcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s rateLimiter) LimitInMem(ctx context.Context, req domain.RateLimiterRequest) (*domain.InMemRateLimiterResponse, error) {
|
func (s rateLimiter) LimitInMem(ctx context.Context, req domain.RateLimiterInMemRequest) (*domain.RateLimiterInMemResponse, error) {
|
||||||
return s.repo.LimitInMem(ctx, req.Key, req.MaxRps) // nolint:wrapcheck
|
return s.repo.LimitInMem(ctx, req.Key, req.MaxRps, req.InfiniteKey) // nolint:wrapcheck
|
||||||
}
|
}
|
||||||
+112
-12
@@ -4,11 +4,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/txix-open/isp-kit/test"
|
|
||||||
"github.com/txix-open/isp-kit/test/fake"
|
|
||||||
"isp-lock-service/conf"
|
"isp-lock-service/conf"
|
||||||
"isp-lock-service/domain"
|
"isp-lock-service/domain"
|
||||||
"isp-lock-service/repository"
|
"isp-lock-service/repository"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/test"
|
||||||
|
"github.com/txix-open/isp-kit/test/fake"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRateLimiter(t *testing.T) {
|
func TestRateLimiter(t *testing.T) {
|
||||||
@@ -30,7 +31,7 @@ func TestRateLimiter(t *testing.T) {
|
|||||||
ctx = t.Context()
|
ctx = t.Context()
|
||||||
)
|
)
|
||||||
for i := range maxRps {
|
for i := range maxRps {
|
||||||
resp, err := r.Limit(ctx, key, maxRps)
|
resp, err := r.Limit(ctx, domain.RateLimiterRequest{Key: key, MaxRps: maxRps})
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
exp := &domain.RateLimiterResponse{
|
exp := &domain.RateLimiterResponse{
|
||||||
Allow: true,
|
Allow: true,
|
||||||
@@ -40,7 +41,7 @@ func TestRateLimiter(t *testing.T) {
|
|||||||
required.EqualValues(exp, resp)
|
required.EqualValues(exp, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := r.Limit(ctx, key, maxRps)
|
resp, err := r.Limit(ctx, domain.RateLimiterRequest{Key: key, MaxRps: maxRps})
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
exp := &domain.RateLimiterResponse{
|
exp := &domain.RateLimiterResponse{
|
||||||
Allow: false,
|
Allow: false,
|
||||||
@@ -51,7 +52,7 @@ func TestRateLimiter(t *testing.T) {
|
|||||||
required.EqualValues(exp, resp)
|
required.EqualValues(exp, resp)
|
||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
resp, err = r.Limit(ctx, key, maxRps)
|
resp, err = r.Limit(ctx, domain.RateLimiterRequest{Key: key, MaxRps: maxRps})
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
exp = &domain.RateLimiterResponse{
|
exp = &domain.RateLimiterResponse{
|
||||||
Allow: true,
|
Allow: true,
|
||||||
@@ -62,7 +63,7 @@ func TestRateLimiter(t *testing.T) {
|
|||||||
|
|
||||||
for range 1000 {
|
for range 1000 {
|
||||||
key := fake.It[string]()
|
key := fake.It[string]()
|
||||||
resp, err := r.Limit(ctx, key, 1)
|
resp, err := r.Limit(ctx, domain.RateLimiterRequest{Key: key, MaxRps: 1})
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
exp := &domain.RateLimiterResponse{
|
exp := &domain.RateLimiterResponse{
|
||||||
Allow: true,
|
Allow: true,
|
||||||
@@ -73,6 +74,45 @@ func TestRateLimiter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRateLimiterWithPeriod(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
tst, required := test.New(t)
|
||||||
|
redis := NewRedis(tst)
|
||||||
|
r := repository.NewRateLimiter(tst.Logger(), redis, conf.Remote{
|
||||||
|
Redis: conf.Redis{Prefix: "test"},
|
||||||
|
InMemLimiter: conf.InMemLimiter{
|
||||||
|
ClearPeriodInSec: 10,
|
||||||
|
LastUseThresholdInSec: 10,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
tst.T().Cleanup(r.Close)
|
||||||
|
|
||||||
|
var (
|
||||||
|
req = domain.RateLimiterRequest{
|
||||||
|
Key: fake.It[string](),
|
||||||
|
MaxRps: 1,
|
||||||
|
PeriodInSec: 60,
|
||||||
|
Burst: 1,
|
||||||
|
}
|
||||||
|
ctx = t.Context()
|
||||||
|
)
|
||||||
|
|
||||||
|
resp, err := r.Limit(ctx, req)
|
||||||
|
required.NoError(err)
|
||||||
|
required.True(resp.Allow)
|
||||||
|
|
||||||
|
resp, err = r.Limit(ctx, req)
|
||||||
|
required.NoError(err)
|
||||||
|
required.False(resp.Allow)
|
||||||
|
required.Greater(resp.RetryAfter, 59*time.Second)
|
||||||
|
firstRetryAfter := resp.RetryAfter
|
||||||
|
|
||||||
|
resp, err = r.Limit(ctx, req)
|
||||||
|
required.NoError(err)
|
||||||
|
required.False(resp.Allow)
|
||||||
|
required.LessOrEqual(resp.RetryAfter, firstRetryAfter)
|
||||||
|
}
|
||||||
|
|
||||||
func TestRateLimiterInMem(t *testing.T) {
|
func TestRateLimiterInMem(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tst, required := test.New(t)
|
tst, required := test.New(t)
|
||||||
@@ -91,7 +131,7 @@ func TestRateLimiterInMem(t *testing.T) {
|
|||||||
ctx = t.Context()
|
ctx = t.Context()
|
||||||
)
|
)
|
||||||
for i := range 2 * maxRps {
|
for i := range 2 * maxRps {
|
||||||
resp, err := r.LimitInMem(ctx, key, maxRps)
|
resp, err := r.LimitInMem(ctx, key, float64(maxRps), false)
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
expPassAfter := reqInterval * time.Duration(i)
|
expPassAfter := reqInterval * time.Duration(i)
|
||||||
required.True(resp.PassAfter <= expPassAfter)
|
required.True(resp.PassAfter <= expPassAfter)
|
||||||
@@ -99,12 +139,72 @@ func TestRateLimiterInMem(t *testing.T) {
|
|||||||
|
|
||||||
for range 1000 {
|
for range 1000 {
|
||||||
key := fake.It[string]()
|
key := fake.It[string]()
|
||||||
resp, err := r.LimitInMem(ctx, key, 1)
|
resp, err := r.LimitInMem(ctx, key, 1, false)
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
required.True(resp.PassAfter <= 0)
|
required.True(resp.PassAfter <= 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRateLimiterInMemInfiniteKey(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
tst, required := test.New(t)
|
||||||
|
r := repository.NewRateLimiter(tst.Logger(), nil, conf.Remote{
|
||||||
|
InMemLimiter: conf.InMemLimiter{
|
||||||
|
ClearPeriodInSec: 2,
|
||||||
|
LastUseThresholdInSec: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
tst.T().Cleanup(r.Close)
|
||||||
|
|
||||||
|
var (
|
||||||
|
maxRps = 1
|
||||||
|
reqInterval = time.Second / time.Duration(maxRps)
|
||||||
|
key = "key"
|
||||||
|
ctx = t.Context()
|
||||||
|
)
|
||||||
|
for i := range 2 * maxRps {
|
||||||
|
resp, err := r.LimitInMem(ctx, key, float64(maxRps), true)
|
||||||
|
required.NoError(err)
|
||||||
|
expPassAfter := reqInterval * time.Duration(i)
|
||||||
|
required.True(resp.PassAfter <= expPassAfter)
|
||||||
|
}
|
||||||
|
|
||||||
|
for range 1000 {
|
||||||
|
_, err := r.LimitInMem(ctx, key, 1, true)
|
||||||
|
required.NoError(err)
|
||||||
|
}
|
||||||
|
<-time.After(time.Second * 4)
|
||||||
|
|
||||||
|
resp, err := r.LimitInMem(ctx, key, 1, true)
|
||||||
|
required.NoError(err)
|
||||||
|
required.Positive(resp.PassAfter)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRateLimiterInMemLowRPSCase(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
tst, required := test.New(t)
|
||||||
|
r := repository.NewRateLimiter(tst.Logger(), nil, conf.Remote{
|
||||||
|
InMemLimiter: conf.InMemLimiter{
|
||||||
|
ClearPeriodInSec: 10,
|
||||||
|
LastUseThresholdInSec: 10,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
tst.T().Cleanup(r.Close)
|
||||||
|
|
||||||
|
var (
|
||||||
|
maxRps = 0.5
|
||||||
|
reqInterval = time.Duration(float64(time.Second) / maxRps)
|
||||||
|
key = "key"
|
||||||
|
ctx = t.Context()
|
||||||
|
)
|
||||||
|
for i := range 3 {
|
||||||
|
resp, err := r.LimitInMem(ctx, key, maxRps, false)
|
||||||
|
required.NoError(err)
|
||||||
|
expPassAfter := reqInterval * time.Duration(i+1)
|
||||||
|
required.True(resp.PassAfter <= expPassAfter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkRateLimiter(b *testing.B) {
|
func BenchmarkRateLimiter(b *testing.B) {
|
||||||
tst, _ := test.New(new(testing.T))
|
tst, _ := test.New(new(testing.T))
|
||||||
redis := NewRedis(tst)
|
redis := NewRedis(tst)
|
||||||
@@ -126,7 +226,7 @@ func BenchmarkRateLimiter(b *testing.B) {
|
|||||||
|
|
||||||
b.Run("Limit", func(b *testing.B) {
|
b.Run("Limit", func(b *testing.B) {
|
||||||
for range b.N {
|
for range b.N {
|
||||||
_, err := r.Limit(ctx, key, maxRps)
|
_, err := r.Limit(ctx, domain.RateLimiterRequest{Key: key, MaxRps: maxRps})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("unexpected error: %v", err)
|
b.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@@ -135,7 +235,7 @@ func BenchmarkRateLimiter(b *testing.B) {
|
|||||||
|
|
||||||
b.Run("LimitInMem", func(b *testing.B) {
|
b.Run("LimitInMem", func(b *testing.B) {
|
||||||
for range b.N {
|
for range b.N {
|
||||||
_, err := r.LimitInMem(ctx, key, maxRps)
|
_, err := r.LimitInMem(ctx, key, float64(maxRps), false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("unexpected error: %v", err)
|
b.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@@ -167,7 +267,7 @@ func BenchmarkRateLimiter2(b *testing.B) {
|
|||||||
for i := range 100 {
|
for i := range 100 {
|
||||||
maxRps := i + 1
|
maxRps := i + 1
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
_, err := r.Limit(ctx, key, maxRps)
|
_, err := r.Limit(ctx, domain.RateLimiterRequest{Key: key, MaxRps: maxRps})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("unexpected error for maxRps %d and key %s: %v", maxRps, key, err)
|
b.Fatalf("unexpected error for maxRps %d and key %s: %v", maxRps, key, err)
|
||||||
}
|
}
|
||||||
@@ -181,7 +281,7 @@ func BenchmarkRateLimiter2(b *testing.B) {
|
|||||||
for i := range 100 {
|
for i := range 100 {
|
||||||
maxRps := i + 1
|
maxRps := i + 1
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
_, err := r.LimitInMem(ctx, key, maxRps)
|
_, err := r.LimitInMem(ctx, key, float64(maxRps), false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("unexpected error for maxRps %d and key %s: %v", maxRps, key, err)
|
b.Fatalf("unexpected error for maxRps %d and key %s: %v", maxRps, key, err)
|
||||||
}
|
}
|
||||||
|
|||||||
+94
-3
@@ -1,7 +1,12 @@
|
|||||||
package tests_test
|
package tests_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/big"
|
||||||
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -18,10 +23,12 @@ func NewRedis(test *test.Test) *redis.Client {
|
|||||||
redisHost := test.Config().Optional().String("REDIS_HOST", "localhost")
|
redisHost := test.Config().Optional().String("REDIS_HOST", "localhost")
|
||||||
redisPort := test.Config().Optional().String("REDIS_PORT", "6379")
|
redisPort := test.Config().Optional().String("REDIS_PORT", "6379")
|
||||||
addr := fmt.Sprintf("%s:%s", redisHost, redisPort)
|
addr := fmt.Sprintf("%s:%s", redisHost, redisPort)
|
||||||
return redis.NewClient(&redis.Options{Addr: addr})
|
return redis.NewClient(&redis.Options{
|
||||||
|
Addr: addr,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOne(t *testing.T) {
|
func TestOneLock(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
tst, required := test.New(t)
|
tst, required := test.New(t)
|
||||||
@@ -39,10 +46,10 @@ func TestOne(t *testing.T) {
|
|||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
|
|
||||||
// look at wait
|
// look at wait
|
||||||
|
n := time.Now()
|
||||||
_, err = r.Lock(ctx, key, 1)
|
_, err = r.Lock(ctx, key, 1)
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
|
|
||||||
n := time.Now()
|
|
||||||
_, err = r.Lock(ctx, key, 1)
|
_, err = r.Lock(ctx, key, 1)
|
||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
|
|
||||||
@@ -65,6 +72,90 @@ func TestOne(t *testing.T) {
|
|||||||
required.NoError(err)
|
required.NoError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestOneTryLock(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tst, required := test.New(t)
|
||||||
|
rcli := NewRedis(tst)
|
||||||
|
ctx := t.Context()
|
||||||
|
|
||||||
|
r := repository.NewLocker(tst.Logger(), rcli, conf.Redis{Prefix: "testPrefix"}, conf.LockSettings{})
|
||||||
|
|
||||||
|
// success story
|
||||||
|
rnd, err := rand.Int(rand.Reader, big.NewInt(time.Now().Unix()))
|
||||||
|
required.NoError(err)
|
||||||
|
key := strconv.Itoa(int(rnd.Int64()))
|
||||||
|
l, err := r.TryLock(ctx, key, 1)
|
||||||
|
required.NoError(err)
|
||||||
|
|
||||||
|
_, err = r.UnLock(ctx, key, l.LockKey)
|
||||||
|
required.NoError(err)
|
||||||
|
|
||||||
|
// second lock — no wait, immediate error on conflict
|
||||||
|
resp, err := r.TryLock(ctx, key, 3)
|
||||||
|
required.NoError(err)
|
||||||
|
|
||||||
|
_, err = r.TryLock(ctx, key, 2)
|
||||||
|
required.Error(err)
|
||||||
|
if err != nil {
|
||||||
|
required.Error(err, "fail lock")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = r.UnLock(ctx, key, resp.LockKey)
|
||||||
|
required.NoError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTryLockAfterTTL(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tst, required := test.New(t)
|
||||||
|
rcli := NewRedis(tst)
|
||||||
|
ctx := t.Context()
|
||||||
|
|
||||||
|
r := repository.NewLocker(tst.Logger(), rcli, conf.Redis{Prefix: "testPrefix"}, conf.LockSettings{})
|
||||||
|
|
||||||
|
rnd, err := rand.Int(rand.Reader, big.NewInt(time.Now().Unix()))
|
||||||
|
required.NoError(err)
|
||||||
|
key := strconv.Itoa(int(rnd.Int64()))
|
||||||
|
_, err = r.TryLock(ctx, key, 1)
|
||||||
|
required.NoError(err)
|
||||||
|
|
||||||
|
time.Sleep(1200 * time.Millisecond)
|
||||||
|
|
||||||
|
l2, err := r.TryLock(ctx, key, 1)
|
||||||
|
required.NoError(err)
|
||||||
|
|
||||||
|
_, err = r.UnLock(ctx, key, l2.LockKey)
|
||||||
|
required.NoError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestTryLockConcurrency(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
tst, required := test.New(t)
|
||||||
|
redis := NewRedis(tst)
|
||||||
|
|
||||||
|
r := repository.NewLocker(tst.Logger(), redis, conf.Redis{Prefix: "testPrefix"}, conf.LockSettings{})
|
||||||
|
|
||||||
|
var successCount atomic.Int64
|
||||||
|
|
||||||
|
group := new(sync.WaitGroup)
|
||||||
|
for range 10000 {
|
||||||
|
group.Add(1)
|
||||||
|
group.Go(func() {
|
||||||
|
defer group.Done()
|
||||||
|
resp, err := r.TryLock(t.Context(), "keyTryLock", 5)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
successCount.Add(1)
|
||||||
|
_, err = r.UnLock(t.Context(), "keyTryLock", resp.LockKey)
|
||||||
|
required.NoError(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
group.Wait()
|
||||||
|
required.Positive(successCount.Load())
|
||||||
|
}
|
||||||
|
|
||||||
func TestConcurrency(t *testing.T) {
|
func TestConcurrency(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tst, required := test.New(t)
|
tst, required := test.New(t)
|
||||||
|
|||||||
Reference in new issue
Block a user