Compare commits

..
28 Commits
Author SHA1 Message Date
txix a841cd082b 2025-12-26 09:37:14: merge [main:2b5ee66527f48ea4e6111148c0ba3c23611d6772];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-12-26 09:37:14 +03:00
txix 9b18fe7351 2025-11-26 13:43:01: merge [main:e9c5c9b80517122ca122933c111070bf470e31c1];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-11-26 13:43:01 +03:00
txix f3c801e4a4 2025-11-26 10:05:59: merge [main:96f8e79d3384c01bf52552f94afdf4ed662997e5];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-11-26 10:05:59 +03:00
txix ee13991d87 2025-10-03 15:15:07: merge [main:c3e3ed9636c6987e89feaf39503dda74462fcfde];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-10-03 15:15:07 +03:00
txix d4846359e4 2025-10-02 16:02:08: merge [main:13db082fcac220b28433a207845ceb3bef8bd07d];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-10-02 16:02:08 +03:00
txix 13cf0075f6 2025-09-17 18:07:26: merge [main:f5bfe7d2ba0d7a2f391f4ffaff6fffc1686ba3c7];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-09-17 18:07:26 +03:00
txix 135e551473 2025-08-21 15:04:13: merge [main:a4b6e5fd1d9685c751c5988518e9f8dd62a8e519]; 2025-08-21 15:04:13 +03:00
txix 689f730a3e 2025-07-09 12:35:19: merge [main:9f485b5e57937029be52e58137ef79ad5c3ca524];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-07-09 12:35:19 +03:00
txix a30582fa38 2025-07-03 12:26:31: merge [main:66e6c4b9c432b19b644d033703545d38aba3b847];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-07-03 12:26:31 +03:00
txix 5b1ce14467 2025-07-01 16:40:11: merge [main:61f11c0bda72fe35f473f8302edfaf86f151c0ad];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-07-01 16:40:11 +03:00
txix 264b438cdb 2025-07-01 13:32:55: merge [main:6491e79afd06cd665731c89f8ab2cd373351c1b4]; 2025-07-01 13:32:55 +03:00
txix f699aefa58 2025-05-27 14:32:05: merge [master:01f8dcdc36fb3f9867a65ffb7379ad25c85cd988];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2025-05-27 14:32:05 +03:00
txix 8d40e76637 2025-05-13 13:05:46: merge [master:49d1bfaa3f027c5465de7a0c0d46a9bab0588e19]; 2025-05-13 13:05:46 +03:00
txix e2b4becfd6 2025-04-29 14:57:30: merge [master:357ce03935a551e8be5766b349a621104998de83]; 2025-04-29 14:57:30 +03:00
txix e4ef2d8645 2025-04-23 12:39:56: merge [master:82ac257e917aa3f9ab915b911afbd28c0f52f88e]; 2025-04-23 12:39:56 +03:00
txix bfc28503d5 2025-04-18 12:46:39: merge [master:7b5fc0b41640a6b6648e6391777fa08099997af1]; 2025-04-18 12:46:39 +03:00
txix d759f883f4 2025-04-18 12:26:12: merge [master:576ef18526fa6f0685f8ab997cae0d31a4ebce90]; 2025-04-18 12:26:13 +03:00
txix 64373fdf3c 2025-04-03 17:31:43: merge [master:03df79d7b37febb99439347c2da79707bf437498]; 2025-04-03 17:31:43 +03:00
txix 1dd566593e 2024-12-27 17:46:16: merge [master:4898a95fc423e3ae55135d3023a1b78fb18edebc]; 2024-12-27 17:46:16 +03:00
txix 560c1f22c4 2024-12-27 12:28:18: merge [master:9ec52bd8525d6120bfebe62b6da4eb172a000ee8]; 2024-12-27 12:28:18 +03:00
txix 171b85f627 2024-12-27 12:14:12: merge [master:bf6ba426f66d82ef1e76da30674890898919501b]; 2024-12-27 12:14:12 +03:00
txix 734b83b2b8 2024-12-11 12:34:04: merge [master:744eaa2605c9d3eb73b2db76661b2d0a6949d4d9]; 2024-12-11 12:34:04 +03:00
txix bdeb2c0753 2024-12-03 13:02:16: merge [master:b21f96b8a5ec988002a89bd9d1f51e90c01a2d21]; 2024-12-03 13:02:16 +03:00
txix 97c44fb3bd 2024-10-11 14:58:36: merge [master:7f99b95ceaaed865d2833070a0397cf191949b8e]; 2024-10-11 14:58:36 +03:00
txix 6db18c1495 2024-07-01 10:56:14: merge [master:f9b2632335c35844013af97443dacebb9fc385c5]; 2024-07-01 10:56:14 +03:00
txix cd985ff5a3 2024-03-26 12:20:05: merge [master:27c825f7051ccbb42344a2d66c50192e2b3b5889]; 2024-03-26 12:20:05 +03:00
txix 2eed857503 2024-03-22 15:21:57: merge [master:d3624ee87e4530490024ae4023a1c69643689e95]; 2024-03-22 15:21:57 +03:00
txix 2b91caece0 2024-01-22 17:22:41: merge [master:56d3e06e49d7a75f142424293788a4f3b6245430]; 2024-01-22 17:22:41 +03:00
31 changed files with 220 additions and 425 deletions

No files matched your search

-2
View File
@@ -74,5 +74,3 @@ package.json
yarn.lock
conf/config_dev.yml
.DS_Store
-6
View File
@@ -19,8 +19,6 @@ linters:
- varnamelen # очень индивидуально (db)
- wsl # расставление пробелов очень индивидуально
- wsl_v5 # расставление пробелов очень индивидуально
- godoclint # ругается на // nolint, не удобно
- prealloc # слишком аггресивный, в большинстве случаев не требуется
settings:
cyclop:
max-complexity: 15 # по умолчанию 10 мало
@@ -57,10 +55,6 @@ linters:
- linters:
- wrapcheck
path: transaction # транзакции прозрачны
- linters:
- unqueryvet
- prealloc
path: ".*_test\\.go$"
- linters:
- wrapcheck
path: middleware #отсутствует необходимость оборачивать ошибки
+1 -1
View File
@@ -1 +1 @@
5.9.4
5.6.0
-23
View File
@@ -1,26 +1,3 @@
### v5.9.4
* Добавлено логирование `requestId` в лог `throttling: rate limit has been reached for application`
### v5.9.3
* Исправлена опечатка при вызове `strings.TrimPrefix`
### v5.9.2
* При проверке `logging.skipBodyLoggingEndpointPrefixes` игнорируется `/` в начале, путь для проверки берётся из `pathSchema`, если `pathSchema` пустая, берётся вызываемый `endpoint`
* В логе `log request` из значения в поле `endpoint` удаляется `/` в начале, путь берётся из `pathSchema`, если `pathSchema` пустая, берётся вызываемый `endpoint`
### v5.9.1
* Добавлен `warn` лог на неизвестный endpoint
### v5.9.0
* Теперь в зависимоси от `StatusCode` выводится соотвествующий уровень логирования: 400 -> warn, 500 -> error
* Исправлен порядок мидлварей, для корректного проброса `requestId`
### v5.8.1
* Обновлены зависимости
### v5.8.0
* Изменён resolve для endpoint'ов, теперь используется `lookup` у `github.com/julienschmidt/httprouter`
* Добавлен http метод в запрос авторизации (`system/secure/authorize`)
### v5.7.0
* Добавлено лог поле `applicationName` в логи `log request` и `bypassing unauthorized request because it has admin privilege`
### v5.6.2
* Обновлено заполнение заголовка `x-application-name` для поддержки кириллических символов
### v5.6.1
* Добавлен проброс заголовка `x-application-name`
### v5.6.0
* Добавлена поддержка метрик для http запросов
### v5.5.1
+1 -1
View File
@@ -74,7 +74,7 @@ func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
boot: boot,
server: server,
logger: boot.App.Logger(),
routes: routes.NewRoutes(boot.App.Logger()),
routes: routes.NewRoutes(),
locations: localConfig.Locations,
grpcClientByModuleName: grpcClientByModuleName,
httpHostManagerByModuleName: httpHostManagerByModuleName,
+8 -22
View File
@@ -1,12 +1,10 @@
package assembly
import (
"net/http"
"strings"
"time"
"github.com/txix-open/isp-kit/metrics"
"github.com/txix-open/isp-kit/metrics/http_metrics"
"net/http"
"time"
"isp-gate-service/conf"
"isp-gate-service/middleware"
@@ -73,11 +71,6 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
dailyLimitService := service.NewDailyLimit(lockRepo, config.DailyLimits)
throttlingService := service.NewThrottling(lockRepo, config.Throttling)
skipBodyLoggingEndpointPrefixes := make([]string, 0, len(config.Logging.SkipBodyLoggingEndpointPrefixes))
for _, prefix := range config.Logging.SkipBodyLoggingEndpointPrefixes {
skipBodyLoggingEndpointPrefixes = append(skipBodyLoggingEndpointPrefixes, strings.TrimPrefix(prefix, "/"))
}
mux := mux2.NewRouter()
for _, location := range locations {
var proxyFunc middleware.Handler
@@ -113,31 +106,26 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
config.Logging.SkipBodyLoggingEndpointPrefixes,
config.Logging.EnableForceUnescapingUnicode,
),
middleware.RequestId(),
middleware.ErrorHandler(l.logger),
middleware.Authenticate(authentication),
middleware.AdminAuthenticate(adminService),
middleware.ClientRequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Authorize(authorization, l.logger),
middleware.AdminAuthorize(adminService),
middleware.AdminAuthorize(l.routes, adminService),
middleware.Throttling(throttlingService),
middleware.DailyLimit(dailyLimitService),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Metrics(metricsStorage),
)
errorOnUnknownEndpoint := true
if location.SkipAuth {
errorOnUnknownEndpoint = false
handler = middleware.Chain(
proxyFunc,
middleware.Logger(l.logger, config.Logging.RequestLogEnable,
enableBodyLog,
skipBodyLoggingEndpointPrefixes,
config.Logging.SkipBodyLoggingEndpointPrefixes,
config.Logging.EnableForceUnescapingUnicode,
),
middleware.RequestId(),
middleware.ErrorHandler(l.logger),
middleware.ClientRequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
middleware.Metrics(metricsStorage),
)
}
@@ -145,10 +133,8 @@ func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Ha
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd
handler,
middleware.EntryPointConfig{
WithPrefix: location.WithPrefix,
PathPrefix: location.PathPrefix,
ErrorOnUnknownEndpoint: errorOnUnknownEndpoint,
WithLendingSlash: location.Protocol != conf.GrpcProtocol,
WithPrefix: location.WithPrefix,
PathPrefix: location.PathPrefix,
},
l.routes,
l.logger,
+2 -2
View File
@@ -12,7 +12,7 @@ import (
func init() {
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
t.Type = "string"
t.Enum = []any{"debug", "info", "warn", "error", "fatal"}
t.Enum = []interface{}{"debug", "info", "warn", "error", "fatal"}
})
}
@@ -40,7 +40,7 @@ type Logging struct {
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования,логирование запросов осуществляется на уровне debug"`
RequestLogEnable bool `schema:"Включить логирование запросов"`
BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"`
SkipBodyLoggingEndpointPrefixes []string `schema:"Выключить логирование тел запросов и ответов для путей имеющих префикс из списка,'/' в начале игнорируется"`
SkipBodyLoggingEndpointPrefixes []string `schema:"регулярные выражения для отключения логирования"`
EnableForceUnescapingUnicode bool `schema:"Включить перевод тел запроса из unicode в utf-8, должно быть включено логирование тел запросов и ответов"`
}
-23
View File
@@ -1,23 +0,0 @@
package domain
import "context"
type EndpointMeta struct {
Inner bool
RequiredAdminPermission string
// Объявляемый сервисом метод
PathSchema string
// Вызываемый метод
Endpoint string
}
type endpointMetaKey struct{}
func (m EndpointMeta) ToContext(ctx context.Context) context.Context {
return context.WithValue(ctx, endpointMetaKey{}, m)
}
func EndpointMetaFromContext(ctx context.Context) EndpointMeta {
meta, _ := ctx.Value(endpointMetaKey{}).(EndpointMeta)
return meta
}
-1
View File
@@ -12,7 +12,6 @@ type AuthenticateResponse struct {
type AuthorizeRequest struct {
ApplicationId int
HttpMethod string
Endpoint string
}
+28 -28
View File
@@ -1,6 +1,6 @@
module isp-gate-service
go 1.26
go 1.25
require (
github.com/google/uuid v1.6.0
@@ -10,18 +10,18 @@ require (
github.com/redis/go-redis/v9 v9.11.0
github.com/stretchr/testify v1.11.1
github.com/tomakado/websocketproxy v0.1.0
github.com/txix-open/isp-kit v1.66.2
github.com/txix-open/isp-kit v1.63.3
github.com/txix-open/jsonschema v1.3.0
golang.org/x/net v0.52.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c
google.golang.org/grpc v1.79.2
golang.org/x/net v0.44.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090
google.golang.org/grpc v1.75.1
)
require (
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/txix-open/etp/v4 v4.0.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.opentelemetry.io/auto/sdk v1.2.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
)
require (
@@ -32,17 +32,17 @@ require (
github.com/coder/websocket v1.8.14 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
github.com/getsentry/sentry-go v0.43.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
github.com/getsentry/sentry-go v0.35.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.9.1 // indirect
github.com/mailru/easyjson v0.9.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/reflect2 v1.0.2 // indirect
@@ -50,8 +50,8 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.20.1 // indirect
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/etp/v3 v3.2.0
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
@@ -59,21 +59,21 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0 // indirect
go.opentelemetry.io/otel v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.1 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c // indirect
google.golang.org/protobuf v1.36.11 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 // indirect
google.golang.org/protobuf v1.36.9 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+68 -66
View File
@@ -10,6 +10,8 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
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.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/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
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/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -23,14 +25,14 @@ 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/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/getsentry/sentry-go v0.43.0 h1:XbXLpFicpo8HmBDaInk7dum18G9KSLcjZiyUKS+hLW4=
github.com/getsentry/sentry-go v0.43.0/go.mod h1:XDotiNZbgf5U8bPDUAfvcFmOnMQQceESxyKaObSssW0=
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/getsentry/sentry-go v0.35.2 h1:jKuujpRwa8FFRYMIwwZpu83Xh0voll9bmvyc6310WBM=
github.com/getsentry/sentry-go v0.35.2/go.mod h1:mdL49ixwT2yi57k5eh7mpnDyPybixPzlzEJFu0Z76QA=
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-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E=
github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk=
github.com/go-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k=
github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY=
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.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -42,8 +44,8 @@ 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/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-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
@@ -55,14 +57,14 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
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/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
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/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -71,8 +73,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
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/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
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/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -92,10 +94,10 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
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/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs=
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA=
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
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/redis/go-redis/v9 v9.11.0 h1:E3S08Gl/nJNn5vkxd2i78wZxWAPNZgUNTp8WIJUAiIs=
@@ -121,10 +123,10 @@ github.com/txix-open/etp/v3 v3.2.0 h1:EgTchT8VtCYV1iEo/y4jII3/NybrXiQDE0y6pmS350
github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0=
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
github.com/txix-open/grmq v1.10.0 h1:1bXuF+7TxtUvoh+Wn6SOCYpVACFbWDuDmz/+tKwW9Ms=
github.com/txix-open/grmq v1.10.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
github.com/txix-open/isp-kit v1.66.2 h1:+AFj7g9IeWiLSShmotrdheuJuwUNUYeL49D2d7PU3zo=
github.com/txix-open/isp-kit v1.66.2/go.mod h1:F4B/+ErbNVaWzIIGasXM5DtcDKtjl6u2OESO02RyzCI=
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM=
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
github.com/txix-open/isp-kit v1.63.3 h1:UJLgR4z8sYXUX6r1sl6Ww1aijPx6b7ieMeB+elZoViM=
github.com/txix-open/isp-kit v1.63.3/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4=
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/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
@@ -138,56 +140,56 @@ 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/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0 h1:c9r/G1CSw4dPI1jaNNG9RnQP+q4SvZnHciDQJVIvchU=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0/go.mod h1:gO9smoZe9KnZcJCqcB0lMmQ4Z5VEifYmjMTpnwtTSuQ=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 h1:uLXP+3mghfMf7XmV4PkGfFhFKuNWoCvvx5wP/wOXo0o=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0/go.mod h1:v0Tj04armyT59mnURNUJf7RCKcKzq+lgJs6QSjHjaTc=
go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo=
go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts=
go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA=
go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc=
go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.opentelemetry.io/auto/sdk v1.2.0 h1:YpRtUFjvhSymycLS2T81lT6IGhcUP+LUPtv0iv1N8bM=
go.opentelemetry.io/auto/sdk v1.2.0/go.mod h1:1deq2zL7rwjwC8mR7XgY2N+tlIl6pjmEUoLDENMEzwk=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4=
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE=
go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0=
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/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c h1:OyQPd6I3pN/9gDxz6L13kYGJgqkpdrAohJRBeXyxlgI=
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c/go.mod h1:X2gu9Qwng7Nn009s/r3RUxqkzQNqOrAy79bluY7ojIg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c h1:xgCzyF2LFIO/0X2UAoVRiXKU5Xg6VjToG4i2/ecSswk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.79.2 h1:fRMD94s2tITpyJGtBBn7MkMseNpOZU8ZxgC3MMBaXRU=
google.golang.org/grpc v1.79.2/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090 h1:d8Nakh1G+ur7+P3GcMjpRDEkoLUcLW2iU92XVqR+XMQ=
google.golang.org/genproto/googleapis/api v0.0.0-20250908214217-97024824d090/go.mod h1:U8EXRNSd8sUYyDfs/It7KVWodQr+Hf9xtxyxWudSwEw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
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/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+1 -1
View File
@@ -1,4 +1,4 @@
// nolint:mnd,gosec
// nolint:mnd
package helpers
import (
+1 -1
View File
@@ -28,7 +28,7 @@ func (e *HttpError) Error() string {
func (e *HttpError) WriteError(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(e.statusCode)
data := map[string]any{
data := map[string]interface{}{
"errorCode": http.StatusText(e.statusCode),
"errorMessage": e.userMessage,
"details": e.details,
+3 -5
View File
@@ -1,12 +1,10 @@
package main
import (
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
"isp-gate-service/assembly"
"isp-gate-service/conf"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/shutdown"
)
var (
@@ -14,7 +12,7 @@ var (
)
func main() {
boot := bootstrap.New(version, conf.Remote{}, nil, cluster.HttpTransport)
boot := bootstrap.New(version, conf.Remote{}, nil)
app := boot.App
logger := app.Logger()
+11 -9
View File
@@ -9,16 +9,19 @@ import (
"isp-gate-service/request"
)
type AdminMethodStore interface {
IsInnerEndpoint(endpoint string) bool
RequiredAdminPermission(endpoint string) (string, bool)
}
type AdminAuthorizer interface {
AdminAuthorize(ctx context.Context, adminId int, permission string) (bool, error)
}
func AdminAuthorize(authorizer AdminAuthorizer) Middleware {
func AdminAuthorize(store AdminMethodStore, authorizer AdminAuthorizer) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
endpointMeta := ctx.EndpointMeta()
isInner := endpointMeta.Inner
isInner := store.IsInnerEndpoint(ctx.Endpoint())
if !isInner {
return next.Handle(ctx)
}
@@ -27,13 +30,12 @@ func AdminAuthorize(authorizer AdminAuthorizer) Middleware {
return httperrors.New(
http.StatusForbidden,
"admin authentication required",
errors.Errorf("admin authorization: admin authentication required for '%s'",
endpointMeta.Endpoint),
errors.Errorf("admin authorization: admin authentication required for '%s'", ctx.Endpoint()),
)
}
requiredPerm := endpointMeta.RequiredAdminPermission
if requiredPerm == "" {
requiredPerm, ok := store.RequiredAdminPermission(ctx.Endpoint())
if !ok {
return next.Handle(ctx)
}
@@ -47,7 +49,7 @@ func AdminAuthorize(authorizer AdminAuthorizer) Middleware {
"endpoint is not allowed",
errors.Errorf(
"admin authorization: endpoint '%s' requires '%s' permission, but admin '%d' doesn't have it",
endpointMeta.Endpoint, requiredPerm, ctx.AdminId(),
ctx.Endpoint(), requiredPerm, ctx.AdminId(),
),
)
}
+3 -12
View File
@@ -11,7 +11,7 @@ import (
)
type Authorizer interface {
Authorize(ctx context.Context, applicationId int, httpMethod string, pathSchema string) (bool, error)
Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error)
}
func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
@@ -22,13 +22,7 @@ func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
return errors.WithMessage(err, "authorize: get auth data")
}
endpointMeta := ctx.EndpointMeta()
ok, err := authorizer.Authorize(
ctx.Context(),
authData.ApplicationId,
ctx.Request().Method,
endpointMeta.PathSchema,
)
ok, err := authorizer.Authorize(ctx.Context(), authData.ApplicationId, ctx.Endpoint())
if err != nil {
return errors.WithMessage(err, "authorize: authorize")
}
@@ -37,7 +31,6 @@ func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
ctx.Context(),
"bypassing unauthorized request because it has admin privilege",
log.Int("applicationId", authData.ApplicationId),
log.String("applicationName", authData.AppName),
log.Int("adminId", ctx.AdminId()),
)
return next.Handle(ctx)
@@ -46,9 +39,7 @@ func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
return httperrors.New(
http.StatusForbidden,
"endpoint is not allowed",
errors.Errorf("authorize: endpoint '%s' with http method '%s' is not allowed for application '%d'",
endpointMeta.PathSchema, ctx.Request().Method, authData.ApplicationId,
),
errors.Errorf("authorize: endpoint '%s' is not allowed for application '%d'", ctx.Endpoint(), authData.ApplicationId),
)
}
+7 -28
View File
@@ -1,24 +1,19 @@
package middleware
import (
"isp-gate-service/domain"
"isp-gate-service/request"
"net/http"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/log"
"isp-gate-service/request"
"net/http"
)
type EntryPointConfig struct {
PathPrefix string
WithPrefix bool
ErrorOnUnknownEndpoint bool
WithLendingSlash bool
PathPrefix string
WithPrefix bool
}
type EndpointResolver interface {
ResolveEndpoint(method string, path string, cfg EntryPointConfig) (*domain.EndpointMeta, error)
GetPaths(path string, cfg EntryPointConfig) (string, string)
ResolveEndpoint(path string, cfg EntryPointConfig) string
}
func Entrypoint(
@@ -31,26 +26,10 @@ func Entrypoint(
return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize)
endpoint, err := entryPointResolver.ResolveEndpoint(req.Method, req.URL.Path, cfg)
if err != nil {
lookupPath, endpoint := entryPointResolver.GetPaths(req.URL.Path, cfg)
logger.Warn(
req.Context(),
"call unknown method",
log.String("pathPrefix", cfg.PathPrefix),
log.String("httpMethod", req.Method),
log.String("originalPath", req.URL.Path),
log.String("lookupPath", lookupPath),
log.String("enpoint", endpoint),
)
http.Error(writer, err.Error(), http.StatusNotImplemented)
return
}
endpoint := entryPointResolver.ResolveEndpoint(req.URL.Path, cfg)
ctx := request.NewContext(req, writer, endpoint)
err = next.Handle(ctx)
err := next.Handle(ctx)
if err != nil {
logger.Error(req.Context(), errors.WithMessage(err, "uncaught error"))
}
+4 -19
View File
@@ -50,7 +50,7 @@ func (w *writerWrapper) WriteHeader(statusCode int) {
w.ResponseWriter.WriteHeader(statusCode)
}
func Logger( // nolint:gocognit,funlen
func Logger( // nolint:gocognit
logger log.Logger,
enableRequestLogging bool,
enableBodyLogging bool,
@@ -65,16 +65,10 @@ func Logger( // nolint:gocognit,funlen
r := ctx.Request()
endpoint := ctx.EndpointMeta().Endpoint
if ctx.EndpointMeta().PathSchema != "" {
endpoint = ctx.EndpointMeta().PathSchema
}
endpoint = strings.TrimPrefix(endpoint, "/")
logBodyFromCurrenRequest := enableBodyLogging
if logBodyFromCurrenRequest {
for _, prefix := range skipBodyLoggingEndpointPrefixes {
if strings.HasPrefix(endpoint, prefix) {
if strings.HasPrefix(ctx.Endpoint(), prefix) {
logBodyFromCurrenRequest = false
break
}
@@ -116,9 +110,8 @@ func Logger( // nolint:gocognit,funlen
log.String("xForwardedFor", r.Header.Get("X-Forwarded-For")),
log.Int("statusCode", scSrc.StatusCode()),
log.String("path", originalPath),
log.String("endpoint", endpoint),
log.String("endpoint", ctx.Endpoint()),
log.Int("applicationId", authData.ApplicationId),
log.String("applicationName", authData.AppName),
log.Int("adminId", ctx.AdminId()),
}
@@ -131,15 +124,7 @@ func Logger( // nolint:gocognit,funlen
fields = append(fields, log.ByteString("response", buf.ResponseBody()))
}
switch {
case scSrc.StatusCode() >= http.StatusInternalServerError:
logger.Error(ctx.Context(), "log request", fields...)
case scSrc.StatusCode() >= http.StatusBadRequest:
logger.Warn(ctx.Context(), "log request", fields...)
default:
logger.Debug(ctx.Context(), "log request", fields...)
}
logger.Debug(ctx.Context(), "log request", fields...)
return err
})
+3 -3
View File
@@ -10,8 +10,8 @@ import (
func Metrics(storage *http_metrics.ServerStorage) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
pathSchema := ctx.EndpointMeta().PathSchema
if pathSchema == "" {
endpoint := ctx.Endpoint()
if endpoint == "" {
return next.Handle(ctx)
}
@@ -23,7 +23,7 @@ func Metrics(storage *http_metrics.ServerStorage) Middleware {
return err
}
storage.ObserveDuration(r.Method, pathSchema, time.Since(start))
storage.ObserveDuration(r.Method, endpoint, time.Since(start))
return nil
})
+1 -19
View File
@@ -13,28 +13,10 @@ const (
requestIdHeader = "x-request-id"
)
func RequestId() Middleware {
func RequestId(forwardClientRequestId bool, forwardReqIdByApp map[int]bool) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
requestId := requestid.Next()
context := requestid.ToContext(ctx.Context(), requestId)
context = log.ToContext(context, log.String("requestId", requestId))
ctx.SetContext(context)
return next.Handle(ctx)
})
}
}
func ClientRequestId(forwardClientRequestId bool, forwardReqIdByApp map[int]bool) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
requestId := requestid.FromContext(ctx.Context())
if requestId == "" {
requestId = requestid.Next()
}
clientRequestId := strings.TrimSpace(ctx.Request().Header.Get(requestIdHeader))
logFields := make([]log.Field, 0)
+2 -6
View File
@@ -5,12 +5,10 @@ import (
"fmt"
"net/http"
"github.com/pkg/errors"
"isp-gate-service/domain"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/requestid"
)
type Throttler interface {
@@ -30,12 +28,10 @@ func Throttling(throttler Throttler) Middleware {
return errors.WithMessage(err, "throttling: allow rate limit")
}
if !result.Allow {
requestId := requestid.FromContext(ctx.Context())
return httperrors.New(
http.StatusTooManyRequests,
fmt.Sprintf("rate limit has been reached, try after %dms", result.RetryAfter.Milliseconds()),
errors.Errorf("throttling: rate limit has been reached for application '%d', requestId '%s'",
authData.ApplicationId, requestId),
errors.Errorf("throttling: rate limit has been reached for application '%d'", authData.ApplicationId),
)
}
+3 -6
View File
@@ -3,7 +3,6 @@ package proxy
import (
"context"
"encoding/base64"
"io"
"net/http"
"strconv"
@@ -71,7 +70,7 @@ func (p Grpc) Handle(ctx *request.Context) error {
requestId := requestid.FromContext(ctx.Context())
md := metadata.MD{
grpc.ProxyMethodNameHeader: {ctx.EndpointMeta().Endpoint},
grpc.ProxyMethodNameHeader: {ctx.Endpoint()},
requestid.Header: {requestId},
}
@@ -84,8 +83,6 @@ func (p Grpc) Handle(ctx *request.Context) error {
md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)}
md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)}
md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)}
encodedAppName := base64.StdEncoding.EncodeToString([]byte(authData.AppName))
md[grpc.ApplicationNameHeader] = []string{encodedAppName}
if ctx.IsAdminAuthenticated() {
md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())}
}
@@ -98,7 +95,7 @@ func (p Grpc) Handle(ctx *request.Context) error {
Body: &isp.Message_BytesBody{BytesBody: body},
})
if err != nil {
return p.handleError(err, ctx.ResponseWriter(), ctx.EndpointMeta().Endpoint)
return p.handleError(err, ctx.ResponseWriter(), ctx.Endpoint())
}
return p.writeResponse(http.StatusOK, result.GetBytesBody(), requestId, ctx.ResponseWriter())
@@ -138,7 +135,7 @@ func (p Grpc) handleError(err error, w http.ResponseWriter, endpoint string) err
)
}
func (p Grpc) writeProto(statusCode int, proto any, w http.ResponseWriter) error {
func (p Grpc) writeProto(statusCode int, proto interface{}, w http.ResponseWriter) error {
data, err := json.Marshal(proto)
if err != nil {
return errors.WithMessage(err, "marshal grpc details to json")
+1 -4
View File
@@ -1,7 +1,6 @@
package proxy
import (
"encoding/base64"
"fmt"
"net"
"net/http"
@@ -66,7 +65,7 @@ func (p Http) Handle(ctx *request.Context) error {
}
request := ctx.Request()
request.URL.Path = ctx.EndpointMeta().Endpoint
request.URL.Path = ctx.Endpoint()
err = setHttpHeaders(ctx, request.Header, p.skipAuth)
if err != nil {
return err
@@ -101,8 +100,6 @@ func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) err
header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId))
header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId))
header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId))
encodedAppName := base64.StdEncoding.EncodeToString([]byte(authData.AppName))
header.Set(grpc.ApplicationNameHeader, encodedAppName) //nolint:canonicalheader
if ctx.IsAdminAuthenticated() {
header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader
} else {
+1 -1
View File
@@ -38,7 +38,7 @@ func (ws Ws) Handle(ctx *request.Context) error {
}
request := ctx.Request()
request.URL.Path = ctx.EndpointMeta().Endpoint
request.URL.Path = ctx.Endpoint()
var resultError error
proxy := websocketproxy.NewProxy(target)
+3 -4
View File
@@ -4,10 +4,9 @@ package repository
import (
"context"
"isp-gate-service/domain"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/client"
"isp-gate-service/domain"
)
const (
@@ -37,10 +36,10 @@ func (r System) Authenticate(ctx context.Context, token string) (*domain.Authent
return &resp, nil
}
func (r System) Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error) {
func (r System) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) {
resp := domain.AuthorizeResponse{}
err := r.cli.Invoke(authorize).
JsonRequestBody(req).
JsonRequestBody(domain.AuthorizeRequest{ApplicationId: applicationId, Endpoint: endpoint}).
JsonResponseBody(&resp).
Do(ctx)
if err != nil {
+5 -10
View File
@@ -2,7 +2,6 @@ package request
import (
"context"
"isp-gate-service/domain"
"net/http"
"strings"
@@ -25,7 +24,7 @@ type Context struct {
request *http.Request
responseWriter http.ResponseWriter
endpointMeta *domain.EndpointMeta
endpoint string
authenticated bool
authData *AuthData
@@ -37,15 +36,11 @@ type Context struct {
queryParams map[string]string
}
func NewContext(
request *http.Request,
response http.ResponseWriter,
endpointMeta *domain.EndpointMeta,
) *Context {
func NewContext(request *http.Request, response http.ResponseWriter, endpoint string) *Context {
return &Context{
request: request,
responseWriter: response,
endpointMeta: endpointMeta,
endpoint: endpoint,
}
}
@@ -61,8 +56,8 @@ func (c *Context) SetResponseWriter(writer http.ResponseWriter) {
c.responseWriter = writer
}
func (c *Context) EndpointMeta() *domain.EndpointMeta {
return c.endpointMeta
func (c *Context) Endpoint() string {
return c.endpoint
}
func (c *Context) Authenticate(authData AuthData) {
+50 -82
View File
@@ -2,117 +2,85 @@ package routes
import (
"context"
"isp-gate-service/domain"
"fmt"
"isp-gate-service/middleware"
"net/http"
"strings"
"github.com/julienschmidt/httprouter"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/log"
)
type Routes struct {
logger log.Logger
allHttpMethods []string
router *httprouter.Router
allEndpoints map[string]bool
innerEndpoints map[string]bool
requiredPermissions map[string]string
}
func NewRoutes(logger log.Logger) *Routes {
func NewRoutes() *Routes {
return &Routes{
logger: logger,
allHttpMethods: []string{
http.MethodGet,
http.MethodHead,
http.MethodPost,
http.MethodPut,
http.MethodPatch,
http.MethodDelete,
http.MethodConnect,
http.MethodOptions,
http.MethodTrace,
},
router: httprouter.New(),
allEndpoints: make(map[string]bool),
innerEndpoints: make(map[string]bool),
requiredPermissions: make(map[string]string),
}
}
func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig) error {
router := httprouter.New()
newAllEndpoints := make(map[string]bool)
newInnerMethods := make(map[string]bool)
newRequiredPermissions := make(map[string]string)
for _, backend := range routes {
for _, descriptor := range backend.Endpoints {
path := normalizeDescriptorPath(descriptor.Path)
if descriptor.HttpMethod != "" {
s.registerEndpoint(router, descriptor.HttpMethod, path, descriptor)
} else {
for _, httpMethod := range s.allHttpMethods {
s.registerEndpoint(router, httpMethod, path, descriptor)
}
for _, v := range backend.Endpoints {
newAllEndpoints[v.Path] = true
if v.Inner {
newInnerMethods[v.Path] = true
}
perm, ok := cluster.GetRequiredAdminPermission(v)
if ok {
newRequiredPermissions[v.Path] = perm
}
}
}
s.router = router
s.allEndpoints = newAllEndpoints
s.innerEndpoints = newInnerMethods
s.requiredPermissions = newRequiredPermissions
return nil
}
func (s *Routes) ResolveEndpoint(method string, path string, cfg middleware.EntryPointConfig) (*domain.EndpointMeta, error) {
lookupPath, metaEndpoint := s.GetPaths(path, cfg)
handler, params, _ := s.router.Lookup(method, lookupPath)
if handler == nil {
if cfg.ErrorOnUnknownEndpoint {
return nil, errors.Errorf("unknown endpoint '%s'", lookupPath)
}
return &domain.EndpointMeta{
Endpoint: metaEndpoint,
}, nil
func (s *Routes) ResolveEndpoint(path string, cfg middleware.EntryPointConfig) string {
if cfg.WithPrefix {
return path
}
req, _ := http.NewRequestWithContext(context.Background(), method, lookupPath, nil)
handler(nil, req, params)
prefix := fmt.Sprintf("%s/", cfg.PathPrefix)
noPrefixPath := strings.TrimPrefix(path, prefix)
ok := s.allEndpoints[noPrefixPath]
if ok {
return noPrefixPath
}
meta := domain.EndpointMetaFromContext(req.Context())
meta.Endpoint = metaEndpoint
return &meta, nil
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) GetPaths(path string, cfg middleware.EntryPointConfig) (string, string) {
lookupPath := path
if !cfg.WithPrefix {
lookupPath = strings.TrimPrefix(lookupPath, cfg.PathPrefix)
}
metaEndpoint := lookupPath
if !cfg.WithLendingSlash {
metaEndpoint = strings.TrimLeft(metaEndpoint, "/")
}
return lookupPath, metaEndpoint
func (s *Routes) IsInnerEndpoint(endpoint string) bool {
return s.innerEndpoints[endpoint]
}
func (s *Routes) registerEndpoint(
router *httprouter.Router,
httpMethod string,
path string,
descriptor cluster.EndpointDescriptor,
) {
defer func() {
_ = recover()
}()
func (s *Routes) RequiredAdminPermission(endpoint string) (string, bool) {
perm, ok := s.requiredPermissions[endpoint]
return perm, ok
}
requiredAdminPerm, _ := cluster.GetRequiredAdminPermission(descriptor)
meta := domain.EndpointMeta{
Inner: descriptor.Inner,
RequiredAdminPermission: requiredAdminPerm,
PathSchema: descriptor.Path,
func invertLeadingSlash(path string) string {
path, withoutSlash := strings.CutPrefix(path, "/")
if withoutSlash {
return path
}
handler := func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ctx := meta.ToContext(r.Context())
// хак для передачи метадаты обратно в код
*r = *r.WithContext(ctx)
}
router.Handle(httpMethod, path, handler)
return "/" + path
}
-16
View File
@@ -1,16 +0,0 @@
package routes
import "strings"
// nolint:mnd
func normalizeDescriptorPath(path string) string {
pathParts := strings.Split(path, " ")
// хак для endpoint'ов с GET /path
if len(pathParts) == 2 {
path = pathParts[1]
}
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
return path
}
+6 -13
View File
@@ -2,8 +2,6 @@ package service
import (
"context"
"fmt"
"isp-gate-service/domain"
"github.com/pkg/errors"
)
@@ -14,7 +12,7 @@ type AuthorizationCache interface {
}
type AuthorizationRepo interface {
Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error)
Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error)
}
type Authorization struct {
@@ -29,26 +27,21 @@ func NewAuthorization(cache AuthorizationCache, repo AuthorizationRepo) Authoriz
}
}
func (s Authorization) Authorize(ctx context.Context, applicationId int, httpMethod string, endpoint string) (bool, error) {
cacheKey := fmt.Sprintf("%s %s", httpMethod, endpoint)
ok, err := s.cache.Get(ctx, applicationId, cacheKey)
func (s Authorization) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) {
ok, err := s.cache.Get(ctx, applicationId, endpoint)
if err != nil {
return false, errors.WithMessage(err, "authz cache get")
}
if ok {
return true, nil
return ok, nil
}
ok, err = s.repo.Authorize(ctx, domain.AuthorizeRequest{
ApplicationId: applicationId,
HttpMethod: httpMethod,
Endpoint: endpoint,
})
ok, err = s.repo.Authorize(ctx, applicationId, endpoint)
if err != nil {
return false, errors.WithMessagef(err, "authz repo authorize")
}
if ok {
err = s.cache.SetAuthorized(ctx, applicationId, cacheKey)
err = s.cache.SetAuthorized(ctx, applicationId, endpoint)
if err != nil {
return false, errors.WithMessagef(err, "authz cache set")
}
+4 -8
View File
@@ -3,7 +3,6 @@ package tests
import (
"context"
"encoding/base64"
"net/http"
"net/http/httptest"
"net/url"
@@ -78,7 +77,7 @@ func (s *HappyPathTestSuite) TestGrpcProxy() {
logger, err := log.New(log.WithLevel(log.DebugLevel))
require.NoError(err)
routes := routes.NewRoutes(logger)
routes := routes.NewRoutes()
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
Endpoints: []cluster.EndpointDescriptor{{
Path: "endpoint",
@@ -128,7 +127,7 @@ func (s *HappyPathTestSuite) TestHttpProxy() {
rr := lb.NewRoundRobin([]string{targetUrl.Host})
targetClients := map[string]*lb.RoundRobin{"target": rr}
routes := routes.NewRoutes(test.Logger())
routes := routes.NewRoutes()
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
Endpoints: []cluster.EndpointDescriptor{{
Path: "/endpoint",
@@ -184,7 +183,7 @@ func (s *HappyPathTestSuite) TestWsProxy() { // nolint: funlen
rr := lb.NewRoundRobin([]string{targetUrl.Host})
targetClients := map[string]*lb.RoundRobin{"target": rr}
routes := routes.NewRoutes(test.Logger())
routes := routes.NewRoutes()
err = routes.ReceiveRoutes(s.T().Context(), cluster.RoutingConfig{{
Endpoints: []cluster.EndpointDescriptor{{
Path: "/service",
@@ -251,7 +250,7 @@ func (s *HappyPathTestSuite) TestAdminAuthorization() {
targetClients := map[string]*client.Client{"target": targetCli}
logger, err := log.New(log.WithLevel(log.DebugLevel))
require.NoError(err)
routes := routes.NewRoutes(logger)
routes := routes.NewRoutes()
locator := assembly.NewLocator(logger, targetClients, nil, routes, systemCli, adminCli, nil)
locations := []conf.Location{{
@@ -325,7 +324,6 @@ func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, *
DomainId: 2,
ServiceId: 3,
ApplicationId: 4,
AppName: "test",
},
}
}).Mock("system/secure/authorize", func() domain.AuthorizeResponse {
@@ -368,8 +366,6 @@ func assertHeaders(require *require.Assertions, requestId string, ctx context.Co
require.EqualValues(2, domainId)
require.EqualValues(3, serviceId)
require.EqualValues(4, applicationId)
expectedAppName := base64.StdEncoding.EncodeToString([]byte("test"))
require.EqualValues(expectedAppName, headers.Get("x-application-name"))
adminId, err := strconv.Atoi(headers.Get("x-admin-id"))
require.NoError(err)
+3 -3
View File
@@ -84,7 +84,7 @@ func main() {
})
targetClients := map[string]*client.Client{"target": targetCli}
logger, _ = log.New(log.WithLevel(log.DebugLevel))
locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(logger), systemCli, adminCli, nil)
locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli, adminCli, nil)
locations := []conf.Location{{
SkipAuth: false,
PathPrefix: "/api",
@@ -126,11 +126,11 @@ func NewMock(logger log.Logger) (*MockServer, *client.Client, *client.Client) {
return &MockServer{
srv: srv,
logger: logger,
mockEndpoints: make(map[string]any),
mockEndpoints: make(map[string]interface{}),
}, syscli, admincli
}
func (m *MockServer) Mock(endpoint string, handler any) *MockServer {
func (m *MockServer) Mock(endpoint string, handler interface{}) *MockServer {
m.mockEndpoints[endpoint] = handler
wrapper := endpoint2.DefaultWrapper(m.logger)
muxer := grpc.NewMux()