Compare commits

..
Author SHA1 Message Date
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
106 changed files with 4146 additions and 3395 deletions

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
name: Create and publish a Docker image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
APP_NAME: ${{ github.event.repository.name }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version from tag
id: version_reader
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: |
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
build-args: |
app_name=${{ env.APP_NAME }}
version=${{ steps.version_reader.outputs.version }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
+3 -1
View File
@@ -71,4 +71,6 @@ fabric.properties
/vendor/
google/
package.json
yarn.lock
yarn.lock
conf/config_dev.yml
+3
View File
@@ -0,0 +1,3 @@
include:
- project: '$CI_PROJECT_PATH'
file: '/ci-isp-go-service.yml'
+78 -36
View File
@@ -1,38 +1,80 @@
version: "2"
run:
allow-parallel-runners: true
linters:
enable-all: true
default: all
disable:
- goimports
- depguard # не используется
- gochecknoinits
- gochecknoglobals
- wsl
- gocognit
- godox # находит тудушки, не нужно
- golint # подумать, может вернуть
- stylecheck # подумать, может вернуть
- goerr113
linters-settings:
maligned:
suggest-new: true
lll:
line-length: 140
tab-width: 1
funlen:
lines: 80
statements: 40
prealloc:
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
# True by default.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: true # Report preallocation suggestions on for loops, false by default
gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- diagnostic
- performance
settings:
hugeParam:
sizeThreshold: 90
- contextcheck # не имеет смысла
- depguard # не всегда имеет смысл
- dupword # не имеет смысла
- exhaustruct # не имеет смысла
- godot # не актуально для swagger
- godox # не позволяет оставлять todo
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
- nlreturn # не всегда имеет смысл
- nolintlint # Goland все равно форматирует с отступом
- perfsprint # мнимая производительность в угоду читаемости
- tagalign # не всегда имеет смысл
- testpackage
- varnamelen # очень индивидуально (db)
- wsl # расставление пробелов очень индивидуально
- wsl_v5 # расставление пробелов очень индивидуально
settings:
cyclop:
max-complexity: 15 # по умолчанию 10 мало
funlen:
lines: 80
lll:
line-length: 150
revive:
rules:
- name: var-naming # отключаем Id -> ID
disabled: true
staticcheck:
checks: # отключаем Id -> ID
- -ST1000
- -ST1016
- -ST1020
- -ST1021
- -ST1022
testifylint:
disable:
- compares
- equal-values
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- wrapcheck
path: controller # достаточное кол-во контекста на уровне контроллеров
- linters:
- wrapcheck
path: transaction # транзакции прозрачны
- linters:
- wrapcheck
path: middleware #отсутствует необходимость оборачивать ошибки
- linters:
- gochecknoglobals
- mnd
path: proxy
- linters:
- wrapcheck
path: httperrors #отсутствует необходимость оборачивать ошибки
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
+1 -1
View File
@@ -1 +1 @@
2.7.2
5.5.1
+94
View File
@@ -1,3 +1,97 @@
### v5.5.1
* повышен приоритет `x-application-token` над basic-auth, при поиске в запросе токена приложения
### v5.5.0
* Добавлена поддержка basic-auth, где `username` - название приложения, `password` - токен приложения
### v5.4.1
* Оптимизация очистки тела запроса от экранирования unicode символов для корректного логирования
### v5.4.0
* Добавлена настройка `forwardReqIdClientSettings` для разрешения прокидывания `requestId` определённым приложениям по их идентификаторам (`requestId` клиента прокидывается если в `forwardReqIdClientSettings` для приложения включено прокидывание или включен глобальный флаг `enableClientRequestIdForwarding`)
* Обновлена версия go до 1.25
### v5.3.0
* обновлены зависимости
### v5.2.10
* добавлен контекст ошибки для grpc
### v5.2.9
* взаимодействие напрямую с `redis` заменено на взаимодействие с `isp-lock-service`
### v5.2.8
* добавлена обработка эндпоинта в двух форматах: с `/` в начале и без
* обновлены зависимости
### v5.2.7
* добавлен `Dockerfile` и скрипт для сборки и публикации образа в `GitHub Contaier Registry`
* обновлены зависимости
### v5.2.6
* исправлен баг с отсутствием проверки разрешенных действий
### v5.2.5
* добавлено новое поле `enableForceUnescapingUnicode` в конфигурации для очистки тела запроса от экранирования unicode символов при логирование
* реализована поддержка очистки тела запроса от экранирования unicode символов для корректного логирования
* обновлены зависимости
### v5.2.4
* обновлены зависимости
### v5.2.3
* добавлен заголовок `X-Request-Id` в ответ при проксировании grpc
* обновлены зависимости
* обновлена версия go до 1.24
### v5.2.1
* добавлен параметр для настройки проброса `requestId` из заголовка запроса
* добавлено логирование содержимого заголовка `requestId` из заголовка запроса (поле `clientRequestId`)
* обновлены зависимости
* обновлена версия go до 1.23
### v5.2.0
* изменён формат логов с `snake_case` на `camelCase`
### v5.1.1
* добавлен параметр `withPrefix` в локальном конфиге для `location`, чтобы не обрезать путь при проксировании запроса
### v5.1.0
* обновлены зависимости (увеличены лимиты по семплированию логов, добавлена возможность конфигурировать семплирование)
### v5.0.0
* добавлена авторизация ендпоинтов администратора
### v4.3.0
* обновлены зависимости
### v4.2.1
* исправлено поведение `skipBodyLoggingEndpointPrefixes`
### v4.2.0
* новый параметр в remote_config: `skipBodyLoggingEndpointPrefixes`. Массив re. Если они есть в пути, то запрос не будет логироваться
### v4.1.2
* исправлена опция логирования тела запроса (при настройке ws могла отключаться)
### v4.1.1
* исправлена маршрутизация запросов
### v4.1.0
* обновлены зависимости
* добавлена поддержка проксирования WebSocket `ws`
### v4.0.0
* реализована аутентификация токена администратора через msp-admin-service
### v3.0.3
* исправлено тело ответа grpc ошибок валидации
* обновлены зависимости
### v3.0.2
* добавлен charset=utf-8 в заголовок ответа для grpc
### v3.0.1
* исправлено проксирование http с GET параметрами
* исправлено логирование пути при проксировании HTTP
### v3.0.0
* реализация новой схемы аутентификации/авторизации
### v2.8.3
* use isp-kit logger instead local logger
* use log string instead log any (common log type)
* add replace grpc (isp-lib and isp-kit conflict)
### v2.8.2
* add file rotation
### v2.8.1
* add xml format support for new logger
### v2.8.0
* add new logger
* remove journal
* add identities to requests log
### v2.7.6
* updated dependencies
* migrated to common local config
### v2.7.5
* updated dependencies
### v2.7.4
* updated isp-lib
* updated isp-lib-test
### v2.7.3
* updated isp-lib
* updated isp-event-lib
## 2.7.2
* fix accounting
## 2.7.1
View File
Whitespace-only changes.
-41
View File
@@ -1,41 +0,0 @@
package accounting
import (
"isp-gate-service/accounting/state"
"isp-gate-service/service/matcher"
"sync"
)
type accountant struct {
mx sync.Mutex
matcher matcher.Matcher
limitStates map[string]state.LimitState
version int64
}
func (app *accountant) Accept(method string) bool {
patternArray := app.matcher.Match(method)
stateStorage := make([]state.LimitState, len(patternArray))
for i, pattern := range patternArray {
stateStorage[i] = app.limitStates[pattern]
}
app.mx.Lock()
resp := state.Update(stateStorage)
if resp {
app.version++
}
app.mx.Unlock()
return resp
}
func (app *accountant) Snapshot() (map[string]state.Snapshot, int64) {
app.mx.Lock()
version := app.version
snapshotLimitState := make(map[string]state.Snapshot, len(app.limitStates))
for method, limitState := range app.limitStates {
snapshotLimitState[method] = limitState.Export()
}
app.mx.Unlock()
return snapshotLimitState, version
}
-147
View File
@@ -1,147 +0,0 @@
package accounting
import (
"github.com/integration-system/isp-lib/v2/config"
"github.com/integration-system/isp-lib/v2/structure"
log "github.com/integration-system/isp-log"
"isp-gate-service/accounting/state"
"isp-gate-service/conf"
"isp-gate-service/entity"
"isp-gate-service/log_code"
"isp-gate-service/model"
"isp-gate-service/service/matcher"
"sync"
"time"
)
var worker = &accountingWorker{
accountingStorage: make(map[int32]Accounting),
requestsStoring: make(map[int32]bool),
}
type (
Accounting interface {
Accept(string) bool
Snapshot() (map[string]state.Snapshot, int64)
}
accountingWorker struct {
accountingStorage map[int32]Accounting
requestsStoring map[int32]bool
}
)
func NewConnectionConsumer(list []structure.AddressConfiguration) bool {
accountingSetting := config.GetRemote().(*conf.RemoteConfig).AccountingSetting
worker.init(accountingSetting)
return true
}
func ReceiveConfiguration(accountingSetting conf.Accounting) {
worker.init(accountingSetting)
}
func AcceptRequest(appId int32, path string) bool {
if accouter, ok := worker.accountingStorage[appId]; ok {
ok := accouter.Accept(path)
if ok && worker.requestsStoring[appId] {
storage.TakeRequest(appId, path, time.Now())
}
return ok
} else {
if worker.requestsStoring[appId] {
storage.TakeRequest(appId, path, time.Now())
}
return true
}
}
func Close() {
if snapshot != nil {
snapshot.Stop()
}
if storage != nil {
storage.Stop()
}
}
func (w *accountingWorker) init(accountingSetting conf.Accounting) {
Close()
newAccountingStorage := make(map[int32]Accounting)
newRequestsStoringStorage := make(map[int32]bool)
if accountingSetting.Enable {
for _, s := range accountingSetting.Setting {
limitStates, patternArray := state.InitLimitState(s.Limits)
accounting := w.recoveryAccounting(s.ApplicationId, limitStates, patternArray)
newAccountingStorage[s.ApplicationId] = accounting
newRequestsStoringStorage[s.ApplicationId] = s.EnableStoring
}
w.requestsStoring = newRequestsStoringStorage
w.accountingStorage = newAccountingStorage
InitStoringTask(accountingSetting.Storing)
InitSnapshotTask(accountingSetting.SnapshotTimeout)
} else {
w.requestsStoring = newRequestsStoringStorage
w.accountingStorage = newAccountingStorage
}
}
func (w *accountingWorker) takeSnapshot() []entity.Snapshot {
lastStorage := w.accountingStorage
response := make([]entity.Snapshot, 0, len(lastStorage))
for appId, account := range lastStorage {
limitState, version := account.Snapshot()
response = append(response, entity.Snapshot{
AppId: appId,
LimitState: limitState,
Version: version,
})
}
return response
}
func (w *accountingWorker) recoveryAccounting(appId int32, limitStates map[string]state.LimitState, patternArray []string) *accountant {
var (
version = int64(0)
importNotComplete = true
)
dbSnapshot, err := model.SnapshotRep.GetByApplication(appId)
if err != nil {
log.Warn(log_code.ErrorSnapshotAccounting, err)
}
if cache, ok := w.accountingStorage[appId]; ok {
cashLimitState, cashVersion := cache.Snapshot()
if dbSnapshot == nil || dbSnapshot.Version < cashVersion {
version = cashVersion
w.importLimitState(limitStates, cashLimitState)
importNotComplete = false
}
}
if dbSnapshot != nil && importNotComplete {
version = dbSnapshot.Version
w.importLimitState(limitStates, dbSnapshot.LimitState)
}
return &accountant{
mx: sync.Mutex{},
matcher: matcher.NewCacheableMatcher(patternArray),
limitStates: limitStates,
version: version,
}
}
func (w *accountingWorker) importLimitState(limitStates map[string]state.LimitState, snapshot map[string]state.Snapshot) {
for method, limitState := range limitStates {
if oldState, ok := snapshot[method]; ok {
limitState.Import(oldState)
}
}
}
-205
View File
@@ -1,205 +0,0 @@
//nolint
package accounting
import (
"github.com/stretchr/testify/assert"
"isp-gate-service/conf"
"isp-gate-service/entity"
"isp-gate-service/model"
"sync"
"testing"
"time"
)
var (
accountingSetting = conf.Accounting{
Enable: true,
SnapshotTimeout: "290ms",
Setting: []conf.AccountingSetting{
{ApplicationId: 1, Limits: []conf.LimitSetting{
{Pattern: "mdm-master/group/method", MaxCount: 1, Timeout: "90ms"},
{Pattern: "mdm-master/group3/method", MaxCount: 10, Timeout: "10s"},
{Pattern: "mdm-master/group3/*", MaxCount: 5, Timeout: "10s"},
{Pattern: "mdm-master/group4/method", MaxCount: 2, Timeout: "0s"},
{Pattern: "mdm-master/group5/method", MaxCount: 3, Timeout: "10s"},
{Pattern: "mdm-master/group6/method", MaxCount: 5, Timeout: "10s"},
}},
{ApplicationId: 2, Limits: []conf.LimitSetting{
{Pattern: "mdm-master/group/method", MaxCount: 0, Timeout: "10s"},
}},
},
Storing: conf.StoringSetting{
Size: 100,
Timeout: "1h",
},
}
reqExample = []struct {
appId int32
path []string
}{
0: {appId: 1, path: []string{
"mdm-master/group/method", "mdm-master/group/method", "mdm-master/group/method",
"mdm-master/group/method", "mdm-master/group/method", "mdm-master/group/method",
}},
1: {appId: 2, path: []string{
"mdm-master/group3/method", "mdm-master/group/method", "mdm-master/group3/method",
"mdm-master/group/method", "mdm-master/group3/method", "mdm-master/group/method",
}},
2: {appId: 1, path: []string{
"mdm-master/group3/method", "mdm-master/group3/method", "mdm-master/group3/method",
"mdm-master/group3/method", "mdm-master/group3/method", "mdm-master/group3/method",
}},
3: {appId: 1, path: []string{
"mdm-master/group4/method", "mdm-master/group4/method", "mdm-master/group4/method",
"mdm-master/group4/method", "mdm-master/group4/method", "mdm-master/group4/method",
}},
4: {appId: 1, path: []string{
"mdm-master/group5/method", "mdm-master/group5/method", "mdm-master/group5/method",
}},
}
)
func TestAccounting(t *testing.T) {
a := assert.New(t)
snapshotRep := newSnapshotRepository(false)
model.SnapshotRep = snapshotRep
worker = &accountingWorker{
accountingStorage: make(map[int32]Accounting),
requestsStoring: make(map[int32]bool),
}
worker.init(accountingSetting)
req := reqExample[4]
for _, path := range req.path {
a.True(AcceptRequest(req.appId, path))
}
expected := true
req = reqExample[0]
for _, path := range req.path {
a.Equal(expected, AcceptRequest(req.appId, path))
expected = !expected
time.Sleep(50 * time.Millisecond)
}
//expected == true
req = reqExample[1]
for _, path := range req.path {
a.Equal(expected, AcceptRequest(req.appId, path))
expected = !expected
}
req = reqExample[2]
expectedArray := []bool{true, true, true, true, true, false}
for key, path := range req.path {
a.Equal(expectedArray[key], AcceptRequest(req.appId, path))
}
//expected == true
req = reqExample[3]
for _, path := range req.path {
a.Equal(expected, AcceptRequest(req.appId, path))
}
worker.init(accountingSetting)
req = reqExample[4]
for _, path := range req.path {
a.False(AcceptRequest(req.appId, path))
}
}
func TestWorker_recoveryAccounting(t *testing.T) {
a := assert.New(t)
snapshotRep := newSnapshotRepository(true)
model.SnapshotRep = snapshotRep
worker = &accountingWorker{
accountingStorage: make(map[int32]Accounting),
requestsStoring: make(map[int32]bool),
}
secondWorker := &accountingWorker{
accountingStorage: make(map[int32]Accounting),
requestsStoring: make(map[int32]bool),
}
worker.init(accountingSetting)
secondWorker.init(accountingSetting)
appId := int32(1)
request := "1_3_5"
for range request {
a.True(AcceptRequest(appId, "mdm-master/group6/method"))
}
a.False(AcceptRequest(appId, "mdm-master/group6/method"))
time.Sleep(time.Millisecond * 300)
a.True(snapshotRep.Wait())
snapshot, err := model.SnapshotRep.GetByApplication(appId)
a.NoError(err)
a.NotNil(snapshot)
a.Equal(len(request), int(snapshot.Version))
Close()
worker = secondWorker
worker.init(accountingSetting)
a.False(AcceptRequest(appId, "mdm-master/group6/method"))
}
type snapshotRepository struct {
enableWaitGroup bool
wg sync.WaitGroup
mx sync.Mutex
cache map[int32]entity.Snapshot
}
func newSnapshotRepository(enableWaitGroup bool) *snapshotRepository {
return &snapshotRepository{
enableWaitGroup: enableWaitGroup,
wg: sync.WaitGroup{},
cache: make(map[int32]entity.Snapshot),
}
}
func (r *snapshotRepository) Wait() bool {
done := make(chan struct{})
go func() {
r.wg.Wait()
close(done)
}()
select {
case <-done:
return true
case <-time.After(time.Second):
return false
}
}
func (r *snapshotRepository) GetByApplication(appId int32) (*entity.Snapshot, error) {
r.mx.Lock()
defer r.mx.Unlock()
if snapshot, ok := r.cache[appId]; ok {
return &snapshot, nil
} else {
return nil, nil
}
}
func (r *snapshotRepository) Update(list []entity.Snapshot) error {
r.mx.Lock()
defer r.mx.Unlock()
if r.enableWaitGroup {
r.wg.Add(1)
defer r.wg.Done()
}
for _, s := range list {
r.cache[s.AppId] = s
}
return nil
}
-84
View File
@@ -1,84 +0,0 @@
package accounting
import (
log "github.com/integration-system/isp-log"
"github.com/integration-system/isp-log/stdcodes"
"isp-gate-service/entity"
"isp-gate-service/log_code"
"isp-gate-service/model"
"sync"
"time"
)
var snapshot *snapshotTask
type snapshotTask struct {
mx sync.Mutex
wg sync.WaitGroup
process bool
timeout <-chan time.Time
close chan bool
}
func InitSnapshotTask(snapshotTimeout string) {
timeout, err := time.ParseDuration(snapshotTimeout)
if err != nil {
log.Fatal(stdcodes.ModuleInvalidRemoteConfig, err)
}
snapshot = newSnapshotTask(timeout)
}
func (t *snapshotTask) Stop() {
t.mx.Lock()
if t.process {
snapshotList := worker.takeSnapshot()
if len(snapshotList) != 0 {
defer func() {
t.wg.Add(1)
t.unload(snapshotList)
t.wg.Wait()
}()
}
t.process = false
t.close <- true
}
t.mx.Unlock()
}
func (t *snapshotTask) run(timeout time.Duration) {
defer t.wg.Done()
t.timeout = time.After(timeout)
for {
select {
case <-t.close:
return
case <-t.timeout:
list := worker.takeSnapshot()
if len(list) > 0 {
t.wg.Add(1)
go t.unload(list)
}
t.timeout = time.After(timeout)
}
}
}
func (t *snapshotTask) unload(list []entity.Snapshot) {
if err := model.SnapshotRep.Update(list); err != nil {
log.Error(log_code.ErrorSnapshotAccounting, err)
}
t.wg.Done()
}
func newSnapshotTask(timeout time.Duration) *snapshotTask {
task := &snapshotTask{
process: true,
timeout: make(chan time.Time),
close: make(chan bool),
}
task.wg.Add(1)
go task.run(timeout)
return task
}
-69
View File
@@ -1,69 +0,0 @@
package state
import (
log "github.com/integration-system/isp-log"
"github.com/integration-system/isp-log/stdcodes"
"isp-gate-service/conf"
"time"
)
type (
LimitState interface {
Import(Snapshot)
Export() Snapshot
check() (bool, int, time.Time)
update(int, time.Time)
}
Snapshot struct {
Timeout time.Duration
Datetime []time.Time
Pattern string
Pointer int
}
updateRequest struct {
pointer int
requestTime time.Time
}
)
func InitLimitState(limits []conf.LimitSetting) (map[string]LimitState, []string) {
limitStates := make(map[string]LimitState)
patternArray := make([]string, len(limits))
for i, limit := range limits {
timeout, err := time.ParseDuration(limit.Timeout)
if err != nil {
log.Fatal(stdcodes.ModuleInvalidRemoteConfig, err)
}
if timeout == 0 && limit.MaxCount != 0 {
limit.MaxCount = 1
}
patternArray[i] = limit.Pattern
limitStates[limit.Pattern] = &limiter{
timeout: timeout,
datetime: make([]time.Time, limit.MaxCount),
pattern: limit.Pattern,
pointer: -1,
}
}
return limitStates, patternArray
}
func Update(states []LimitState) bool {
update := make([]updateRequest, len(states))
for i, st := range states {
if ok, point, requestTime := st.check(); ok {
update[i] = updateRequest{pointer: point, requestTime: requestTime}
} else {
return false
}
}
for i, st := range states {
u := update[i]
st.update(u.pointer, u.requestTime)
}
return true
}
-89
View File
@@ -1,89 +0,0 @@
package state
import (
"time"
)
type limiter struct {
timeout time.Duration
datetime []time.Time
pattern string
pointer int
}
func (lim *limiter) Export() Snapshot {
ls := *lim
return Snapshot{
Timeout: ls.timeout,
Datetime: ls.datetime,
Pattern: ls.pattern,
Pointer: ls.pointer,
}
}
func (lim *limiter) Import(oldState Snapshot) {
oldLim := limiter{
timeout: oldState.Timeout,
datetime: oldState.Datetime,
pattern: oldState.Pattern,
pointer: oldState.Pointer,
}
lenOldDatetime := len(oldLim.datetime)
lenNewDatetime := len(lim.datetime)
switch {
case lenOldDatetime == lenNewDatetime:
lim.datetime = oldLim.datetime
lim.pointer = oldLim.pointer
case lenOldDatetime < lenNewDatetime:
oldPointer := oldLim.pointer
for i := range lim.datetime {
oldLim.pointer++
if oldLim.pointer >= len(oldLim.datetime) {
oldLim.pointer = 0
}
lim.datetime[i] = oldLim.datetime[oldLim.pointer]
if oldPointer == oldLim.pointer {
lim.pointer = i
break
}
}
case lenOldDatetime > lenNewDatetime:
for i := range lim.datetime {
oldLim.pointer++
if oldLim.pointer >= len(oldLim.datetime) {
oldLim.pointer = 0
}
lim.datetime[i] = oldLim.datetime[oldLim.pointer]
}
}
}
func (lim *limiter) check() (bool, int, time.Time) {
if len(lim.datetime) == 0 {
return false, 0, time.Time{}
}
if lim.timeout == 0 {
return true, 0, time.Now()
}
pointer := lim.pointer + 1
if pointer >= len(lim.datetime) {
pointer = 0
}
date := lim.datetime[pointer]
requestTime := time.Now()
account := requestTime.Sub(date) > lim.timeout
return account, pointer, requestTime
}
func (lim *limiter) update(point int, requestTime time.Time) {
lim.pointer = point
lim.datetime[point] = requestTime
}
-52
View File
@@ -1,52 +0,0 @@
//nolint
package state
import (
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestLimiter(t *testing.T) {
a := assert.New(t)
newLimiter := func(count int) *limiter {
return &limiter{timeout: 5 * time.Second, pattern: "example", pointer: -1, datetime: make([]time.Time, count)}
}
store12 := newLimiter(12)
store10 := newLimiter(10)
store7 := newLimiter(7)
store5 := newLimiter(5)
for i := 0; i < 7; i++ {
expectedTrue, pointer, reqTime := store10.check()
a.True(expectedTrue)
store10.update(pointer, reqTime)
expectedTrue, pointer, reqTime = store7.check()
a.True(expectedTrue)
store7.update(pointer, reqTime)
}
expectedFalse, _, _ := store7.check()
a.False(expectedFalse)
store12.Import(store7.Export())
store5.Import(store10.Export())
a.Equal(store5.datetime[0], store10.datetime[store10.pointer+1])
a.Equal(store12.datetime[0], store7.datetime[0])
a.Equal(store12.datetime[store7.pointer], store7.datetime[store7.pointer])
a.Equal(store12.datetime[store7.pointer+1], time.Time{})
expectedTrue, _, _ := store12.check()
a.True(expectedTrue)
for i := 0; i < 3; i++ {
expectedTrue, pointer, reqTime := store5.check()
a.True(expectedTrue)
store5.update(pointer, reqTime)
}
expectedFalse, _, _ = store5.check()
a.False(expectedFalse)
}
-131
View File
@@ -1,131 +0,0 @@
package accounting
import (
log "github.com/integration-system/isp-log"
"github.com/integration-system/isp-log/stdcodes"
"isp-gate-service/conf"
"isp-gate-service/entity"
"isp-gate-service/log_code"
"isp-gate-service/model"
"sync"
"time"
)
var storage *storingTask
type storingTask struct {
buffer []entity.Request
counter int
chanTimeout <-chan time.Time
chanCounter chan []entity.Request
chanClose chan bool
mx sync.Mutex
wg sync.WaitGroup
process bool
}
func InitStoringTask(setting conf.StoringSetting) {
timeout, err := time.ParseDuration(setting.Timeout)
if err != nil {
log.Fatal(stdcodes.ModuleInvalidRemoteConfig, err)
}
storage = newStoringTask(timeout, setting.Size)
}
func (t *storingTask) TakeRequest(appId int32, method string, date time.Time) {
t.mx.Lock()
if !t.process {
t.mx.Unlock()
return
}
t.buffer[t.counter] = entity.Request{
AppId: appId,
Method: method,
CreatedAt: date,
}
t.counter++
if t.counter == len(t.buffer) {
t.chanCounter <- t.buffer
t.clearBuffer()
}
t.mx.Unlock()
}
func (t *storingTask) Stop() {
t.mx.Lock()
if t.process {
if t.counter != 0 {
buffer := t.clearBuffer()
defer func() {
t.wg.Add(1)
t.unload(buffer)
t.wg.Wait()
}()
}
t.chanClose <- true
t.process = false
}
t.mx.Unlock()
}
func (t *storingTask) run(timeout time.Duration) {
defer t.wg.Done()
t.chanTimeout = time.After(timeout)
for {
select {
case <-t.chanClose:
return
case cache := <-t.chanCounter:
t.wg.Add(1)
go t.unload(cache)
t.chanTimeout = time.After(timeout)
case <-t.chanTimeout:
t.mx.Lock()
if t.counter != 0 {
buffer := t.clearBuffer()
t.wg.Add(1)
go t.unload(buffer)
}
t.mx.Unlock()
t.chanTimeout = time.After(timeout)
}
}
}
func (t *storingTask) unload(cache []entity.Request) {
if err := model.RequestsRep.Insert(cache); err != nil {
log.Error(log_code.ErrorUnloadAccounting, err)
}
t.wg.Done()
}
func (t *storingTask) clearBuffer() []entity.Request {
oldBuffer := t.buffer[:t.counter]
oldLen := len(t.buffer)
t.counter = 0
t.buffer = make([]entity.Request, oldLen)
return oldBuffer
}
func newStoringTask(timeout time.Duration, bufSize int) *storingTask {
task := &storingTask{
mx: sync.Mutex{},
counter: 0,
buffer: make([]entity.Request, bufSize),
process: true,
chanTimeout: make(chan time.Time),
chanCounter: make(chan []entity.Request),
chanClose: make(chan bool),
}
task.wg.Add(1)
go task.run(timeout)
return task
}
-112
View File
@@ -1,112 +0,0 @@
//nolint
package accounting
import (
"github.com/stretchr/testify/assert"
"isp-gate-service/conf"
"isp-gate-service/entity"
"isp-gate-service/model"
"sync"
"testing"
"time"
)
var (
timeoutSetting = conf.StoringSetting{
Size: 3,
Timeout: "30ms",
}
bufferSetting = conf.StoringSetting{
Size: 3,
Timeout: "2s",
}
unloadSetting = conf.StoringSetting{
Size: 3,
Timeout: "100ms",
}
)
func initStoring(setting conf.StoringSetting) *requestsRepository {
repository := &requestsRepository{cache: make([]entity.Request, 0), wg: &sync.WaitGroup{}}
model.RequestsRep = repository
InitStoringTask(setting)
return repository
}
func wait(wg *sync.WaitGroup) bool {
done := make(chan struct{})
go func() {
wg.Wait()
close(done)
}()
select {
case <-done:
return true
case <-time.After(time.Second):
return false
}
}
func TestStoringTask_Stop(t *testing.T) {
a := assert.New(t)
rep := initStoring(bufferSetting)
rep.wg.Add(2)
for i, j := range []string{"Stop_1", "Stop_2", "Stop_3", "Stop_4", "Stop_5"} {
storage.TakeRequest(int32(i), j, time.Now())
}
storage.Stop()
a.Len(rep.cache, 5)
}
func TestStoringTask_Buffer(t *testing.T) {
a := assert.New(t)
rep := initStoring(bufferSetting)
rep.wg.Add(1)
for i, j := range []string{"Buffer_1", "Buffer_2", "Buffer_3", "Buffer_4", "Buffer_5"} {
storage.TakeRequest(int32(i), j, time.Now())
}
a.True(wait(rep.wg))
a.Len(rep.cache, 3)
}
func TestStoringTask_Timeout(t *testing.T) {
a := assert.New(t)
rep := initStoring(timeoutSetting)
rep.wg.Add(1)
for i, j := range []string{"Timeout_1", "Timeout_2"} {
storage.TakeRequest(int32(i), j, time.Now())
}
a.True(wait(rep.wg))
a.Len(rep.cache, 2)
}
func TestStoringTask_Unload(t *testing.T) {
a := assert.New(t)
rep := initStoring(unloadSetting)
rep.wg.Add(2)
for i, j := range []string{"Unload_1", "Unload_2", "Unload_3", "Unload_4", "Unload_5"} {
storage.TakeRequest(int32(i), j, time.Now())
}
a.True(wait(rep.wg))
a.Len(rep.cache, 5)
}
type requestsRepository struct {
cache []entity.Request
mx sync.Mutex
wg *sync.WaitGroup
}
func (r *requestsRepository) Insert(model []entity.Request) error {
r.mx.Lock()
r.cache = append(r.cache, model...)
r.mx.Unlock()
r.wg.Done()
return nil
}
+155
View File
@@ -0,0 +1,155 @@
package assembly
import (
"context"
"isp-gate-service/conf"
"isp-gate-service/routes"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/app"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/grpc/client"
"github.com/txix-open/isp-kit/http"
"github.com/txix-open/isp-kit/lb"
"github.com/txix-open/isp-kit/log"
)
type Assembly struct {
boot *bootstrap.Bootstrap
server *http.Server
logger *log.Adapter
routes *routes.Routes
systemCli *client.Client
adminCli *client.Client
lockerCli *client.Client
locations []conf.Location
grpcClientByModuleName map[string]*client.Client
httpHostManagerByModuleName map[string]*lb.RoundRobin
}
func New(boot *bootstrap.Bootstrap) (*Assembly, error) {
server := http.NewServer(boot.App.Logger())
localConfig := conf.Local{}
err := boot.App.Config().Read(&localConfig)
if err != nil {
return nil, errors.WithMessage(err, "read local config")
}
grpcClientByModuleName := make(map[string]*client.Client)
httpHostManagerByModuleName := make(map[string]*lb.RoundRobin)
for _, location := range localConfig.Locations {
switch location.Protocol {
case conf.GrpcProtocol:
cli, err := client.Default()
if err != nil {
return nil, errors.WithMessage(err, "new grpc client")
}
grpcClientByModuleName[location.TargetModule] = cli
case conf.HttpProtocol, conf.WsProtocol:
rb := lb.NewRoundRobin(nil)
httpHostManagerByModuleName[location.TargetModule] = rb
default:
return nil, errors.Errorf("unexpected location protocol: %s", location.Protocol)
}
}
systemCli, err := client.Default()
if err != nil {
return nil, errors.WithMessage(err, "create system cli")
}
adminCli, err := client.Default()
if err != nil {
return nil, errors.WithMessage(err, "create admin cli")
}
lockerCli, err := client.Default()
if err != nil {
return nil, errors.WithMessage(err, "create isp-lock-service client")
}
return &Assembly{
boot: boot,
server: server,
logger: boot.App.Logger(),
routes: routes.NewRoutes(),
locations: localConfig.Locations,
grpcClientByModuleName: grpcClientByModuleName,
httpHostManagerByModuleName: httpHostManagerByModuleName,
systemCli: systemCli,
adminCli: adminCli,
lockerCli: lockerCli,
}, nil
}
func (a *Assembly) ReceiveConfig(ctx context.Context, remoteConfig []byte) error {
var (
newCfg conf.Remote
prevCfg conf.Remote
)
err := a.boot.RemoteConfig.Upgrade(remoteConfig, &newCfg, &prevCfg)
if err != nil {
a.logger.Fatal(ctx, errors.WithMessage(err, "upgrade remote config"))
}
a.logger.SetLevel(newCfg.Logging.LogLevel)
locator := NewLocator(
a.logger,
a.grpcClientByModuleName,
a.httpHostManagerByModuleName,
a.routes,
a.systemCli,
a.adminCli,
a.lockerCli,
)
handler, err := locator.Handler(newCfg, a.locations)
if err != nil {
return errors.WithMessage(err, "locator handler")
}
a.server.Upgrade(handler)
return nil
}
func (a *Assembly) Runners() []app.Runner {
eventHandler := cluster.NewEventHandler().
RoutesReceiver(a.routes).
RemoteConfigReceiver(a)
for moduleName, upgrader := range a.grpcClientByModuleName {
eventHandler.RequireModule(moduleName, upgrader)
}
for moduleName, upgrader := range a.httpHostManagerByModuleName {
eventHandler.RequireModule(moduleName, upgrader)
}
eventHandler.RequireModule("isp-system-service", a.systemCli)
eventHandler.RequireModule("msp-admin-service", a.adminCli)
eventHandler.RequireModule("isp-lock-service", a.lockerCli)
return []app.Runner{
app.RunnerFunc(func(ctx context.Context) error {
return a.server.ListenAndServe(a.boot.BindingAddress)
}),
app.RunnerFunc(func(ctx context.Context) error {
return a.boot.ClusterCli.Run(ctx, eventHandler)
}),
}
}
func (a *Assembly) Closers() []app.Closer {
closers := []app.Closer{
a.boot.ClusterCli,
app.CloserFunc(func() error {
return a.server.Shutdown(context.Background())
}),
}
for _, cliCloser := range a.grpcClientByModuleName {
closers = append(closers, cliCloser)
}
closers = append(closers, a.systemCli, a.adminCli, a.lockerCli)
return closers
}
+140
View File
@@ -0,0 +1,140 @@
package assembly
import (
"net/http"
"time"
"isp-gate-service/conf"
"isp-gate-service/middleware"
"isp-gate-service/proxy"
"isp-gate-service/repository"
"isp-gate-service/routes"
"isp-gate-service/service"
mux2 "github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/client"
"github.com/txix-open/isp-kit/lb"
"github.com/txix-open/isp-kit/log"
)
type Locator struct {
logger log.Logger
grpcClientByModuleName map[string]*client.Client
httpHostManagerByModuleName map[string]*lb.RoundRobin
routes *routes.Routes
systemCli *client.Client
adminCli *client.Client
lockerCli *client.Client
}
func NewLocator(
logger log.Logger,
grpcClientByModuleName map[string]*client.Client,
httpHostManagerByModuleName map[string]*lb.RoundRobin,
routes *routes.Routes,
systemCli *client.Client,
adminCli *client.Client,
lockerCli *client.Client,
) Locator {
return Locator{
logger: logger,
grpcClientByModuleName: grpcClientByModuleName,
httpHostManagerByModuleName: httpHostManagerByModuleName,
routes: routes,
systemCli: systemCli,
adminCli: adminCli,
lockerCli: lockerCli,
}
}
func (l Locator) Handler(config conf.Remote, locations []conf.Location) (http.Handler, error) { // nolint:funlen
systemRepo := repository.NewSystem(l.systemCli)
adminRepo := repository.NewAdmin(l.adminCli)
authenticationCache := repository.NewAuthenticationCache(time.Duration(config.Caching.AuthenticationDataInSec) * time.Second)
authentication := service.NewAuthentication(authenticationCache, systemRepo)
adminService := service.NewAdmin(
repository.NewAuthorizationCache(time.Duration(config.Caching.AuthorizationDataInSec)*time.Second),
adminRepo,
)
authorization := service.NewAuthorization(
repository.NewAuthorizationCache(time.Duration(config.Caching.AuthorizationDataInSec)*time.Second),
systemRepo,
)
lockRepo := repository.NewLocker(l.lockerCli)
dailyLimitService := service.NewDailyLimit(lockRepo, config.DailyLimits)
throttlingService := service.NewThrottling(lockRepo, config.Throttling)
mux := mux2.NewRouter()
for _, location := range locations {
var proxyFunc middleware.Handler
enableBodyLog := config.Logging.BodyLogEnable
switch location.Protocol {
case conf.GrpcProtocol:
cli := l.grpcClientByModuleName[location.TargetModule]
proxyFunc = proxy.NewGrpc(cli, location.SkipAuth, time.Duration(config.Http.ProxyTimeoutInSec)*time.Second)
case conf.HttpProtocol:
hostManager := l.httpHostManagerByModuleName[location.TargetModule]
proxyFunc = proxy.NewHttp(hostManager, location.SkipAuth, time.Duration(config.Http.ProxyTimeoutInSec)*time.Second)
case conf.WsProtocol:
hostManager := l.httpHostManagerByModuleName[location.TargetModule]
proxyFunc = proxy.NewWs(hostManager, location.SkipAuth)
enableBodyLog = false
default:
return nil, errors.Errorf("not supported protocol %s", location.Protocol)
}
forwardReqIdByAppId := make(map[int]bool, len(config.ForwardReqIdClientSettings))
for _, setting := range config.ForwardReqIdClientSettings {
forwardReqIdByAppId[setting.ApplicationId] = setting.ForwardRequestId
}
handler := middleware.Chain(
proxyFunc,
middleware.Logger(
l.logger, config.Logging.RequestLogEnable,
enableBodyLog,
config.Logging.SkipBodyLoggingEndpointPrefixes,
config.Logging.EnableForceUnescapingUnicode,
),
middleware.ErrorHandler(l.logger),
middleware.Authenticate(authentication),
middleware.AdminAuthenticate(adminService),
middleware.Authorize(authorization, l.logger),
middleware.AdminAuthorize(l.routes, adminService),
middleware.Throttling(throttlingService),
middleware.DailyLimit(dailyLimitService),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
)
if location.SkipAuth {
handler = middleware.Chain(
proxyFunc,
middleware.Logger(l.logger, config.Logging.RequestLogEnable,
enableBodyLog,
config.Logging.SkipBodyLoggingEndpointPrefixes,
config.Logging.EnableForceUnescapingUnicode,
),
middleware.ErrorHandler(l.logger),
middleware.RequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
)
}
entrypoint := middleware.Entrypoint(
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd
handler,
middleware.EntryPointConfig{
WithPrefix: location.WithPrefix,
PathPrefix: location.PathPrefix,
},
l.routes,
l.logger,
)
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
}
return mux, nil
}
-208
View File
@@ -1,208 +0,0 @@
package authenticate
import (
"strconv"
"time"
"github.com/integration-system/isp-lib/v2/config"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
"github.com/integration-system/isp-log/stdcodes"
"github.com/pkg/errors"
"github.com/valyala/fasthttp"
"google.golang.org/grpc/codes"
"isp-gate-service/conf"
"isp-gate-service/log_code"
"isp-gate-service/routing"
"isp-gate-service/service/veritification"
)
const (
// TODO move to isp-lib
AdminTokenHeader = "x-auth-admin" //nolint
awaitLengthVerifiableHeaders = 4
)
var notExpectedHeaders = []string{
utils.SystemIdHeader,
utils.DomainIdHeader,
utils.ServiceIdHeader,
utils.ApplicationIdHeader,
utils.UserIdHeader,
utils.DeviceIdHeader,
}
var auth = authenticate{}
type (
authenticate struct {
verify veritification.Verify
}
verifiable struct {
appId int32
ctx *fasthttp.RequestCtx
path string
headers map[string]string
}
)
func ReceiveConfiguration(conf conf.Cache) {
if conf.EnableCache {
if timeout, err := time.ParseDuration(conf.EvictTimeout); err != nil {
log.Fatalf(stdcodes.ModuleInvalidRemoteConfig, "invalid timeout '%s'", timeout)
} else {
auth.verify = veritification.NewCacheablesVerify(timeout)
}
} else {
auth.verify = veritification.NewRuntimeVerify()
}
}
func Do(ctx *fasthttp.RequestCtx, path string) (int32, error) {
for _, notExpectedHeader := range notExpectedHeaders {
ctx.Request.Header.Del(notExpectedHeader)
}
verifiable := newVerifiable(ctx, path)
err := verifiable.verifyAppToken()
if err != nil {
return 0, err
}
err = verifiable.verifyUserToken()
if err != nil {
return 0, err
}
verifiable.setHeaders()
err = verifiable.checkInnerMethods()
if err != nil {
return 0, err
}
err = verifiable.checkUserMethods()
if err != nil {
return 0, err
}
//TODO backward capability for isp-config-service 1.x.x
uuid := config.Get().(*conf.Configuration).InstanceUuid
ctx.Request.Header.Set(utils.InstanceIdHeader, uuid)
return verifiable.appId, nil
}
func newVerifiable(ctx *fasthttp.RequestCtx, path string) *verifiable {
return &verifiable{
ctx: ctx,
path: path,
appId: -1,
headers: make(map[string]string),
}
}
func (v *verifiable) verifyAppToken() error {
appToken := v.getParam(utils.ApplicationTokenHeader)
var err error
if len(appToken) == 0 {
return createError("unauthorized", codes.Unauthenticated, "application token required")
} else if config.GetRemote().(*conf.RemoteConfig).TokensSetting.ApplicationVerify {
if v.appId, err = verifyToken.Application(string(appToken)); err != nil || v.appId == 0 {
return createError("unauthorized", codes.Unauthenticated, "received invalid application token")
}
}
verifiableHeaders, err := auth.verify.ApplicationToken(string(appToken))
if err != nil {
log.Error(log_code.ErrorAuthenticate, err)
return createError("internal Server error", codes.Internal)
}
if len(verifiableHeaders) != awaitLengthVerifiableHeaders {
return createError("unauthorized", codes.Unauthenticated, "received unexpected identities")
}
applicationId, err := strconv.ParseInt(verifiableHeaders[utils.ApplicationIdHeader], 10, 32)
if err != nil {
log.Error(log_code.ErrorAuthenticate, errors.WithMessagef(err, "parse appId from redis"))
return createError("internal Server error", codes.Internal)
}
//nolint
if v.appId != -1 && int32(applicationId) != v.appId {
return createError("unauthorized", codes.Unauthenticated, "received unexpected application identity")
}
v.appId = int32(applicationId)
v.headers = verifiableHeaders
return nil
}
func (v *verifiable) verifyUserToken() error {
userToken := string(v.getParam(utils.UserTokenHeader))
if userToken != "" {
userId, err := verifyToken.User(userToken)
if err != nil {
return createError("unauthorized", codes.Unauthenticated, "received invalid user token")
}
v.headers[utils.UserIdHeader] = userId
}
v.headers[utils.UserTokenHeader] = userToken
v.headers[utils.DeviceTokenHeader] = string(v.getParam(utils.DeviceTokenHeader))
var err error
v.headers, err = auth.verify.Identity(v.headers, v.path)
if err != nil {
switch err {
case veritification.ErrorInvalidUserId:
return createError("unauthorized", codes.Unauthenticated, err.Error())
case veritification.ErrorPermittedToCallUser, veritification.ErrorPermittedToCallApplication:
return createError("forbidden", codes.PermissionDenied, err.Error())
default:
return createError("internal server error", codes.Internal)
}
}
return nil
}
func (v *verifiable) setHeaders() {
for key, value := range v.headers {
if value != "" {
v.ctx.Request.Header.Set(key, value)
}
}
}
func (v *verifiable) checkInnerMethods() error {
_, ok := routing.InnerMethods[v.path]
if ok {
adminToken := string(v.getParam(AdminTokenHeader))
if adminToken == "" {
return createError("unauthorized", codes.Unauthenticated, "admin token required")
}
if verifyToken.Admin(adminToken) != nil {
return createError("unauthorized", codes.Unauthenticated, "received invalid admin token")
}
}
return nil
}
func (v *verifiable) checkUserMethods() error {
if v.headers[utils.UserIdHeader] == "" {
if _, ok := routing.AuthUserMethods[v.path]; ok {
return createError("unauthorized", codes.Unauthenticated, "user token required")
}
}
return nil
}
func (v *verifiable) getParam(key string) []byte {
val := v.ctx.Request.Header.Peek(key)
if len(val) != 0 {
return val
}
return v.ctx.Request.URI().QueryArgs().Peek(key)
}
-32
View File
@@ -1,32 +0,0 @@
package authenticate
import (
"fmt"
"google.golang.org/grpc/codes"
)
func createError(msg string, status codes.Code, details ...interface{}) error {
return ErrorDescription{message: msg, grpcStatus: status, details: details}
}
type ErrorDescription struct {
message string
grpcStatus codes.Code
details []interface{}
}
func (e ErrorDescription) Error() string {
return fmt.Sprintf("code: %v, message: %s, details: %v", e.grpcStatus, e.message, e.details)
}
func (e ErrorDescription) Message() string {
return e.message
}
func (e ErrorDescription) ConvertToGrpcStatus() codes.Code {
return e.grpcStatus
}
func (e ErrorDescription) Details() []interface{} {
return e.details
}
-78
View File
@@ -1,78 +0,0 @@
package authenticate
import (
"github.com/dgrijalva/jwt-go"
"github.com/integration-system/isp-lib/v2/config"
"github.com/pkg/errors"
"github.com/spf13/cast"
"isp-gate-service/conf"
)
var (
errInvalidToken = errors.New("invalid token")
verifyToken token
)
type appClaims struct {
*jwt.StandardClaims
AppId int32
}
type userClaims struct {
*jwt.StandardClaims
UserId int64
}
type token struct{}
func (t token) Admin(token string) error {
secret := config.GetRemote().(*conf.RemoteConfig).TokensSetting.AdminSecret
_, err := t.parse(token, secret, jwt.MapClaims{})
return err
}
func (t token) Application(token string) (int32, error) {
secret := config.GetRemote().(*conf.RemoteConfig).TokensSetting.ApplicationSecret
parsed, err := t.parse(token, secret, &appClaims{StandardClaims: &jwt.StandardClaims{}})
if err != nil {
return 0, err
}
claims, ok := parsed.Claims.(*appClaims)
if !ok {
return 0, errInvalidToken
}
return claims.AppId, nil
}
func (t token) User(token string) (string, error) {
secret := config.GetRemote().(*conf.RemoteConfig).TokensSetting.UserSecret
parsed, err := t.parse(token, secret, &userClaims{StandardClaims: &jwt.StandardClaims{}})
if err != nil {
return "", err
}
claims, ok := parsed.Claims.(*userClaims)
if !ok {
return "", errInvalidToken
}
return cast.ToString(claims.UserId), nil
}
func (token) parse(token, secret string, claims jwt.Claims) (*jwt.Token, error) {
parsed, err := jwt.ParseWithClaims(token, claims, func(token *jwt.Token) (interface{}, error) {
_, ok := token.Method.(*jwt.SigningMethodHMAC)
if !ok {
return nil, errors.Errorf("unexpected signing method: %v", token.Header["alg"])
}
return []byte(secret), nil
})
if err != nil {
return nil, err
}
if !parsed.Valid {
return nil, errInvalidToken
}
return parsed, nil
}
+53
View File
@@ -0,0 +1,53 @@
package cache
import (
"sync"
"time"
)
type Item struct {
data []byte
expiredAt time.Time
}
type Cache struct {
store map[string]Item
lock *sync.RWMutex
}
func New() *Cache {
return &Cache{
store: map[string]Item{},
lock: &sync.RWMutex{},
}
}
func (c *Cache) Get(key string) ([]byte, bool) {
c.lock.RLock()
defer c.lock.RUnlock()
item, ok := c.store[key]
if !ok {
return nil, false
}
if c.now().After(item.expiredAt) {
return nil, false
}
return item.data, true
}
func (c *Cache) Set(key string, data []byte, lifeTime time.Duration) {
c.lock.Lock()
defer c.lock.Unlock()
c.store[key] = Item{
data: data,
expiredAt: c.now().Add(lifeTime),
}
}
func (c *Cache) now() time.Time {
return time.Now()
}
+50
View File
@@ -0,0 +1,50 @@
package cache_test
import (
"testing"
"time"
"github.com/stretchr/testify/require"
"isp-gate-service/cache"
)
func TestGetBasic(t *testing.T) {
t.Parallel()
require := require.New(t)
cache := cache.New()
cache.Set("key", []byte("data"), 24*time.Hour)
data, ok := cache.Get("key")
require.True(ok)
require.EqualValues("data", data)
_, ok = cache.Get("key2")
require.False(ok)
}
func TestGetExpired(t *testing.T) {
t.Parallel()
require := require.New(t)
cache := cache.New()
cache.Set("key", []byte("data"), 500*time.Millisecond)
time.Sleep(1 * time.Second)
data, ok := cache.Get("key")
require.False(ok)
require.Nil(data)
}
func TestNilValue(t *testing.T) {
t.Parallel()
require := require.New(t)
cache := cache.New()
cache.Set("key", nil, 24*time.Hour)
data, ok := cache.Get("key")
require.True(ok)
require.Nil(data)
}
+18 -10
View File
@@ -1,16 +1,24 @@
configServiceAddress:
ip: 127.0.0.1
port: 9001
httpOuterAddress:
ip: 127.0.0.1
grpcOuterAddress:
#ip: 127.0.0.1
port: 9003
httpInnerAddress:
grpcInnerAddress:
ip: 0.0.0.0
port: 9003
moduleName: isp-gate
instanceUuid: 9d89354b-c728-4b48-b002-a7d3b229f151
routerConfig:
routerModuleName: router
pathPrefix: /api
skipAuth: false
skipExistCheck: false
moduleName: isp-gate-service
infraServerPort: 9553
logfile:
path: /var/log/isp-gate-service/runtime.log
maxSizeMb: 512
maxBackups: 4
compress: true
locations:
- pathPrefix: /api
protocol: grpc
targetModule: router
+38
View File
@@ -0,0 +1,38 @@
configServiceAddress:
ip: 127.0.0.1
port: 9001
grpcOuterAddress:
#ip: 127.0.0.1
port: 9003
grpcInnerAddress:
ip: 0.0.0.0
port: 9003
moduleName: isp-gate-service
infraServerPort: 9553
logfile:
path: /var/log/isp-gate-service/runtime.log
maxSizeMb: 512
maxBackups: 4
compress: true
locations:
- pathPrefix: /ws/kkd-configuration-service
protocol: ws
targetModule: kkd-configuration-service
- pathPrefix: /api/kkd-configuration-service
protocol: http
targetModule: kkd-configuration-service
- withPrefix: false
pathPrefix: /api/kkd-storage-service/report/download
protocol: http
targetModule: kkd-storage-service
skipAuth: true
- pathPrefix: /api/kkd-storage-service
protocol: http
targetModule: kkd-storage-service
- pathPrefix: /api
protocol: grpc
skipAuth: false
targetModule: router
+14 -62
View File
@@ -1,65 +1,17 @@
{
"database": {
"address": "{{ msp_pgsql_address }}",
"port": "{{ msp_pgsql_port }}",
"schema": "gate_service",
"database": "{{ msp_pgsql_name }}",
"username": "{{ msp_pgsql_user }}",
"password": "{{ msp_pgsql_password }}",
"createSchema": true
},
"grpcSetting": {
"proxyGrpcErrorDetails": true,
"enableOriginalProtoErrors": false
},
"httpSetting": {
"maxRequestBodySizeBytes": 0
},
"accountingSetting": {
"enable": false,
"snapshotTimeout": "15m",
"setting": [
],
"storing": {
"size": 10000,
"timeout": "10m"
"logging": {
"logLevel": "debug",
"requestLogEnable": true,
"bodyLogEnable": false,
"skipBodyLoggingEndpointPrefixes": [],
"enableForceUnescapingUnicode": false
},
"caching": {
"authenticationDataInSec": 60,
"authorizationDataInSec": 60
},
"http": {
"maxRequestBodySizeInMb": 64,
"proxyTimeoutInSec": 60
}
},
"journalSetting": {
"journal": {
"filename": "/var/log/isp-gate-service/runtime.log",
"maxSizeMb": 512,
"bufferSize": 4096,
"rotateTimeoutMs": 86400000,
"enableRemoteTransfer": true,
"enable": false,
"compress": true
}
},
"redis": {
"password": "{{ msp_redis_password }}",
"defaultDB": 0,
"address": {
"ip": "{{ msp_redis_address }}",
"port": "{{ msp_redis_port }}"
}
},
"metrics": {
"gc": true,
"memory": true,
"address": {
"path": "/metrics",
"port": "9553",
"ip": "0.0.0.0"
}
},
"tokensSetting": {
"applicationSecret": "{{ msp_app_secret }}",
"applicationVerify": false,
"adminSecret": "{{ msp_admin_secret }}"
},
"authCacheSetting": {
"enableCache": false,
"evictTimeout": "1m"
}
}
+19
View File
@@ -0,0 +1,19 @@
package conf
const (
HttpProtocol = "http"
GrpcProtocol = "grpc"
WsProtocol = "ws"
)
type Local struct {
Locations []Location
}
type Location struct {
WithPrefix bool
SkipAuth bool
PathPrefix string `validate:"required"`
Protocol string `validate:"required,oneof=http grpc ws"`
TargetModule string `validate:"required"`
}
-23
View File
@@ -1,23 +0,0 @@
package conf
import (
"github.com/integration-system/isp-lib/v2/structure"
)
type (
Configuration struct {
InstanceUuid string `valid:"required~Required"`
ModuleName string `valid:"required~Required"`
ConfigServiceAddress structure.AddressConfiguration `valid:"required~Required"`
HttpOuterAddress structure.AddressConfiguration `valid:"required~Required" json:"httpOuterAddress"`
HttpInnerAddress structure.AddressConfiguration `valid:"required~Required" json:"httpInnerAddress"`
RouterConfig RouterConfig `valid:"required~Required" json:"routerConfig"`
}
RouterConfig struct {
RouterModuleName string `valid:"required~Required"`
PathPrefix string `valid:"required~Required"`
SkipAuth bool
SkipExistCheck bool
}
)
+60
View File
@@ -0,0 +1,60 @@
// nolint:gochecknoinits,lll
package conf
import (
"reflect"
"github.com/txix-open/isp-kit/log"
"github.com/txix-open/isp-kit/rc/schema"
"github.com/txix-open/jsonschema"
)
func init() {
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
t.Type = "string"
t.Enum = []interface{}{"debug", "info", "warn", "error", "fatal"}
})
}
type Remote struct {
Http Http `schema:"Настройки HTTP"`
Logging Logging `schema:"Настройки логирования"`
Caching Caching `schema:"Настройки кеширования"`
DailyLimits []DailyLimit `schema:"Настройки суточных ограничений,сбрасываются раз в сутки в 00:00"`
Throttling []Throttling `schema:"Настройки пропускной способности"`
EnableClientRequestIdForwarding bool `schema:"Включить проброс requestId из заголовка запроса"`
ForwardReqIdClientSettings []ForwardReqIdClientSettings `schema:"Настройки проброcа requestId для приложений"`
}
type ForwardReqIdClientSettings struct {
ApplicationId int `schema:"Идентификатор приложения"`
ForwardRequestId bool `schema:"Включить проброс requestId из заголовка запроса"`
}
type Http struct {
MaxRequestBodySizeInMb int64 `validate:"required" schema:"Максимальная длинна тела запроса,в мегабайтах"`
ProxyTimeoutInSec int `validate:"required" schema:"Таймаут на проксирование,в секундах"`
}
type Logging struct {
LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования,логирование запросов осуществляется на уровне debug"`
RequestLogEnable bool `schema:"Включить логирование запросов"`
BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"`
SkipBodyLoggingEndpointPrefixes []string `schema:"регулярные выражения для отключения логирования"`
EnableForceUnescapingUnicode bool `schema:"Включить перевод тел запроса из unicode в utf-8, должно быть включено логирование тел запросов и ответов"`
}
type Caching struct {
AuthenticationDataInSec int `validate:"required" schema:"Время кеширования данных аутентификации,в секундах"`
AuthorizationDataInSec int `validate:"required" schema:"Время кеширования данных авторизации,в секундах"`
}
type DailyLimit struct {
ApplicationId int `validate:"required" schema:"ID приложения"`
RequestsPerDay int64 `validate:"required" schema:"Запросов в сутки"`
}
type Throttling struct {
ApplicationId int `validate:"required" schema:"ID приложения"`
RequestsPerSeconds int `validate:"required,min=1,max=1000" schema:"Запросов в секунду,не конфликтует с суточными ограничениями, алгоритм не работает на значениях больше 1000"`
}
-115
View File
@@ -1,115 +0,0 @@
//nolint
package conf
import (
"github.com/integration-system/isp-journal/rx"
"github.com/integration-system/isp-lib/v2/structure"
"time"
)
const (
KB = int64(1024)
MB = int64(1 << 20)
defaultSyncTimeout = 30 * time.Second
defaultStreamTimeout = 60 * time.Second
defaultBufferSize = 4 * KB
defaultMaxRequestBodySize = 512 * MB
DefaultMaxResponseBodySize = 32 * MB
)
type (
RemoteConfig struct {
Database structure.DBConfiguration `schema:"Настройка подключения к базе данных"`
TokensSetting TokensSetting `schema:"Настройка секретов"`
HttpSetting HttpSetting `schema:"Настройка сервера"`
GrpcSetting GrpcSetting `schema:"Настройка grpc соединения"`
Metrics structure.MetricConfiguration `schema:"Настройка метрик"`
JournalSetting Journal `schema:"Настройка журалирования"`
Redis structure.RedisConfiguration `schema:"Настройка Redis" valid:"required~Required"`
AccountingSetting Accounting `schema:"Настройка учета запросов"`
AuthCacheSetting Cache `schema:"Настройка кеширования данных аутентификации приложений" valid:"required~Required"`
}
Cache struct {
EnableCache bool `schema:"Кеширование,включает кеширования для токена приложения"`
EvictTimeout string `schema:"Время жизни записи в кеше"`
}
Journal struct {
Journal rx.Config `schema:"Настройка конфигурации"`
MethodsPatterns []string `schema:"Список методов для логирования,список строк вида: 'module/group/method'(* - для частичного совпадения). При обработке запроса, если вызываемый метод совпадает со строкой из списка, тела запроса и ответа записываются в лог"`
}
TokensSetting struct {
AdminSecret string `schema:"Секрет для проверки токена администратора"`
ApplicationSecret string `schema:"Секрет для проверки токена приложений"`
ApplicationVerify bool `schema:"Проверка подписи токена приложений"`
UserSecret string `schema:"Секрет для проверки токена пользователя"`
}
Accounting struct {
Enable bool `schema:"Учет запросов,включает/отключает учет запросов"`
SnapshotTimeout string `schema:"Частота выгрузки ограничений для приложений" valid:"required~Required"`
Setting []AccountingSetting `schema:"Настройка учета для приложений"`
Storing StoringSetting `schema:"Настройка хранения всех запросов"`
}
AccountingSetting struct {
ApplicationId int32 `valid:"required~Required" schema:"Идентификатор приложения"`
EnableStoring bool `schema:"Хранение запросов,если включено, каждый факт обработки запроса будет фиксироваться в БД"`
Limits []LimitSetting `schema:"Настройка ограничений на запросы"`
}
LimitSetting struct {
Pattern string `valid:"required~Required" schema:"Шаблон пути,указывается путь для которого будут применяется ограничения; поддерживается '/*' для неполного совпадения"`
MaxCount int `schema:"Количество запросов"`
Timeout string `schema:"Время жизни одного запроса"`
}
StoringSetting struct {
Size int `schema:"Размер буфера,размер буфера,при достижении которого данные сбрасываются в БД" valid:"required,range(1|1000000)"`
Timeout string `schema:"Частота выгрузки всех учтенных запросов,периодичность сброса данных в БД" valid:"required~Required"`
}
HttpSetting struct {
MaxRequestBodySizeBytes int64 `schema:"Максимальный размер тела запроса,в байтайх, по умолчанию: 512 MB"`
}
GrpcSetting struct {
EnableOriginalProtoErrors bool `schema:"Проксирование ошибок в протобаф,включение/отключение проксирования, по умолчанию отключено"`
ProxyGrpcErrorDetails bool `schema:"Проксирование первого элемента из details GRPC ошибки,включение/отключение проксирования, по умолчанию отключено"`
MultipartDataTransferBufferSizeBytes int64 `schema:"Размер буфера для передачи бинарных файлов,по умолчанию 4 KB"`
SyncInvokeMethodTimeoutMs int64 `schema:"Время ожидания вызова метода,значение в миллисекундах, по умолчанию: 30000"`
StreamInvokeMethodTimeoutMs int64 `schema:"Время ожидания передачи и обработки файла,значение в миллисекундах, по умолчанию: 60000"`
}
)
func (cfg GrpcSetting) GetSyncInvokeTimeout() time.Duration {
if cfg.SyncInvokeMethodTimeoutMs <= 0 {
return defaultSyncTimeout
}
return time.Duration(cfg.SyncInvokeMethodTimeoutMs) * time.Millisecond
}
func (cfg GrpcSetting) GetStreamInvokeTimeout() time.Duration {
if cfg.StreamInvokeMethodTimeoutMs <= 0 {
return defaultStreamTimeout
}
return time.Duration(cfg.StreamInvokeMethodTimeoutMs) * time.Millisecond
}
func (cfg GrpcSetting) GetTransferFileBufferSize() int64 {
if cfg.MultipartDataTransferBufferSizeBytes <= 0 {
return defaultBufferSize
}
return cfg.MultipartDataTransferBufferSizeBytes
}
func (cfg HttpSetting) GetMaxRequestBodySize() int64 {
if cfg.MaxRequestBodySizeBytes <= 0 {
return defaultMaxRequestBodySize
}
return cfg.MaxRequestBodySizeBytes
}
+13
View File
@@ -0,0 +1,13 @@
package conf_test
import (
"testing"
"github.com/txix-open/isp-kit/test/rct"
"isp-gate-service/conf"
)
func TestDefaultRemoteConfig(t *testing.T) {
t.Parallel()
rct.Test(t, "default_remote_config.json", conf.Remote{})
}
+7
View File
@@ -0,0 +1,7 @@
package domain
type AdminAuthenticateResponse struct {
Authenticated bool
ErrorReason string
AdminId int
}
+9
View File
@@ -0,0 +1,9 @@
package domain
type AuthData struct {
AppName string
SystemId int
DomainId int
ServiceId int
ApplicationId int
}
+9
View File
@@ -0,0 +1,9 @@
package domain
import (
"github.com/pkg/errors"
)
var (
ErrAuthenticationCacheMiss = errors.New("authentication not found in cache")
)
-30
View File
@@ -1,30 +0,0 @@
package domain
type ProxyResponse struct {
requestBody []byte
responseBody []byte
error error
}
func Create() ProxyResponse {
return ProxyResponse{requestBody: nil, responseBody: nil, error: nil}
}
func (p ProxyResponse) SetRequestBody(requestBody []byte) ProxyResponse {
p.requestBody = requestBody
return p
}
func (p ProxyResponse) SetResponseBody(responseBody []byte) ProxyResponse {
p.responseBody = responseBody
return p
}
func (p ProxyResponse) SetError(err error) ProxyResponse {
p.error = err
return p
}
func (p ProxyResponse) Get() (requestBody, responseBody []byte, err error) {
return p.requestBody, p.responseBody, p.error
}
+29
View File
@@ -0,0 +1,29 @@
package domain
type AuthenticateRequest struct {
Token string
}
type AuthenticateResponse struct {
Authenticated bool
ErrorReason string
AuthData *AuthData
}
type AuthorizeRequest struct {
ApplicationId int
Endpoint string
}
type AuthorizeResponse struct {
Authorized bool
}
type AdminAuthorizeRequest struct {
AdminId int
Permission string
}
type AdminAuthorizeResponse struct {
Authorized bool
}
+11
View File
@@ -0,0 +1,11 @@
package domain
import (
"time"
)
type RateLimitResult struct {
Allow bool
Remaining int
RetryAfter time.Duration
}
-21
View File
@@ -1,21 +0,0 @@
package entity
import (
"isp-gate-service/accounting/state"
"time"
)
type Snapshot struct {
TableName string `sql:"?db_schema.snapshot" json:"-"`
AppId int32 `sql:",pk"`
LimitState map[string]state.Snapshot
Version int64
}
type Request struct {
TableName string `sql:"?db_schema.requests" json:"-"`
Id int `sql:",pk"`
AppId int32
Method string
CreatedAt time.Time
}
+25
View File
@@ -0,0 +1,25 @@
package entity
import (
"time"
)
type IncrementRequest struct {
Key string
Today time.Time
}
type IncrementResponse struct {
Value uint64
}
type RateLimiterRequest struct {
Key string
MaxRps int
}
type RateLimiterResponse struct {
Allow bool
Remaining int
RetryAfter time.Duration
}
+73 -17
View File
@@ -1,23 +1,79 @@
module isp-gate-service
go 1.14
go 1.25
require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fasthttp/websocket v1.4.1
github.com/go-pg/pg/v9 v9.1.7
github.com/go-redis/redis/v8 v8.0.0-beta.2
github.com/golang/protobuf v1.3.5
github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f
github.com/integration-system/isp-journal v1.5.0
github.com/integration-system/isp-lib/v2 v2.6.3
github.com/integration-system/isp-log v1.1.5
github.com/json-iterator/go v1.1.10
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.3
github.com/pkg/errors v0.9.1
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
github.com/spf13/cast v1.3.1
github.com/stretchr/testify v1.6.1
github.com/valyala/fasthttp v1.16.0
golang.org/x/net v0.0.0-20200822124328-c89045814202
google.golang.org/grpc v1.29.1
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.63.3
github.com/txix-open/jsonschema v1.3.0
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.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
)
require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
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.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.27.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // 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
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.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // 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
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
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.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.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
)
+184 -586
View File
@@ -1,602 +1,200 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7 h1:qELHH0AWCvf98Yf+CNIJx9vOZOfHFDDzgDRYsnNk/vs=
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4=
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f h1:y2hSFdXeA1y5z5f0vfNO0Dg5qVY036qzlz3Pds0B92o=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.29.9/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg=
github.com/benbjohnson/clock v1.0.0 h1:78Jk/r6m4wCi6sndMpty7A//t4dw/RW5fV4ZgDVfX1w=
github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/buaazp/fasthttprouter v0.1.1 h1:4oAnN0C3xZjylvZJdP35cxfclyn4TYkW6Y+DSvS+h8Q=
github.com/buaazp/fasthttprouter v0.1.1/go.mod h1:h/Ap5oRVLeItGKTVBb+heQPks+HdIUtGmI4H5WCYijM=
github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU=
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
github.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs=
github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/codemodus/kace v0.5.1 h1:4OCsBlE2c/rSJo375ggfnucv9eRzge/U5LrrOZd47HA=
github.com/codemodus/kace v0.5.1/go.mod h1:coddaHoX1ku1YFSe4Ip0mL9kQjJvKkzb9CfIdG1YR04=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
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/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=
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.14/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.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fasthttp/websocket v1.4.1 h1:fisgNMCNCbIPM5GRRRTAckRrynbSzf76fevcJYJYnSM=
github.com/fasthttp/websocket v1.4.1/go.mod h1:toetUvZ3KISxtZERe0wzPPpnaN8GZCKHCowWctwA50o=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y=
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I=
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
github.com/go-openapi/jsonreference v0.19.4 h1:3Vw+rh13uq2JFNxgnMTGE1rnoieU9FmyE1gvnyylsYg=
github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
github.com/go-openapi/spec v0.19.9 h1:9z9cbFuZJ7AcvOHKIY+f6Aevb4vObNDkTEyoMfO7rAc=
github.com/go-openapi/spec v0.19.9/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28=
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4azE=
github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
github.com/go-pg/pg/v9 v9.0.0-beta.14/go.mod h1:T2Sr6bpTCOr2lUqOUMiXLMJqZHSUBKk1LdgSqjwhZfA=
github.com/go-pg/pg/v9 v9.0.3/go.mod h1:Tm/Q3Vt6gdQOH6TTN1H/xLlIXc+Qrka7TZ6uREtu/eA=
github.com/go-pg/pg/v9 v9.1.4/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg=
github.com/go-pg/pg/v9 v9.1.7 h1:JSAszC/xbOHmvS86fPnvxCQ288lR0ecX7yqxiPnBoNo=
github.com/go-pg/pg/v9 v9.1.7/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg=
github.com/go-pg/urlstruct v0.1.0/go.mod h1:2Nag+BIny6G/KYCkdt++ZnqU/VinzimGapKfs4kwlN0=
github.com/go-pg/urlstruct v0.2.6/go.mod h1:dxENwVISWSOX+k87hDt0ueEJadD+gZWv3tHzwfmZPu8=
github.com/go-pg/urlstruct v0.3.0 h1:ORiTb205uT7v7lvq4VUOQ4ddJ5TjFRlVRWqWsMBgek4=
github.com/go-pg/urlstruct v0.3.0/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg=
github.com/go-pg/zerochecker v0.1.1 h1:av77Qe7Gs+1oYGGh51k0sbZ0bUaxJEdeP0r8YE64Dco=
github.com/go-pg/zerochecker v0.1.1/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo=
github.com/go-redis/redis v6.15.6+incompatible h1:H9evprGPLI8+ci7fxQx6WNZHJSb7be8FqJQRhdQZ5Sg=
github.com/go-redis/redis v6.15.6+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis/v8 v8.0.0-beta.2 h1:9S28J9QMBotgI3tGgXbX1Wk9i8QYC3Orw4bTLoPrQeI=
github.com/go-redis/redis/v8 v8.0.0-beta.2/go.mod h1:o1M7JtsgfDYyv3o+gBn/jJ1LkqpnCrmil7PSppZGBak=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
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/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.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.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=
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-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
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.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=
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/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c h1:yyIH4qCFf5LD5PKhXoX4BZh3wRjd59xBV4eAQTBwS6k=
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c/go.mod h1:6cf4ZNvtzZ/KMiuc+d5Y7rSHjzlYBWEqbVyDfUDhqIE=
github.com/integration-system/bellows v1.0.0 h1:fVFBYo7Oty4IiIWukjSgBoaCi+0EmPz7LMO8ACs+gDc=
github.com/integration-system/bellows v1.0.0/go.mod h1:qHPg1ptN3AHHr0f/wvoicfA2LOCprOyrbXnIa5QIRe0=
github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f h1:52UOJguw5yqe1y2JjmyVxGcZf3kv2BQeUodR363MkiQ=
github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f/go.mod h1:w+dmaWojuIwNujSYg6qt1wKHhSdorLOivCEl/XuLzbM=
github.com/integration-system/gowsdl v1.0.0 h1:rDv5HrzNUs6aWTj9roSDS9ZdIf58FzF0YVP2nusvbto=
github.com/integration-system/gowsdl v1.0.0/go.mod h1:ZwTCE+Av5aQLnPj2/3PIop6mzCs1FY7jXrcWDvSjrBA=
github.com/integration-system/isp-etp-go/v2 v2.1.0/go.mod h1:Ndq5DMM3sDJjZn4cyKKvZrVED0FMeoXMRWHZTq+2Z1o=
github.com/integration-system/isp-etp-go/v2 v2.1.1 h1:6LU9eE1cGVpp8HNRYu83K4hY49YlNPFd/uj3+Iog4ro=
github.com/integration-system/isp-etp-go/v2 v2.1.1/go.mod h1:Ndq5DMM3sDJjZn4cyKKvZrVED0FMeoXMRWHZTq+2Z1o=
github.com/integration-system/isp-io v0.0.0-20190723122940-3daf588d878f h1:nJGOobuawo5d3QgoLl1i2SJVDIHkxMl0bhH1+iqZmnk=
github.com/integration-system/isp-io v0.0.0-20190723122940-3daf588d878f/go.mod h1:1cjy4g5F8WXrOB3l/bL3mw+TCWDppOL1pz08wOAMi9Y=
github.com/integration-system/isp-journal v1.5.0 h1:7Lpt7dHhpq1zRY4qRRYUMiEnaQZbxyPHRcy/ik/Vm8I=
github.com/integration-system/isp-journal v1.5.0/go.mod h1:B6cLJqjNL+XHWv4IzKt5aIZ7AjbHX2tQFXgRSaWNNIo=
github.com/integration-system/isp-lib/v2 v2.3.1/go.mod h1:eRSmS3+S8WXTUKu7YtSimFJDrLF+/esM/989NBEsP2o=
github.com/integration-system/isp-lib/v2 v2.6.3 h1:YbIids+aslyi4ieToYjUuWbPoQ4i4d4Ld4dNC8AVvSU=
github.com/integration-system/isp-lib/v2 v2.6.3/go.mod h1:ZGW7qQsCuELBHRBnSSDSEonPx+FxAfHiAfwsGQZzVO4=
github.com/integration-system/isp-log v1.1.2 h1:bnWxPjDOC1Y/tEzFxa42aG+xaPRWizuJADAwXgp2i5U=
github.com/integration-system/isp-log v1.1.2/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs=
github.com/integration-system/isp-log v1.1.5 h1:YiMx+hV2YyCTfHu5vIjtqSkRtPjr/WY9xvKsvONDVNU=
github.com/integration-system/isp-log v1.1.5/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs=
github.com/integration-system/jsonschema v1.0.0 h1:Lci4sHGhOX27qCgZo5rvJ37Bjcfm+qCwU0yvw6ImEX4=
github.com/integration-system/jsonschema v1.0.0/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs=
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.10.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg=
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
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/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.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.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=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
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=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.4/go.mod h1:Jw1Z28soD/QasIA2uWjXyM9El1jly3YwyFOuR8tH1rg=
github.com/nats-io/nats-streaming-server v0.17.0/go.mod h1:ewPBEsmp62Znl3dcRsYtlcfwudxHEdYMtYqUQSt4fE0=
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nats-io/stan.go v0.6.0/go.mod h1:eIcD5bi3pqbHT/xIIvXMwvzXYElgouBvaVRftaE+eac=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
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/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/pressly/goose v2.6.0+incompatible h1:3f8zIQ8rfgP9tyI0Hmcs2YNAqUCL1c+diLe3iU8Qd/k=
github.com/pressly/goose v2.6.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8=
github.com/profefe/profefe v0.0.0-20200307211836-5ab457f7a4d8 h1:9lI6rm0yjyeB6Q5zE/SytxlNDgRQ1thnRZGQChtsLRs=
github.com/profefe/profefe v0.0.0-20200307211836-5ab457f7a4d8/go.mod h1:QOlABo1QFtwVrB7Rdl8gwY9pqxmln8lIWOQEW1oj1uI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.0.9/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.2-0.20200205151950-d13a6085d55c/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/savsgio/gotils v0.0.0-20190714152828-365999d0a274 h1:F52t1X2ziOrMcQMVHo8ZxwOrDTMAq6MrlKtL1Atu2wU=
github.com/savsgio/gotils v0.0.0-20190714152828-365999d0a274/go.mod h1:w803/Fg1m0hrp1ZT9KNfQe4E4+WOMMFLcgzPvOcye10=
github.com/segmentio/encoding v0.1.10 h1:0b8dva47cSuNQR5ZcU3d0pfi9EnPpSK6q7y5ZGEW36Q=
github.com/segmentio/encoding v0.1.10/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
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.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=
github.com/redis/go-redis/v9 v9.11.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM=
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E=
github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI=
github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba h1:lUPlXKqgbqT2SVg2Y+eT9mu5wbqMnG+i/+Q9nK7C0Rs=
github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba/go.mod h1:O1lAbCgAAX/KZ80LM/OXwtWFI/5TvZlwxSg8Cq08PV0=
github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y=
github.com/swaggo/swag v1.6.3/go.mod h1:wcc83tB4Mb2aNiL/HP4MFeQdpHUrca+Rp/DRNgWAUio=
github.com/swaggo/swag v1.6.7 h1:e8GC2xDllJZr3omJkm9YfmK0Y56+rMO3cg0JBKNz09s=
github.com/swaggo/swag v1.6.7/go.mod h1:xDhTyuFIujYiN3DKWC/H/83xcfHp+UE/IzWWampG7Zc=
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3 h1:COy7ekr2jBEd34npP2LvMTqk9UtiLkuvkjiJFHihlTo=
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3/go.mod h1:ehwM4AFY4byYSorQbigh79cKUOUNL3pAOz5eCAQNlGI=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0=
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.4.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
github.com/valyala/fasthttp v1.9.0 h1:hNpmUdy/+ZXYpGy0OBfm7K0UQTzb73W0T0U4iJIVrMw=
github.com/valyala/fasthttp v1.9.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
github.com/valyala/fasthttp v1.16.0 h1:9zAqOYLl8Tuy3E5R6ckzGDJ1g8+pw15oQp2iL9Jl6gQ=
github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/vmihailenco/bufpool v0.1.5 h1:mEO/biwhAgiY97yPMmAdH4PvaIu63C6uGBdfSdoMo/I=
github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk=
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
github.com/vmihailenco/msgpack/v4 v4.3.5/go.mod h1:DuaveEe48abshDmz5UBKyZ+yDugvaeFk5ayfrewUOaw=
github.com/vmihailenco/msgpack/v4 v4.3.7 h1:Aj4eMY2qXTRfWRwHKJ2n/CWKVy15pCYN327QMJ/OUVs=
github.com/vmihailenco/msgpack/v4 v4.3.7/go.mod h1:Ii+PksJlvFT5ZRcB/4YLAInMIp6a0WOCm0L3BU0aNG4=
github.com/vmihailenco/msgpack/v4 v4.3.11 h1:Q47CePddpNGNhk4GCnAx9DDtASi2rasatE0cd26cZoE=
github.com/vmihailenco/msgpack/v4 v4.3.11/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.0/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opentelemetry.io/otel v0.5.0 h1:tdIR1veg/z+VRJaw/6SIxz+QX3l+m+BDleYLTs+GC1g=
go.opentelemetry.io/otel v0.5.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek=
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191128160524-b544559bb6d1/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222033325-078779b8f2d8/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 h1:sfkvUWPNGwSV+8/fNqctR5lS2AqCSqYwXdrjCxp/dXo=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200220224806-8a925fa4c0df/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200826040757-bc8aaaa29e06 h1:ChBCbOHeLqK+j+znGPlWCcvx/t2PdxmyPBheVZxXbcc=
golang.org/x/tools v0.0.0-20200826040757-bc8aaaa29e06/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200211111953-2dc5924e3898 h1:bKX1IGaSj2XD9yfWNts9HKRdQRH0lOZ0S7Nb8meQSlY=
google.golang.org/genproto v0.0.0-20200211111953-2dc5924e3898/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36 h1:j7CmVRD4Kec0+f8VuBAc2Ak2MFfXm5Q2/RxuJLL+76E=
google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.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.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/tomakado/websocketproxy v0.1.0 h1:e037TLXDvEYYHlxHE5pqmj/DytFKm2NRn7i4wbVzIyE=
github.com/tomakado/websocketproxy v0.1.0/go.mod h1:EXg/3jcTJYZ04Hsf93RpY90FYA9lj1Sl+VM7lZI6xpM=
github.com/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/etp/v3 v3.2.0 h1:EgTchT8VtCYV1iEo/y4jII3/NybrXiQDE0y6pmS350M=
github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0=
github.com/txix-open/etp/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.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=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
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.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.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-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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
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/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.2/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
mellium.im/sasl v0.2.1 h1:nspKSRg7/SyO0cRGY71OkfHab8tf9kCts6a6oTDut0w=
mellium.im/sasl v0.2.1/go.mod h1:ROaEDLQNuf9vjKqE1SrAfnsobm2YKXT1gnN1uDp1PjQ=
nhooyr.io/websocket v1.7.4 h1:w/LGB2sZT0RV8lZYR7nfyaYz4PUbYZ5oF7NBon2M0NY=
nhooyr.io/websocket v1.7.4/go.mod h1:PxYxCwFdFYQ0yRvtQz3s/dC+VEm7CSuC/4b9t8MQQxw=
nhooyr.io/websocket v1.8.4 h1:P43INlkmY2eCxLvHeiMFK/ROUiOm0NdzRGGDtURbe58=
nhooyr.io/websocket v1.8.4/go.mod h1:LiqdCg1Cu7TPWxEvPjPa0TGYxCsy4pHNTN9gGluwBpQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-125
View File
@@ -1,125 +0,0 @@
package handler
import (
"fmt"
"net/http"
"time"
"github.com/integration-system/isp-lib/v2/config"
log "github.com/integration-system/isp-log"
"github.com/pkg/errors"
"github.com/valyala/fasthttp"
"google.golang.org/grpc/codes"
"isp-gate-service/accounting"
"isp-gate-service/authenticate"
"isp-gate-service/conf"
"isp-gate-service/domain"
"isp-gate-service/invoker"
"isp-gate-service/log_code"
"isp-gate-service/proxy"
"isp-gate-service/routing"
"isp-gate-service/service"
"isp-gate-service/service/matcher"
"isp-gate-service/utils"
)
const (
execution = 1e6
)
var (
errAccounting = errors.New("accounting error")
helper handlerHelper
)
type handlerHelper struct{}
func CompleteRequest(ctx *fasthttp.RequestCtx) {
currentTime := time.Now()
method, resp := helper.AuthenticateAccountingProxy(ctx)
executionTime := time.Since(currentTime) / execution
statusCode := ctx.Response.StatusCode()
service.Metrics.UpdateStatusCounter(helper.SetMetricStatus(statusCode))
if statusCode == http.StatusOK {
service.Metrics.UpdateMethodResponseTime(method, executionTime)
}
logEnable := config.GetRemote().(*conf.RemoteConfig).JournalSetting.Journal.Enable
//nolint
if logEnable && matcher.JournalMethods.Match(method) {
requestBody, responseBody, err := resp.Get()
if err != nil {
if err := invoker.Journal.Error(method, requestBody, responseBody, err); err != nil {
log.Warnf(log_code.WarnJournalCouldNotWriteToFile, "could not write to file journal: %v", err)
}
} else {
if err := invoker.Journal.Info(method, requestBody, responseBody); err != nil {
log.Warnf(log_code.WarnJournalCouldNotWriteToFile, "could not write to file journal: %v", err)
}
}
}
}
func (handlerHelper) AuthenticateAccountingProxy(ctx *fasthttp.RequestCtx) (string, domain.ProxyResponse) {
initialPath := string(ctx.Path())
p := proxy.RoutingProxy
path := proxy.GetPathWithoutApiPrefix(initialPath)
if p == nil {
msg := fmt.Sprintf("unknown proxy for '%s'", initialPath)
utils.WriteError(ctx, msg, codes.NotFound, nil)
return initialPath, domain.Create().SetError(errors.New(msg))
}
if !p.SkipExistCheck() {
if _, ok := routing.AllMethods[path]; !ok {
msg := "not implemented"
utils.WriteError(ctx, msg, codes.Unimplemented, nil)
return path, domain.Create().SetError(errors.New(msg))
}
}
if !p.SkipAuth() {
applicationId, err := authenticate.Do(ctx, path)
if err != nil {
message := "unknown error"
status := codes.Unknown
details := make([]interface{}, 0)
if e, ok := err.(authenticate.ErrorDescription); ok {
message = e.Message()
status = e.ConvertToGrpcStatus()
details = e.Details()
}
utils.WriteError(ctx, message, status, details)
return path, domain.Create().SetError(err)
}
if !accounting.AcceptRequest(applicationId, path) {
err := errAccounting
utils.WriteError(ctx, "too many requests", codes.ResourceExhausted, nil)
return path, domain.Create().SetError(err)
}
}
return path, p.ProxyRequest(ctx, path)
}
func (handlerHelper) SetMetricStatus(statusCode int) string {
metricStatus := "5xx"
switch {
case statusCode >= 100 && statusCode < 200:
metricStatus = "1xx"
case statusCode >= 200 && statusCode < 300:
metricStatus = "2xx"
case statusCode >= 300 && statusCode < 400:
metricStatus = "3xx"
case statusCode >= 400 && statusCode < 500:
metricStatus = "4xx"
case statusCode >= 500 && statusCode < 600:
metricStatus = "5xx"
}
return metricStatus
}
+402
View File
@@ -0,0 +1,402 @@
[
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1977-02-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"38924\",\"flat\":\"185\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Петрович\",\"birthDay\":\"1977-02-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"38924\",\"flat\":\"185\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1950-08-18\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"63988\",\"flat\":\"78\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Иван\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1950-08-18\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"63988\",\"flat\":\"78\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1991-01-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"07460\",\"flat\":\"39\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Сергей\",\"middleName\":\"Козлович\",\"birthDay\":\"1991-01-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"07460\",\"flat\":\"39\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1982-05-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31319\",\"flat\":\"191\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1982-05-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31319\",\"flat\":\"191\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1993-01-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"70892\",\"flat\":\"51\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1993-01-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"70892\",\"flat\":\"51\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1963-10-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"64647\",\"flat\":\"176\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Петр\",\"middleName\":\"Михайлович\",\"birthDay\":\"1963-10-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"64647\",\"flat\":\"176\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1997-01-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"05466\",\"flat\":\"101\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1997-01-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"05466\",\"flat\":\"101\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1985-06-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"62526\",\"flat\":\"40\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Петр\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1985-06-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"62526\",\"flat\":\"40\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1964-02-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"67088\",\"flat\":\"111\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1964-02-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"67088\",\"flat\":\"111\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1985-11-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"59230\",\"flat\":\"143\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Козлович\",\"birthDay\":\"1985-11-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"59230\",\"flat\":\"143\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1988-10-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"03392\",\"flat\":\"180\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Сергей\",\"middleName\":\"Козлович\",\"birthDay\":\"1988-10-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"03392\",\"flat\":\"180\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1977-06-16\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"20665\",\"flat\":\"166\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1977-06-16\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"20665\",\"flat\":\"166\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1987-12-12\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"66035\",\"flat\":\"90\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Козлович\",\"birthDay\":\"1987-12-12\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"66035\",\"flat\":\"90\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1974-02-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"39439\",\"flat\":\"148\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Алексей\",\"middleName\":\"Петрович\",\"birthDay\":\"1974-02-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"39439\",\"flat\":\"148\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1989-02-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01481\",\"flat\":\"147\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Сергей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1989-02-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01481\",\"flat\":\"147\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1952-11-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"54019\",\"flat\":\"67\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Петр\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1952-11-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"54019\",\"flat\":\"67\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1967-04-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80312\",\"flat\":\"79\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Сергей\",\"middleName\":\"Иванович\",\"birthDay\":\"1967-04-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80312\",\"flat\":\"79\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1951-12-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"60752\",\"flat\":\"136\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Иван\",\"middleName\":\"Козлович\",\"birthDay\":\"1951-12-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"60752\",\"flat\":\"136\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1989-07-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"52236\",\"flat\":\"49\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Михаил\",\"middleName\":\"Козлович\",\"birthDay\":\"1989-07-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"52236\",\"flat\":\"49\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1961-06-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"48602\",\"flat\":\"159\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Петр\",\"middleName\":\"Козлович\",\"birthDay\":\"1961-06-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"48602\",\"flat\":\"159\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1966-11-11\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"30072\",\"flat\":\"58\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1966-11-11\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"30072\",\"flat\":\"58\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1974-08-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"22508\",\"flat\":\"80\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Михаил\",\"middleName\":\"Петрович\",\"birthDay\":\"1974-08-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"22508\",\"flat\":\"80\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1993-04-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31222\",\"flat\":\"130\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Михаил\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1993-04-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31222\",\"flat\":\"130\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-11-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"43510\",\"flat\":\"98\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Петр\",\"middleName\":\"Петрович\",\"birthDay\":\"1969-11-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"43510\",\"flat\":\"98\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1965-04-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"93733\",\"flat\":\"39\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Алексей\",\"middleName\":\"Петрович\",\"birthDay\":\"1965-04-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"93733\",\"flat\":\"39\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-05-28\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"87093\",\"flat\":\"167\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Михайлович\",\"birthDay\":\"1969-05-28\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"87093\",\"flat\":\"167\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1951-12-24\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"27732\",\"flat\":\"112\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Михайлович\",\"birthDay\":\"1951-12-24\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"27732\",\"flat\":\"112\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1989-07-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31765\",\"flat\":\"51\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Михаил\",\"middleName\":\"Михайлович\",\"birthDay\":\"1989-07-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31765\",\"flat\":\"51\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1978-05-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"96998\",\"flat\":\"180\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Иванович\",\"birthDay\":\"1978-05-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"96998\",\"flat\":\"180\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1993-10-12\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01064\",\"flat\":\"100\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Михаил\",\"middleName\":\"Михайлович\",\"birthDay\":\"1993-10-12\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01064\",\"flat\":\"100\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1993-04-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"45967\",\"flat\":\"82\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Петр\",\"middleName\":\"Иванович\",\"birthDay\":\"1993-04-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"45967\",\"flat\":\"82\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-08-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"74957\",\"flat\":\"64\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Петр\",\"middleName\":\"Михайлович\",\"birthDay\":\"1981-08-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"74957\",\"flat\":\"64\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1993-01-10\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"19023\",\"flat\":\"22\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Алексей\",\"middleName\":\"Михайлович\",\"birthDay\":\"1993-01-10\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"19023\",\"flat\":\"22\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1962-01-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"73929\",\"flat\":\"198\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Козлович\",\"birthDay\":\"1962-01-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"73929\",\"flat\":\"198\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1956-08-03\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"46793\",\"flat\":\"83\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Петр\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1956-08-03\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"46793\",\"flat\":\"83\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1954-04-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"22410\",\"flat\":\"162\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Сергей\",\"middleName\":\"Петрович\",\"birthDay\":\"1954-04-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"22410\",\"flat\":\"162\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1991-12-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"92089\",\"flat\":\"62\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1991-12-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"92089\",\"flat\":\"62\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1970-10-10\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"91849\",\"flat\":\"22\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Иван\",\"middleName\":\"Иванович\",\"birthDay\":\"1970-10-10\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"91849\",\"flat\":\"22\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1952-07-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"49639\",\"flat\":\"87\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1952-07-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"49639\",\"flat\":\"87\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1967-03-09\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"43225\",\"flat\":\"165\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1967-03-09\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"43225\",\"flat\":\"165\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-05-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"90629\",\"flat\":\"102\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Алексей\",\"middleName\":\"Иванович\",\"birthDay\":\"1969-05-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"90629\",\"flat\":\"102\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1989-07-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"14363\",\"flat\":\"38\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Михаил\",\"middleName\":\"Козлович\",\"birthDay\":\"1989-07-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"14363\",\"flat\":\"38\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1992-12-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80159\",\"flat\":\"66\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1992-12-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80159\",\"flat\":\"66\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1982-05-14\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"76418\",\"flat\":\"69\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Сергей\",\"middleName\":\"Михайлович\",\"birthDay\":\"1982-05-14\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"76418\",\"flat\":\"69\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1966-08-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"63785\",\"flat\":\"185\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Михаил\",\"middleName\":\"Петрович\",\"birthDay\":\"1966-08-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"63785\",\"flat\":\"185\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1985-06-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"35007\",\"flat\":\"72\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Иван\",\"middleName\":\"Михайлович\",\"birthDay\":\"1985-06-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"35007\",\"flat\":\"72\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1966-07-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"78468\",\"flat\":\"85\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1966-07-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"78468\",\"flat\":\"85\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1959-10-28\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"40385\",\"flat\":\"40\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Михайлович\",\"birthDay\":\"1959-10-28\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"40385\",\"flat\":\"40\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1982-07-15\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"20633\",\"flat\":\"74\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1982-07-15\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"20633\",\"flat\":\"74\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1983-11-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"61366\",\"flat\":\"140\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1983-11-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"61366\",\"flat\":\"140\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1991-10-02\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"05236\",\"flat\":\"4\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Сергей\",\"middleName\":\"Михайлович\",\"birthDay\":\"1991-10-02\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"05236\",\"flat\":\"4\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1960-08-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01631\",\"flat\":\"93\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Петр\",\"middleName\":\"Козлович\",\"birthDay\":\"1960-08-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01631\",\"flat\":\"93\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1999-09-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"76893\",\"flat\":\"170\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Сергей\",\"middleName\":\"Козлович\",\"birthDay\":\"1999-09-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"76893\",\"flat\":\"170\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1966-01-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"72424\",\"flat\":\"98\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1966-01-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"72424\",\"flat\":\"98\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1977-06-24\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"04063\",\"flat\":\"82\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Михаил\",\"middleName\":\"Петрович\",\"birthDay\":\"1977-06-24\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"04063\",\"flat\":\"82\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-04-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"43443\",\"flat\":\"80\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Сергей\",\"middleName\":\"Петрович\",\"birthDay\":\"1969-04-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"43443\",\"flat\":\"80\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1950-11-03\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"83732\",\"flat\":\"46\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Иван\",\"middleName\":\"Иванович\",\"birthDay\":\"1950-11-03\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"83732\",\"flat\":\"46\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1958-04-03\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"91863\",\"flat\":\"47\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Иван\",\"middleName\":\"Михайлович\",\"birthDay\":\"1958-04-03\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"91863\",\"flat\":\"47\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1953-10-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"67751\",\"flat\":\"61\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Алексей\",\"middleName\":\"Иванович\",\"birthDay\":\"1953-10-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"67751\",\"flat\":\"61\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1988-01-28\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"14661\",\"flat\":\"58\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Михаил\",\"middleName\":\"Козлович\",\"birthDay\":\"1988-01-28\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"14661\",\"flat\":\"58\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-12-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"10812\",\"flat\":\"57\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1981-12-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"10812\",\"flat\":\"57\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1970-01-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"87418\",\"flat\":\"150\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Иванович\",\"birthDay\":\"1970-01-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"87418\",\"flat\":\"150\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1952-02-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"71225\",\"flat\":\"39\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Иван\",\"middleName\":\"Иванович\",\"birthDay\":\"1952-02-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"71225\",\"flat\":\"39\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1993-08-15\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80780\",\"flat\":\"188\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Иван\",\"middleName\":\"Михайлович\",\"birthDay\":\"1993-08-15\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80780\",\"flat\":\"188\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-07-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"17884\",\"flat\":\"138\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Петр\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1981-07-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"17884\",\"flat\":\"138\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1963-01-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"75966\",\"flat\":\"12\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Петр\",\"middleName\":\"Михайлович\",\"birthDay\":\"1963-01-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"75966\",\"flat\":\"12\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1962-11-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80065\",\"flat\":\"79\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Иванович\",\"birthDay\":\"1962-11-13\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"80065\",\"flat\":\"79\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1963-07-18\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"42476\",\"flat\":\"4\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Алексей\",\"middleName\":\"Иванович\",\"birthDay\":\"1963-07-18\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"42476\",\"flat\":\"4\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1961-12-18\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"34741\",\"flat\":\"200\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Иван\",\"middleName\":\"Козлович\",\"birthDay\":\"1961-12-18\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"34741\",\"flat\":\"200\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1998-06-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"46796\",\"flat\":\"144\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Петр\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1998-06-17\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"46796\",\"flat\":\"144\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1965-07-24\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"98293\",\"flat\":\"188\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Козлович\",\"birthDay\":\"1965-07-24\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"98293\",\"flat\":\"188\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1980-12-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"67475\",\"flat\":\"122\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1980-12-27\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"67475\",\"flat\":\"122\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-02-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"90604\",\"flat\":\"63\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Иван\",\"middleName\":\"Козлович\",\"birthDay\":\"1981-02-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"90604\",\"flat\":\"63\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1954-05-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"37669\",\"flat\":\"28\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1954-05-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"37669\",\"flat\":\"28\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-09-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"32425\",\"flat\":\"25\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Иван\",\"middleName\":\"Козлович\",\"birthDay\":\"1981-09-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"32425\",\"flat\":\"25\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1964-11-16\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"41589\",\"flat\":\"105\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Иван\",\"middleName\":\"Михайлович\",\"birthDay\":\"1964-11-16\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"41589\",\"flat\":\"105\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-12-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"06495\",\"flat\":\"32\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Петров\",\"firstName\":\"Петр\",\"middleName\":\"Петрович\",\"birthDay\":\"1969-12-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"06495\",\"flat\":\"32\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-01-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"58569\",\"flat\":\"79\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Петр\",\"middleName\":\"Иванович\",\"birthDay\":\"1969-01-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"58569\",\"flat\":\"79\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1983-01-11\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"39765\",\"flat\":\"162\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Козлович\",\"birthDay\":\"1983-01-11\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"39765\",\"flat\":\"162\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1956-07-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"24412\",\"flat\":\"118\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Петр\",\"middleName\":\"Михайлович\",\"birthDay\":\"1956-07-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"24412\",\"flat\":\"118\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-08-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"45511\",\"flat\":\"88\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Михаил\",\"middleName\":\"Иванович\",\"birthDay\":\"1981-08-20\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"45511\",\"flat\":\"88\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1951-12-02\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"19511\",\"flat\":\"53\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Сергей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1951-12-02\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"19511\",\"flat\":\"53\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1963-06-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"17982\",\"flat\":\"62\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Иван\",\"middleName\":\"Михайлович\",\"birthDay\":\"1963-06-22\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"17982\",\"flat\":\"62\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1960-11-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"52978\",\"flat\":\"30\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1960-11-06\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"52978\",\"flat\":\"30\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1966-01-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"75948\",\"flat\":\"49\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Иванович\",\"birthDay\":\"1966-01-25\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"75948\",\"flat\":\"49\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1986-06-02\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"23634\",\"flat\":\"64\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Сергей\",\"middleName\":\"Иванович\",\"birthDay\":\"1986-06-02\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"23634\",\"flat\":\"64\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1969-11-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"26792\",\"flat\":\"87\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Михаил\",\"middleName\":\"Иванович\",\"birthDay\":\"1969-11-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"26792\",\"flat\":\"87\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1956-09-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"70768\",\"flat\":\"108\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Иван\",\"middleName\":\"Петрович\",\"birthDay\":\"1956-09-07\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"70768\",\"flat\":\"108\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0410\\u043B\\u0435\\u043A\\u0441\\u0435\\u0439\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1998-07-14\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"18771\",\"flat\":\"178\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Алексей\",\"middleName\":\"Михайлович\",\"birthDay\":\"1998-07-14\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"18771\",\"flat\":\"178\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1999-02-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01147\",\"flat\":\"162\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Михаил\",\"middleName\":\"Петрович\",\"birthDay\":\"1999-02-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"01147\",\"flat\":\"162\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1959-02-10\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"45931\",\"flat\":\"179\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Иван\",\"middleName\":\"Михайлович\",\"birthDay\":\"1959-02-10\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"45931\",\"flat\":\"179\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0421\\u0438\\u0434\\u043E\\u0440\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1967-07-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"42295\",\"flat\":\"130\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Сидоров\",\"firstName\":\"Михаил\",\"middleName\":\"Петрович\",\"birthDay\":\"1967-07-19\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"42295\",\"flat\":\"130\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1961-11-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"14998\",\"flat\":\"185\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Сергей\",\"middleName\":\"Иванович\",\"birthDay\":\"1961-11-21\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"14998\",\"flat\":\"185\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041C\\u0438\\u0445\\u0430\\u0438\\u043B\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1963-08-11\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31521\",\"flat\":\"198\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Михаил\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1963-08-11\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"31521\",\"flat\":\"198\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1965-09-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"50495\",\"flat\":\"67\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Сергей\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1965-09-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"50495\",\"flat\":\"67\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0418\\u0432\\u0430\\u043D\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1950-05-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"96951\",\"flat\":\"179\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Иван\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1950-05-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"96951\",\"flat\":\"179\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1998-01-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"59966\",\"flat\":\"108\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Петр\",\"middleName\":\"Козлович\",\"birthDay\":\"1998-01-23\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"59966\",\"flat\":\"108\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u0418\\u0432\\u0430\\u043D\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1981-02-14\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"49056\",\"flat\":\"113\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Иванов\",\"firstName\":\"Сергей\",\"middleName\":\"Петрович\",\"birthDay\":\"1981-02-14\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"49056\",\"flat\":\"113\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041A\\u043E\\u0437\\u043B\\u043E\\u0432\",\"firstName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0439\",\"middleName\":\"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432\\u0438\\u0447\",\"birthDay\":\"1995-08-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"27045\",\"flat\":\"107\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Козлов\",\"firstName\":\"Сергей\",\"middleName\":\"Петрович\",\"birthDay\":\"1995-08-26\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"27045\",\"flat\":\"107\"}}"
},
{
"raw": "{\"fiodr\":{\"lastName\":\"\\u041C\\u0438\\u0445\\u0430\\u0439\\u043B\\u043E\\u0432\",\"firstName\":\"\\u041F\\u0435\\u0442\\u0440\",\"middleName\":\"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447\",\"birthDay\":\"1958-07-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"35022\",\"flat\":\"180\"}}",
"expected": "{\"fiodr\":{\"lastName\":\"Михайлов\",\"firstName\":\"Петр\",\"middleName\":\"Сергеевич\",\"birthDay\":\"1958-07-05\"},\"objectType\":\"addresses.addr_registration\",\"params\":{\"unom\":\"35022\",\"flat\":\"180\"}}"
}
]
+133
View File
@@ -0,0 +1,133 @@
// nolint:mnd
package helpers
import (
"unsafe"
"github.com/txix-open/isp-kit/json"
)
func UnescapeUnicodeJson(data []byte) []byte {
var body any
err := json.Unmarshal(data, &body)
if err != nil {
return data
}
newData, err := json.Marshal(body)
if err != nil {
return data
}
return newData
}
func UnescapeUnicode(data []byte) []byte {
n := len(data)
out := make([]byte, len(data)) // максимально возможный размер
j := 0 // индекс записи
for i := 0; i < n; {
if data[i] != '\\' {
// копируем весь блок до следующего '\'
start := i
for i < n && data[i] != '\\' {
i++
}
j += copy(out[j:], data[start:i])
continue
}
if isUnicodeEscape(data, i) {
r, consumed := decodeUnicodeEscape(data[i:])
if r >= 0 {
j = appendRuneAt(out, j, uint32(r))
i += consumed
continue
}
}
// обычный байт (одиночный '\')
out[j] = data[i]
j++
i++
}
return out[:j]
}
// Проверяет, начинается ли здесь \uXXXX
func isUnicodeEscape(data []byte, i int) bool {
return i+5 < len(data) && data[i] == '\\' && data[i+1] == 'u'
}
// Декодирует \uXXXX, учитывая суррогатную пару.
// Возвращает руну и сколько байт было прочитано.
func decodeUnicodeEscape(data []byte) (rune, int) {
v1, ok := parseHex4(data[2:6])
if !ok {
return -1, 1
}
// Проверка суррогатной пары
if 0xD800 <= v1 && v1 <= 0xDBFF && isUnicodeEscape(data, 6) {
v2, ok2 := parseHex4(data[8:12])
if ok2 && 0xDC00 <= v2 && v2 <= 0xDFFF {
r := 0x10000 + ((uint32(v1)-0xD800)<<10 | (uint32(v2) - 0xDC00))
return rune(r), 12
}
}
return rune(v1), 6
}
// Парсим 4 hex-символа через hexValue
func parseHex4(b []byte) (uint16, bool) {
v := uint16(0)
for _, c := range b {
h, ok := hexValue(c)
if !ok {
return 0, false
}
v = v<<4 | h
}
return v, true
}
func hexValue(b byte) (uint16, bool) {
switch {
case '0' <= b && b <= '9':
return uint16(b - '0'), true
case 'a' <= b && b <= 'f':
return uint16(b - 'a' + 10), true
case 'A' <= b && b <= 'F':
return uint16(b - 'A' + 10), true
default:
return 0, false
}
}
// appendRune добавляет руну в UTF-8
func appendRuneAt(buf []byte, j int, r uint32) int {
p := (*[4]byte)(unsafe.Pointer(&buf[j]))
switch {
case r < 0x80:
p[0] = byte(r)
return j + 1
case r < 0x800:
p[0] = 0xC0 | byte(r>>6)
p[1] = 0x80 | byte(r&0x3F)
return j + 2
case r < 0x10000:
p[0] = 0xE0 | byte(r>>12)
p[1] = 0x80 | byte((r>>6)&0x3F)
p[2] = 0x80 | byte(r&0x3F)
return j + 3
default:
p[0] = 0xF0 | byte(r>>18)
p[1] = 0x80 | byte((r>>12)&0x3F)
p[2] = 0x80 | byte((r>>6)&0x3F)
p[3] = 0x80 | byte(r&0x3F)
return j + 4
}
}
+36
View File
@@ -0,0 +1,36 @@
package helpers_test
import (
"isp-gate-service/helpers"
"testing"
)
// nolint:gochecknoglobals,lll
var (
rawUnicode = []byte(`{"fiodr":{"lastName":"\\u041F\\u0435\\u0442\\u0440\\u043E\\u0432","firstName":"\\u0418\\u0432\\u0430\\u043D","middleName":"\\u0421\\u0435\\u0440\\u0433\\u0435\\u0435\\u0432\\u0438\\u0447","birthDay":"1950-08-18"},"objectType":"addresses.addr_registration","params":{"unom":"63988","flat":"78"}}`)
rawAscii = []byte(`{"fiodr":{"lastName":"Петров","firstName":"Иван","middleName":"Сергеевич","birthDay":"1950-08-18"},"objectType":"addresses.addr_registration","params":{"unom":"63988","flat":"78"}}`)
)
func Benchmark_UnescapeUnicodeJson_Unicode(b *testing.B) {
for b.Loop() {
_ = helpers.UnescapeUnicodeJson(rawUnicode)
}
}
func Benchmark_UnescapeUnicodeJson_Anscii(b *testing.B) {
for b.Loop() {
_ = helpers.UnescapeUnicodeJson(rawAscii)
}
}
func Benchmark_UnescapeUnicode_Unicode(b *testing.B) {
for b.Loop() {
_ = helpers.UnescapeUnicode(rawUnicode)
}
}
func Benchmark_UnescapeUnicode_Anscii(b *testing.B) {
for b.Loop() {
_ = helpers.UnescapeUnicode(rawAscii)
}
}
+39
View File
@@ -0,0 +1,39 @@
package helpers_test
import (
"fmt"
"isp-gate-service/helpers"
"os"
"testing"
"github.com/txix-open/isp-kit/json"
"github.com/stretchr/testify/require"
)
func TestForceUnescapingUnicode(t *testing.T) {
t.Parallel()
type testCase struct {
Raw string
Expected string
}
data, err := os.ReadFile("./test_data/json_cases.json")
require.NoError(t, err)
var testCases []testCase
require.NoError(t, json.Unmarshal(data, &testCases))
for i, tt := range testCases {
t.Run(fmt.Sprintf("case_%d", i), func(t *testing.T) {
t.Parallel()
out := helpers.UnescapeUnicode([]byte(tt.Raw))
require.JSONEq(t, tt.Expected, string(out))
jsonOut := helpers.UnescapeUnicodeJson([]byte(tt.Raw))
require.JSONEq(t, tt.Expected, string(jsonOut))
})
}
}
+41
View File
@@ -0,0 +1,41 @@
package httperrors
import (
"net/http"
"github.com/txix-open/isp-kit/json"
)
type HttpError struct {
statusCode int
userMessage string
details []any
err error
}
func New(statusCode int, userMessage string, internalError error) *HttpError {
return &HttpError{
statusCode: statusCode,
userMessage: userMessage,
err: internalError,
}
}
func (e *HttpError) Error() string {
return e.err.Error()
}
func (e *HttpError) WriteError(w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(e.statusCode)
data := map[string]interface{}{
"errorCode": http.StatusText(e.statusCode),
"errorMessage": e.userMessage,
"details": e.details,
}
return json.NewEncoder(w).Encode(data)
}
func (e *HttpError) WithDetails(details ...any) {
e.details = details
}
-27
View File
@@ -1,27 +0,0 @@
package invoker
import (
"github.com/integration-system/isp-journal/rx"
"github.com/integration-system/isp-lib/v2/backend"
"github.com/integration-system/isp-lib/v2/structure"
"google.golang.org/grpc"
)
type journalService struct {
*rx.RxJournal
}
var (
journalClient = backend.NewRxGrpcClient(
backend.WithDialOptions(grpc.WithInsecure()),
)
Journal = &journalService{RxJournal: rx.NewDefaultRxJournal(journalClient)}
)
func (*journalService) ReceiveServiceAddressList(list []structure.AddressConfiguration) bool {
if ok := journalClient.ReceiveAddressList(list); !ok {
return false
}
go Journal.CollectAndTransferExistedLogs()
return true
}
-25
View File
@@ -1,25 +0,0 @@
package log_code
const (
WarnHttpServerShutdown = 602
ErrorHttpServerListen = 603
WarnProxyGrpcHandler = 604 //metadata: {"typeData":"", "method":""}
WarnConvertErrorDataMarshalResponse = 605
ErrorClientGrpc = 606
WarnJournalCouldNotWriteToFile = 607
ErrorClientJournal = 608
ErrorClientRedis = 609
ErrorClientHttp = 611
ErrorAuthenticate = 612
ErrorClientDatabase = 615
ErrorSnapshotAccounting = 616
ErrorUnloadAccounting = 617
ErrorWebsocketProxy = 618
)
-22
View File
@@ -1,22 +0,0 @@
package log_code
const (
MdTypeData = "typeData"
MdMethod = "method"
)
var (
TypeData = typeData{
SendMultipart: "sendMultipart",
GetFile: "getFile",
JsonContent: "jsonContent",
}
)
type (
typeData struct {
SendMultipart string
GetFile string
JsonContent string
}
)
+22 -90
View File
@@ -1,105 +1,37 @@
package main
import (
"context"
"os"
"github.com/integration-system/isp-lib/v2/bootstrap"
"github.com/integration-system/isp-lib/v2/config"
"github.com/integration-system/isp-lib/v2/config/schema"
"github.com/integration-system/isp-lib/v2/metric"
"github.com/integration-system/isp-lib/v2/structure"
"isp-gate-service/accounting"
"isp-gate-service/authenticate"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
"isp-gate-service/assembly"
"isp-gate-service/conf"
"isp-gate-service/invoker"
"isp-gate-service/model"
"isp-gate-service/proxy"
"isp-gate-service/redis"
"isp-gate-service/routing"
"isp-gate-service/server"
"isp-gate-service/service"
"isp-gate-service/service/matcher"
)
var (
version = "0.1.0"
version = "1.0.0"
)
func main() {
cfg := config.InitConfig(&conf.Configuration{}).(*conf.Configuration)
boot := bootstrap.New(version, conf.Remote{}, nil)
app := boot.App
logger := app.Logger()
bs := bootstrap.
ServiceBootstrap(&conf.Configuration{}, &conf.RemoteConfig{}).
OnLocalConfigLoad(onLocalConfigLoad).
DefaultRemoteConfigPath(schema.ResolveDefaultConfigPath("default_remote_config.json")).
DeclareMe(makeDeclaration).
SocketConfiguration(socketConfiguration).
RequireRoutes(handleRouteUpdate).
RequireModule("journal", invoker.Journal.ReceiveServiceAddressList, false).
SubscribeBroadcastEvent(bootstrap.ListenRestartEvent()).OnShutdown(onShutdown)
assembly, err := assembly.New(boot)
if err != nil {
logger.Fatal(app.Context(), err)
}
app.AddRunners(assembly.Runners()...)
app.AddClosers(assembly.Closers()...)
proxy.ApiPathPrefix = cfg.RouterConfig.PathPrefix
proxyConsumer := proxy.InitRoutingProxy(cfg.RouterConfig.SkipAuth, cfg.RouterConfig.SkipExistCheck)
bs.RequireModule(cfg.RouterConfig.RouterModuleName, proxyConsumer, true).
OnRemoteConfigReceive(onRemoteConfigReceive).
Run()
}
shutdown.On(func() {
logger.Info(app.Context(), "starting shutdown")
app.Shutdown()
logger.Info(app.Context(), "shutdown completed")
})
func onLocalConfigLoad(_ *conf.Configuration) {
}
func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) {
localCfg := config.Get().(*conf.Configuration)
model.DbClient.ReceiveConfiguration(remoteConfig.Database)
invoker.Journal.ReceiveConfiguration(remoteConfig.JournalSetting.Journal, localCfg.ModuleName)
matcher.JournalMethods = matcher.NewAtLeastOneMatcher(remoteConfig.JournalSetting.MethodsPatterns)
redis.Client.ReceiveConfiguration(remoteConfig.Redis)
authenticate.ReceiveConfiguration(remoteConfig.AuthCacheSetting)
accounting.ReceiveConfiguration(remoteConfig.AccountingSetting)
metric.InitCollectors(remoteConfig.Metrics, oldRemoteConfig.Metrics)
metric.InitHttpServer(remoteConfig.Metrics)
service.Metrics.Init()
server.Http.Init(remoteConfig.HttpSetting, oldRemoteConfig.HttpSetting)
}
func socketConfiguration(cfg interface{}) structure.SocketConfiguration {
appConfig := cfg.(*conf.Configuration)
return structure.SocketConfiguration{
Host: appConfig.ConfigServiceAddress.IP,
Port: appConfig.ConfigServiceAddress.Port,
Secure: false,
UrlParams: map[string]string{
"module_name": appConfig.ModuleName,
"instance_uuid": appConfig.InstanceUuid,
},
}
}
func onShutdown(_ context.Context, _ os.Signal) {
server.Http.Close()
accounting.Close()
proxy.Close()
_ = redis.Client.Close()
_ = invoker.Journal.Close()
}
func handleRouteUpdate(configs structure.RoutingConfig) bool {
routing.InitRoutes(configs)
return true
}
func makeDeclaration(localConfig interface{}) bootstrap.ModuleInfo {
cfg := localConfig.(*conf.Configuration)
return bootstrap.ModuleInfo{
ModuleName: cfg.ModuleName,
ModuleVersion: version,
GrpcOuterAddress: cfg.HttpOuterAddress,
Endpoints: []structure.EndpointDescriptor{},
err = app.Run()
if err != nil {
app.Shutdown()
logger.Fatal(app.Context(), err)
}
}
+48
View File
@@ -0,0 +1,48 @@
package middleware
import (
"context"
"net/http"
"isp-gate-service/domain"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
)
const (
adminAuthHeader = "x-auth-admin"
)
type AdminAuthenticator interface {
AdminAuthenticate(ctx context.Context, token string) (*domain.AdminAuthenticateResponse, error)
}
func AdminAuthenticate(auth AdminAuthenticator) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
adminToken := ctx.Param(adminAuthHeader)
if adminToken == "" {
return next.Handle(ctx)
}
resp, err := auth.AdminAuthenticate(ctx.Context(), adminToken)
if err != nil {
return httperrors.New(
http.StatusUnauthorized,
"invalid admin token",
errors.WithMessage(err, "admin authenticate: authenticate"),
)
}
if !resp.Authenticated {
return httperrors.New(
http.StatusUnauthorized,
"invalid admin token",
errors.WithMessage(errors.New(resp.ErrorReason), "admin authenticate: authenticate"),
)
}
ctx.AuthenticateAdmin(resp.AdminId, adminToken)
return next.Handle(ctx)
})
}
}
+60
View File
@@ -0,0 +1,60 @@
package middleware
import (
"context"
"net/http"
"github.com/pkg/errors"
"isp-gate-service/httperrors"
"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(store AdminMethodStore, authorizer AdminAuthorizer) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
isInner := store.IsInnerEndpoint(ctx.Endpoint())
if !isInner {
return next.Handle(ctx)
}
if !ctx.IsAdminAuthenticated() {
return httperrors.New(
http.StatusForbidden,
"admin authentication required",
errors.Errorf("admin authorization: admin authentication required for '%s'", ctx.Endpoint()),
)
}
requiredPerm, ok := store.RequiredAdminPermission(ctx.Endpoint())
if !ok {
return next.Handle(ctx)
}
ok, err := authorizer.AdminAuthorize(ctx.Context(), ctx.AdminId(), requiredPerm)
if err != nil {
return errors.WithMessage(err, "admin authorization: authorize")
}
if !ok {
return httperrors.New(
http.StatusForbidden,
"endpoint is not allowed",
errors.Errorf(
"admin authorization: endpoint '%s' requires '%s' permission, but admin '%d' doesn't have it",
ctx.Endpoint(), requiredPerm, ctx.AdminId(),
),
)
}
return next.Handle(ctx)
})
}
}
+86
View File
@@ -0,0 +1,86 @@
package middleware
import (
"context"
"net/http"
"isp-gate-service/domain"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
)
const (
applicationTokenHeader = "x-application-token"
)
type Authenticator interface {
Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error)
}
func Authenticate(authenticator Authenticator) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
token, appName, err := extractToken(ctx)
if err != nil {
return err
}
if token == "" {
return httperrors.New(
http.StatusUnauthorized,
"application token required",
errors.New("authenticate: application token required"),
)
}
resp, err := authenticator.Authenticate(ctx.Context(), token)
if err != nil {
return errors.WithMessage(err, "authenticate: authenticator error")
}
if !resp.Authenticated {
return httperrors.New(
http.StatusUnauthorized,
"invalid application token",
errors.Errorf("authenticate: %s", resp.ErrorReason),
)
}
if appName != "" && resp.AuthData.AppName != appName {
return httperrors.New(
http.StatusUnauthorized,
"invalid application token",
errors.New("authenticate: application name mismatch"),
)
}
ctx.Authenticate(request.AuthData(*resp.AuthData))
return next.Handle(ctx)
})
}
}
func extractToken(ctx *request.Context) (string, string, error) {
var (
appName string
token string
ok bool
)
token = ctx.Param(applicationTokenHeader)
if token != "" {
return token, "", nil
}
appName, token, ok = ctx.Request().BasicAuth()
if ok && appName == "" {
return "", "", httperrors.New(
http.StatusUnauthorized,
"application name required",
errors.New("authenticate: application name required on basic auth"),
)
}
return token, appName, nil
}
+49
View File
@@ -0,0 +1,49 @@
package middleware
import (
"context"
"net/http"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/log"
"isp-gate-service/httperrors"
"isp-gate-service/request"
)
type Authorizer interface {
Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error)
}
func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
authData, err := ctx.GetAuthData()
if err != nil {
return errors.WithMessage(err, "authorize: get auth data")
}
ok, err := authorizer.Authorize(ctx.Context(), authData.ApplicationId, ctx.Endpoint())
if err != nil {
return errors.WithMessage(err, "authorize: authorize")
}
if !ok && ctx.IsAdminAuthenticated() {
logger.Info(
ctx.Context(),
"bypassing unauthorized request because it has admin privilege",
log.Int("applicationId", authData.ApplicationId),
log.Int("adminId", ctx.AdminId()),
)
return next.Handle(ctx)
}
if !ok {
return httperrors.New(
http.StatusForbidden,
"endpoint is not allowed",
errors.Errorf("authorize: endpoint '%s' is not allowed for application '%d'", ctx.Endpoint(), authData.ApplicationId),
)
}
return next.Handle(ctx)
})
}
}
+39
View File
@@ -0,0 +1,39 @@
package middleware
import (
"context"
"net/http"
"github.com/pkg/errors"
"isp-gate-service/httperrors"
"isp-gate-service/request"
)
type DailyLimitChecker interface {
IncrementAndCheck(ctx context.Context, applicationId int) (bool, error)
}
func DailyLimit(checker DailyLimitChecker) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
authData, err := ctx.GetAuthData()
if err != nil {
return errors.WithMessage(err, "daily limit: get auth data")
}
ok, err := checker.IncrementAndCheck(ctx.Context(), authData.ApplicationId)
if err != nil {
return errors.WithMessage(err, "daily limit: increment and check")
}
if !ok {
return httperrors.New(
http.StatusTooManyRequests,
"daily requests limit has been reached",
errors.Errorf("daily limit: daily requests limit has been reached for application '%d'", authData.ApplicationId),
)
}
return next.Handle(ctx)
})
}
}
+37
View File
@@ -0,0 +1,37 @@
package middleware
import (
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/log"
"isp-gate-service/request"
"net/http"
)
type EntryPointConfig struct {
PathPrefix string
WithPrefix bool
}
type EndpointResolver interface {
ResolveEndpoint(path string, cfg EntryPointConfig) string
}
func Entrypoint(
maxReqBodySize int64,
next Handler,
cfg EntryPointConfig,
entryPointResolver EndpointResolver,
logger log.Logger,
) http.Handler {
return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize)
endpoint := entryPointResolver.ResolveEndpoint(req.URL.Path, cfg)
ctx := request.NewContext(req, writer, endpoint)
err := next.Handle(ctx)
if err != nil {
logger.Error(req.Context(), errors.WithMessage(err, "uncaught error"))
}
})
}
+35
View File
@@ -0,0 +1,35 @@
package middleware
import (
"net/http"
"github.com/txix-open/isp-kit/log"
"isp-gate-service/httperrors"
"isp-gate-service/request"
)
type HttpError interface {
WriteError(w http.ResponseWriter) error
}
func ErrorHandler(logger log.Logger) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
err := next.Handle(ctx)
if err == nil {
return nil
}
logger.Error(ctx.Context(), err)
httpErr, ok := err.(HttpError)
if ok {
return httpErr.WriteError(ctx.ResponseWriter())
}
return httperrors.
New(http.StatusInternalServerError, "internal service error", err).
WriteError(ctx.ResponseWriter())
})
}
}
+132
View File
@@ -0,0 +1,132 @@
package middleware
import (
"bufio"
"bytes"
"io"
"net"
"net/http"
"strings"
"isp-gate-service/helpers"
"isp-gate-service/request"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/http/endpoint/buffer"
"github.com/txix-open/isp-kit/log"
)
var (
unicodeEscapePrefix = []byte("\\u") // nolint:gochecknoglobals
)
type scSource interface {
StatusCode() int
}
type writerWrapper struct {
http.ResponseWriter
statusCode int
}
func (w *writerWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error) {
upstream, ok := w.ResponseWriter.(http.Hijacker)
if !ok {
return nil, nil, errors.New("writerWrapper: upstream writer doesn't implement Hijack")
}
return upstream.Hijack()
}
func (w *writerWrapper) StatusCode() int {
if w.statusCode == 0 {
return http.StatusOK
}
return w.statusCode
}
func (w *writerWrapper) WriteHeader(statusCode int) {
w.statusCode = statusCode
w.ResponseWriter.WriteHeader(statusCode)
}
func Logger( // nolint:gocognit
logger log.Logger,
enableRequestLogging bool,
enableBodyLogging bool,
skipBodyLoggingEndpointPrefixes []string,
enableForceUnescapingUnicode bool,
) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
if !enableRequestLogging {
return next.Handle(ctx)
}
r := ctx.Request()
logBodyFromCurrenRequest := enableBodyLogging
if logBodyFromCurrenRequest {
for _, prefix := range skipBodyLoggingEndpointPrefixes {
if strings.HasPrefix(ctx.Endpoint(), prefix) {
logBodyFromCurrenRequest = false
break
}
}
}
var scSrc scSource
var buf *buffer.Buffer
if logBodyFromCurrenRequest {
buf = buffer.Acquire(ctx.ResponseWriter())
defer buffer.Release(buf)
err := buf.ReadRequestBody(r.Body)
if err != nil {
return errors.WithMessage(err, "logger: read request body for logging")
}
err = r.Body.Close()
if err != nil {
return errors.WithMessage(err, "logger: close request reader")
}
r.Body = io.NopCloser(bytes.NewBuffer(buf.RequestBody()))
scSrc = buf
ctx.SetResponseWriter(buf)
} else {
writer := &writerWrapper{ResponseWriter: ctx.ResponseWriter()}
scSrc = writer
ctx.SetResponseWriter(writer)
}
originalPath := r.URL.Path //
// can be changed in http proxy
err := next.Handle(ctx)
authData, _ := ctx.GetAuthData()
fields := []log.Field{
log.String("httpMethod", r.Method),
log.String("remoteAddr", r.RemoteAddr),
log.String("xForwardedFor", r.Header.Get("X-Forwarded-For")),
log.Int("statusCode", scSrc.StatusCode()),
log.String("path", originalPath),
log.String("endpoint", ctx.Endpoint()),
log.Int("applicationId", authData.ApplicationId),
log.Int("adminId", ctx.AdminId()),
}
if logBodyFromCurrenRequest {
if enableForceUnescapingUnicode && bytes.Contains(buf.RequestBody(), unicodeEscapePrefix) {
fields = append(fields, log.ByteString("request", helpers.UnescapeUnicode(buf.RequestBody())))
} else {
fields = append(fields, log.ByteString("request", buf.RequestBody()))
}
fields = append(fields, log.ByteString("response", buf.ResponseBody()))
}
logger.Debug(ctx.Context(), "log request", fields...)
return err
})
}
}
+25
View File
@@ -0,0 +1,25 @@
package middleware
import (
"isp-gate-service/request"
)
type Handler interface {
Handle(ctx *request.Context) error
}
type HandlerFunc func(ctx *request.Context) error
func (f HandlerFunc) Handle(ctx *request.Context) error {
return f(ctx)
}
type Middleware func(next Handler) Handler
// nolint:ireturn
func Chain(root Handler, middlewares ...Middleware) Handler {
for i := len(middlewares) - 1; i >= 0; i-- {
root = middlewares[i](root)
}
return root
}
+40
View File
@@ -0,0 +1,40 @@
package middleware
import (
"strings"
"isp-gate-service/request"
"github.com/txix-open/isp-kit/log"
"github.com/txix-open/isp-kit/requestid"
)
const (
requestIdHeader = "x-request-id"
)
func RequestId(forwardClientRequestId bool, forwardReqIdByApp map[int]bool) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
requestId := requestid.Next()
clientRequestId := strings.TrimSpace(ctx.Request().Header.Get(requestIdHeader))
logFields := make([]log.Field, 0)
if clientRequestId != "" {
logFields = append(logFields, log.String("clientRequestId", clientRequestId))
authData, _ := ctx.GetAuthData()
if forwardClientRequestId || forwardReqIdByApp[authData.ApplicationId] {
requestId = clientRequestId
}
}
logFields = append(logFields, log.String("requestId", requestId))
context := requestid.ToContext(ctx.Context(), requestId)
context = log.ToContext(context, logFields...)
ctx.SetContext(context)
return next.Handle(ctx)
})
}
}
+41
View File
@@ -0,0 +1,41 @@
package middleware
import (
"context"
"fmt"
"net/http"
"github.com/pkg/errors"
"isp-gate-service/domain"
"isp-gate-service/httperrors"
"isp-gate-service/request"
)
type Throttler interface {
AllowRateLimit(ctx context.Context, applicationId int) (*domain.RateLimitResult, error)
}
func Throttling(throttler Throttler) Middleware {
return func(next Handler) Handler {
return HandlerFunc(func(ctx *request.Context) error {
authData, err := ctx.GetAuthData()
if err != nil {
return errors.WithMessage(err, "throttling: get auth data")
}
result, err := throttler.AllowRateLimit(ctx.Context(), authData.ApplicationId)
if err != nil {
return errors.WithMessage(err, "throttling: allow rate limit")
}
if !result.Allow {
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'", authData.ApplicationId),
)
}
return next.Handle(ctx)
})
}
}
-9
View File
@@ -1,9 +0,0 @@
-- +goose Up
CREATE TABLE snapshot(
app_id INTEGER PRIMARY KEY,
limit_state JSONB
);
-- +goose Down
DROP SCHEMA IF EXISTS gate_service CASCADE;
@@ -1,12 +0,0 @@
-- +goose Up
CREATE TABLE requests
(
id SERIAL8 PRIMARY KEY,
app_id INT4 NOT NULL,
method VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT now()
);
-- +goose Down
DROP TABLE requests;
@@ -1,6 +0,0 @@
-- +goose Up
ALTER TABLE snapshot
ADD version BIGINT NOT NULL DEFAULT 0;
-- +goose Down
-20
View File
@@ -1,20 +0,0 @@
package model
import (
"github.com/integration-system/isp-lib/v2/database"
log "github.com/integration-system/isp-log"
"isp-gate-service/log_code"
)
var (
DbClient = database.NewRxDbClient(
database.WithSchemaEnsuring(),
database.WithSchemaAutoInjecting(),
database.WithMigrationsEnsuring(),
database.WithInitializingErrorHandler(func(err *database.ErrorEvent) {
log.Error(log_code.ErrorClientDatabase, err)
}))
SnapshotRep SnapshotRepository = snapshotRepository{rxClient: DbClient}
RequestsRep RequestsRepository = requestsRepository{rxClient: DbClient}
)
-30
View File
@@ -1,30 +0,0 @@
package model
import (
"github.com/go-pg/pg/v9/orm"
"github.com/integration-system/isp-lib/v2/database"
"isp-gate-service/entity"
)
type (
RequestsRepository interface {
Insert([]entity.Request) error
}
requestsRepository struct {
DB orm.DB
rxClient *database.RxDbClient
}
)
func (r requestsRepository) Insert(model []entity.Request) error {
_, err := r.getDb().Model(&model).Insert()
return err
}
func (r requestsRepository) getDb() orm.DB {
if r.DB != nil {
return r.DB
}
return r.rxClient.Unsafe()
}
-50
View File
@@ -1,50 +0,0 @@
package model
import (
"github.com/go-pg/pg/v9"
"github.com/integration-system/isp-lib/v2/database"
"isp-gate-service/entity"
"github.com/go-pg/pg/v9/orm"
)
type (
SnapshotRepository interface {
GetByApplication(int32) (*entity.Snapshot, error)
Update([]entity.Snapshot) error
}
snapshotRepository struct {
DB orm.DB
rxClient *database.RxDbClient
}
)
func (r snapshotRepository) Update(list []entity.Snapshot) error {
_, err := r.getDb().Model(&list).OnConflict("(app_id) DO UPDATE").
Set("version = EXCLUDED.version").
Set("app_id = EXCLUDED.app_id").
Set("limit_state = EXCLUDED.limit_state").
Where("snapshot.version < EXCLUDED.version").
Insert()
return err
}
func (r snapshotRepository) GetByApplication(appId int32) (*entity.Snapshot, error) {
model := new(entity.Snapshot)
if err := r.getDb().Model(model).Where("app_id = ?", appId).Select(); err != nil {
if err == pg.ErrNoRows {
return nil, nil
}
return nil, err
} else {
return model, nil
}
}
func (r snapshotRepository) getDb() orm.DB {
if r.DB != nil {
return r.DB
}
return r.rxClient.Unsafe()
}
+5
View File
@@ -0,0 +1,5 @@
package proxy
const (
xAdminIdHeader = "x-admin-id"
)
+166
View File
@@ -0,0 +1,166 @@
// nolint:gochecknoinits
package proxy
import (
"context"
"io"
"net/http"
"strconv"
"time"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/grpc/client"
"github.com/txix-open/isp-kit/grpc/isp"
"github.com/txix-open/isp-kit/json"
"github.com/txix-open/isp-kit/requestid"
_ "google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
func init() {
for httpCode, grpcCode := range codeMap {
inverseCodeMap[grpcCode] = httpCode
}
}
var (
codeMap = map[int]codes.Code{
http.StatusOK: codes.OK,
http.StatusRequestTimeout: codes.Canceled,
http.StatusBadRequest: codes.InvalidArgument,
http.StatusGatewayTimeout: codes.DeadlineExceeded,
http.StatusNotFound: codes.NotFound,
http.StatusConflict: codes.AlreadyExists,
http.StatusForbidden: codes.PermissionDenied,
http.StatusUnauthorized: codes.Unauthenticated,
http.StatusTooManyRequests: codes.ResourceExhausted,
http.StatusPreconditionFailed: codes.FailedPrecondition,
http.StatusNotImplemented: codes.Unimplemented,
http.StatusInternalServerError: codes.Internal,
http.StatusServiceUnavailable: codes.Unavailable,
}
inverseCodeMap = map[codes.Code]int{}
)
type Grpc struct {
cli *client.Client
skipAuth bool
timeout time.Duration
}
func NewGrpc(cli *client.Client, skipAuth bool, timeout time.Duration) Grpc {
return Grpc{
cli: cli,
skipAuth: skipAuth,
timeout: timeout,
}
}
func (p Grpc) Handle(ctx *request.Context) error {
body, err := io.ReadAll(ctx.Request().Body)
if err != nil {
return errors.WithMessage(err, "grpc: read body")
}
requestId := requestid.FromContext(ctx.Context())
md := metadata.MD{
grpc.ProxyMethodNameHeader: {ctx.Endpoint()},
requestid.Header: {requestId},
}
if !p.skipAuth {
authData, err := ctx.GetAuthData()
if err != nil {
return errors.WithMessage(err, "get auth data")
}
md[grpc.SystemIdHeader] = []string{strconv.Itoa(authData.SystemId)}
md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)}
md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)}
md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)}
if ctx.IsAdminAuthenticated() {
md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())}
}
}
requestContext := metadata.NewOutgoingContext(ctx.Context(), md)
requestContext, cancel := context.WithTimeout(requestContext, p.timeout)
defer cancel()
result, err := p.cli.BackendClient().Request(requestContext, &isp.Message{
Body: &isp.Message_BytesBody{BytesBody: body},
})
if err != nil {
return p.handleError(err, ctx.ResponseWriter(), ctx.Endpoint())
}
return p.writeResponse(http.StatusOK, result.GetBytesBody(), requestId, ctx.ResponseWriter())
}
func (p Grpc) handleError(err error, w http.ResponseWriter, endpoint string) error {
status, ok := status.FromError(err)
if !ok {
return httperrors.New(
http.StatusServiceUnavailable,
"upstream is not available",
errors.WithMessage(err, "grpc proxy"),
)
}
statusCode := p.codeToHttpStatus(status.Code())
for _, detail := range status.Details() {
switch typeOfDetail := detail.(type) {
case *isp.Message:
switch {
case typeOfDetail.GetBytesBody() != nil:
return p.writeResponse(statusCode, typeOfDetail.GetBytesBody(), "", w)
case typeOfDetail.GetListBody() != nil:
return p.writeProto(statusCode, typeOfDetail.GetListBody(), w)
case typeOfDetail.GetStructBody() != nil:
return p.writeProto(statusCode, typeOfDetail.GetStructBody(), w)
}
default:
return p.writeProto(statusCode, typeOfDetail, w)
}
}
return httperrors.New(
statusCode,
status.Message(),
errors.WithMessagef(err, "isp-routing-service: proxy '%s'", endpoint),
)
}
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")
}
return p.writeResponse(statusCode, data, "", w)
}
func (p Grpc) writeResponse(statusCode int, data []byte, requestId string, w http.ResponseWriter) error {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
if requestId != "" {
w.Header().Set(requestid.Header, requestId)
}
w.WriteHeader(statusCode)
_, err := w.Write(data)
if err != nil {
return errors.WithMessage(err, "response write")
}
return nil
}
func (p Grpc) codeToHttpStatus(code codes.Code) int {
s, ok := inverseCodeMap[code]
if !ok {
return http.StatusInternalServerError
}
return s
}
+114
View File
@@ -0,0 +1,114 @@
package proxy
import (
"fmt"
"net"
"net/http"
"net/http/httputil"
"net/url"
"strconv"
"time"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/requestid"
"golang.org/x/net/context"
)
var (
httpTransport = &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: defaultTransportDialContext(&net.Dialer{
Timeout: 3 * time.Second,
KeepAlive: 30 * time.Second,
}),
ForceAttemptHTTP2: true,
MaxIdleConns: 512,
MaxIdleConnsPerHost: 32,
IdleConnTimeout: 60 * time.Second,
TLSHandshakeTimeout: 5 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
)
type HttpHostManager interface {
Next() (string, error)
}
type Http struct {
hostManager HttpHostManager
skipAuth bool
timeout time.Duration
}
func NewHttp(hostManager HttpHostManager, skipAuth bool, timeout time.Duration) Http {
return Http{
hostManager: hostManager,
skipAuth: skipAuth,
timeout: timeout,
}
}
func (p Http) Handle(ctx *request.Context) error {
host, err := p.hostManager.Next()
if err != nil {
return errors.WithMessage(err, "http: next host")
}
rawUrl := fmt.Sprintf("http://%s", host) // secure HTTP links are reset connection
target, err := url.Parse(rawUrl)
if err != nil {
return errors.WithMessage(err, "http: parse url")
}
request := ctx.Request()
request.URL.Path = ctx.Endpoint()
err = setHttpHeaders(ctx, request.Header, p.skipAuth)
if err != nil {
return err
}
reverseProxy := httputil.NewSingleHostReverseProxy(target)
reverseProxy.Transport = httpTransport
var resultError error
reverseProxy.ErrorHandler = func(writer http.ResponseWriter, request *http.Request, err error) {
resultError = httperrors.New(
http.StatusServiceUnavailable,
"upstream is not available",
errors.WithMessagef(err, "http proxy to %s", host),
)
}
context, cancel := context.WithTimeout(request.Context(), p.timeout)
defer cancel()
request = request.WithContext(context)
reverseProxy.ServeHTTP(ctx.ResponseWriter(), request)
return resultError
}
func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) error {
header.Set(requestid.Header, requestid.FromContext(ctx.Context()))
if !skipAuth {
authData, err := ctx.GetAuthData()
if err != nil {
return errors.WithMessage(err, "http: get auth data")
}
header.Set(grpc.SystemIdHeader, strconv.Itoa(authData.SystemId))
header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId))
header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId))
header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId))
if ctx.IsAdminAuthenticated() {
header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader
} else {
header.Del(xAdminIdHeader) //nolint:canonicalheader
}
}
return nil
}
func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) {
return dialer.DialContext
}
-86
View File
@@ -1,86 +0,0 @@
package http
import (
"errors"
"net"
"strings"
"github.com/integration-system/isp-lib/v2/structure"
log "github.com/integration-system/isp-log"
"github.com/valyala/fasthttp"
"google.golang.org/grpc/codes"
"isp-gate-service/domain"
"isp-gate-service/log_code"
"isp-gate-service/utils"
)
var (
errNotInitialized = errors.New("http proxy not initialized")
)
type HttpProxy struct {
client *fasthttp.HostClient
skipAuth bool
skipExistCheck bool
}
func NewProxy(skipAuth, skipExistCheck bool) *HttpProxy {
return &HttpProxy{client: nil, skipAuth: skipAuth, skipExistCheck: skipExistCheck}
}
func (p *HttpProxy) Consumer(addressList []structure.AddressConfiguration) bool {
if len(addressList) == 0 {
p.client = nil
return true
}
addresses := make([]string, len(addressList))
for key, addr := range addressList {
addresses[key] = addr.GetAddress()
}
p.client = &fasthttp.HostClient{
Addr: strings.Join(addresses, `,`),
}
return true
}
func (p *HttpProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.ProxyResponse {
client := p.client
if client == nil {
log.Error(log_code.ErrorClientHttp, errNotInitialized)
utils.WriteError(ctx, errNotInitialized.Error(), codes.Internal, nil)
return domain.Create().
SetRequestBody(ctx.Request.Body()).
SetResponseBody(ctx.Response.Body()).
SetError(errNotInitialized)
}
req := &ctx.Request
res := &ctx.Response
req.URI().SetPath("/" + path)
if addr, _, err := net.SplitHostPort(ctx.RemoteAddr().String()); err == nil {
req.Header.Add("X-Forwarded-For", addr)
}
err := client.Do(req, res)
if err != nil {
log.Error(log_code.ErrorClientHttp, err)
}
return domain.Create().
SetRequestBody(ctx.Request.Body()).
SetResponseBody(ctx.Response.Body()).
SetError(err)
}
func (p *HttpProxy) SkipAuth() bool {
return p.skipAuth
}
func (p *HttpProxy) SkipExistCheck() bool {
return p.skipExistCheck
}
func (p *HttpProxy) Close() {
p.client = nil
}
-45
View File
@@ -1,45 +0,0 @@
package proxy
import (
"strings"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/valyala/fasthttp"
"isp-gate-service/domain"
"isp-gate-service/proxy/http"
)
var (
RoutingProxy *http.HttpProxy
ApiPathPrefix string
)
type (
Proxy interface {
ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.ProxyResponse
Consumer([]structure.AddressConfiguration) bool
SkipAuth() bool
SkipExistCheck() bool
Close()
}
)
func InitRoutingProxy(skipAuth bool, skipExistCheck bool) func(list []structure.AddressConfiguration) bool {
RoutingProxy = http.NewProxy(skipAuth, skipExistCheck)
return func(list []structure.AddressConfiguration) bool {
RoutingProxy.Consumer(list)
return true
}
}
func GetPathWithoutApiPrefix(initialPath string) string {
s := strings.TrimPrefix(initialPath, ApiPathPrefix)
if len(s) > 0 && s[0] == '/' {
return s[1:]
}
return s
}
func Close() {
RoutingProxy.Close()
}
+70
View File
@@ -0,0 +1,70 @@
package proxy
import (
"fmt"
"net/http"
"net/url"
"time"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
"github.com/tomakado/websocketproxy"
"isp-gate-service/httperrors"
"isp-gate-service/request"
)
type Ws struct {
hostManager HttpHostManager
skipAuth bool
}
func NewWs(hostManager HttpHostManager, skipAuth bool) Ws {
return Ws{
hostManager: hostManager,
skipAuth: skipAuth,
}
}
func (ws Ws) Handle(ctx *request.Context) error {
host, err := ws.hostManager.Next()
if err != nil {
return errors.WithMessage(err, "ws: next host")
}
rawUrl := fmt.Sprintf("ws://%s", host)
target, err := url.Parse(rawUrl)
if err != nil {
return errors.WithMessage(err, "ws: parse url")
}
request := ctx.Request()
request.URL.Path = ctx.Endpoint()
var resultError error
proxy := websocketproxy.NewProxy(target)
proxy.Director = func(incoming *http.Request, out http.Header) {
_ = setHttpHeaders(ctx, out, ws.skipAuth)
}
proxy.Upgrader = &websocket.Upgrader{
HandshakeTimeout: 5 * time.Second,
ReadBufferSize: 1024,
WriteBufferSize: 1024,
WriteBufferPool: nil,
Subprotocols: nil,
Error: func(w http.ResponseWriter, r *http.Request, status int, reason error) {
resultError = httperrors.New(
http.StatusServiceUnavailable,
"upstream is not available",
errors.WithMessagef(reason, "ws proxy to %s", host),
)
},
CheckOrigin: func(r *http.Request) bool {
return true
},
EnableCompression: false,
}
proxy.ServeHTTP(ctx.ResponseWriter(), ctx.Request())
return resultError
}
-16
View File
@@ -1,16 +0,0 @@
package redis
import (
rd "github.com/integration-system/isp-lib/v2/redis"
log "github.com/integration-system/isp-log"
"isp-gate-service/log_code"
)
var (
Client = rd.NewRxClient(
rd.WithInitHandler(func(c *rd.Client, err error) {
if err != nil {
log.Fatal(log_code.ErrorClientRedis, err)
}
}))
)
+48
View File
@@ -0,0 +1,48 @@
// nolint:dupl
package repository
import (
"context"
"isp-gate-service/domain"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/client"
)
const (
adminAuthenticate = "admin/secure/authenticate"
adminAuthorize = "admin/secure/authorize"
)
type Admin struct {
cli *client.Client
}
func NewAdmin(cli *client.Client) Admin {
return Admin{cli: cli}
}
func (r Admin) Authenticate(ctx context.Context, token string) (*domain.AdminAuthenticateResponse, error) {
resp := domain.AdminAuthenticateResponse{}
err := r.cli.Invoke(adminAuthenticate).
JsonRequestBody(domain.AuthenticateRequest{Token: token}).
JsonResponseBody(&resp).
Do(ctx)
if err != nil {
return nil, errors.WithMessagef(err, "grpc client invoke %s", adminAuthenticate)
}
return &resp, nil
}
func (r Admin) Authorize(ctx context.Context, adminId int, permission string) (bool, error) {
resp := domain.AdminAuthorizeResponse{}
err := r.cli.Invoke(adminAuthorize).
JsonRequestBody(domain.AdminAuthorizeRequest{AdminId: adminId, Permission: permission}).
JsonResponseBody(&resp).
Do(ctx)
if err != nil {
return false, errors.WithMessagef(err, "grpc client invoke: %s", adminAuthorize)
}
return resp.Authorized, nil
}
+49
View File
@@ -0,0 +1,49 @@
package repository
import (
"context"
"time"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/json"
"isp-gate-service/cache"
"isp-gate-service/domain"
)
type AuthenticationCache struct {
cache *cache.Cache
duration time.Duration
}
func NewAuthenticationCache(duration time.Duration) AuthenticationCache {
return AuthenticationCache{
duration: duration,
cache: cache.New(),
}
}
func (r AuthenticationCache) Get(ctx context.Context, token string) (*domain.AuthData, error) {
data, ok := r.cache.Get(token)
if !ok {
return nil, domain.ErrAuthenticationCacheMiss
}
result := domain.AuthData{}
err := json.Unmarshal(data, &result)
if err != nil {
return nil, errors.WithMessage(err, "json unmarshal auth data")
}
return &result, nil
}
func (r AuthenticationCache) Set(ctx context.Context, token string, data domain.AuthData) error {
value, err := json.Marshal(data)
if err != nil {
return errors.WithMessage(err, "json marshal auth data")
}
r.cache.Set(token, value, r.duration)
return nil
}
+37
View File
@@ -0,0 +1,37 @@
package repository
import (
"context"
"fmt"
"time"
"isp-gate-service/cache"
)
type AuthorizationCache struct {
duration time.Duration
cache *cache.Cache
}
func NewAuthorizationCache(duration time.Duration) *AuthorizationCache {
return &AuthorizationCache{
duration: duration,
cache: cache.New(),
}
}
func (r AuthorizationCache) Get(ctx context.Context, id int, endpoint string) (bool, error) {
key := r.key(id, endpoint)
_, ok := r.cache.Get(key)
return ok, nil
}
func (r AuthorizationCache) SetAuthorized(ctx context.Context, id int, endpoint string) error {
key := r.key(id, endpoint)
r.cache.Set(key, nil, r.duration)
return nil
}
func (r AuthorizationCache) key(id int, endpoint string) string {
return fmt.Sprintf("%d:%s", id, endpoint)
}
+58
View File
@@ -0,0 +1,58 @@
package repository
import (
"context"
"time"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/client"
"isp-gate-service/entity"
)
const (
incrementEndpoint = "isp-lock-service/daily_limit/increment"
rateLimitEndpoint = "isp-lock-service/rate_limit"
)
type Locker struct {
cli *client.Client
}
func NewLocker(cli *client.Client) Locker {
return Locker{
cli: cli,
}
}
func (r Locker) Increment(ctx context.Context, key string, today time.Time) (int64, error) {
resp := new(entity.IncrementResponse)
err := r.cli.Invoke(incrementEndpoint).
JsonRequestBody(entity.IncrementRequest{
Key: key,
Today: today,
}).
JsonResponseBody(resp).
Do(ctx)
switch {
case err != nil:
return 0, errors.WithMessagef(err, "invoke isp-lock-service: '%s'", incrementEndpoint)
default:
return int64(resp.Value), nil //nolint:gosec
}
}
func (r Locker) IsAllowRequestPerSecond(ctx context.Context, key string, rate int) (*entity.RateLimiterResponse, error) {
resp := new(entity.RateLimiterResponse)
err := r.cli.Invoke(rateLimitEndpoint).
JsonRequestBody(entity.RateLimiterRequest{
Key: key,
MaxRps: rate,
}).
JsonResponseBody(resp).
Do(ctx)
if err != nil {
return nil, errors.WithMessagef(err, "invoke isp-lock-service: '%s'", rateLimitEndpoint)
}
return resp, nil
}
+49
View File
@@ -0,0 +1,49 @@
// nolint:dupl
package repository
import (
"context"
"github.com/pkg/errors"
"github.com/txix-open/isp-kit/grpc/client"
"isp-gate-service/domain"
)
const (
authenticate = "system/secure/authenticate"
authorize = "system/secure/authorize"
)
type System struct {
cli *client.Client
}
func NewSystem(cli *client.Client) System {
return System{
cli: cli,
}
}
func (r System) Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error) {
resp := domain.AuthenticateResponse{}
err := r.cli.Invoke(authenticate).
JsonRequestBody(domain.AuthenticateRequest{Token: token}).
JsonResponseBody(&resp).
Do(ctx)
if err != nil {
return nil, errors.WithMessagef(err, "grpc client invoke: %s", authenticate)
}
return &resp, nil
}
func (r System) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) {
resp := domain.AuthorizeResponse{}
err := r.cli.Invoke(authorize).
JsonRequestBody(domain.AuthorizeRequest{ApplicationId: applicationId, Endpoint: endpoint}).
JsonResponseBody(&resp).
Do(ctx)
if err != nil {
return false, errors.WithMessagef(err, "grpc client invoke: %s", authorize)
}
return resp.Authorized, nil
}
+76
View File
@@ -0,0 +1,76 @@
package unused
import (
"context"
"time"
"isp-gate-service/domain"
"github.com/pkg/errors"
"github.com/redis/go-redis/v9"
"github.com/txix-open/isp-kit/json"
)
type RedisAuthCache struct {
cli redis.UniversalClient
duration time.Duration
db int
}
func NewRedisAuthCache(cli redis.UniversalClient, duration time.Duration, db int) RedisAuthCache {
return RedisAuthCache{
cli: cli,
duration: duration,
db: db,
}
}
func (r RedisAuthCache) Get(ctx context.Context, token string) (*domain.AuthData, error) {
results, err := r.cli.Pipelined(ctx, func(p redis.Pipeliner) error {
p.Select(ctx, r.db)
p.Get(ctx, token)
return nil
})
if err != nil && !errors.Is(err, redis.Nil) {
return nil, errors.WithMessage(err, "pipelined")
}
data, err := results[1].(*redis.StringCmd).Result() // nolint: forcetypeassert
if errors.Is(err, redis.Nil) {
return nil, domain.ErrAuthenticationCacheMiss
}
if err != nil {
return nil, errors.WithMessage(err, "get")
}
result := domain.AuthData{}
err = json.Unmarshal([]byte(data), &result)
if err != nil {
return nil, errors.WithMessage(err, "json unmarshal auth data")
}
return &result, nil
}
func (r RedisAuthCache) Set(ctx context.Context, token string, data domain.AuthData) error {
value, err := json.Marshal(data)
if err != nil {
return errors.WithMessage(err, "json marshal auth data")
}
results, err := r.cli.Pipelined(ctx, func(p redis.Pipeliner) error {
p.Select(ctx, r.db)
p.SetEx(ctx, token, string(value), r.duration)
return nil
})
if err != nil {
return errors.WithMessage(err, "pipelined")
}
err = results[1].Err()
if err != nil {
return errors.WithMessage(err, "set ex")
}
return nil
}
+66
View File
@@ -0,0 +1,66 @@
package unused
import (
"context"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/redis/go-redis/v9"
)
type RedisAuthzCache struct {
cli redis.UniversalClient
duration time.Duration
db int
}
func NewRedisAuthzCache(cli redis.UniversalClient, duration time.Duration, db int) *RedisAuthzCache {
return &RedisAuthzCache{
cli: cli,
duration: duration,
db: db,
}
}
func (r RedisAuthzCache) Get(ctx context.Context, applicationId int, endpoint string) (bool, error) {
result, err := r.cli.Pipelined(ctx, func(p redis.Pipeliner) error {
p.Select(ctx, r.db)
p.Get(ctx, r.key(applicationId, endpoint))
return nil
})
if err != nil && !errors.Is(err, redis.Nil) {
return false, errors.WithMessage(err, "pipelined")
}
_, err = result[1].(*redis.StringCmd).Result() // nolint: forcetypeassert
if errors.Is(err, redis.Nil) {
return false, nil
}
if err != nil {
return false, errors.WithMessage(err, "get")
}
return true, nil
}
func (r RedisAuthzCache) SetAuthorized(ctx context.Context, applicationId int, endpoint string) error {
result, err := r.cli.Pipelined(ctx, func(p redis.Pipeliner) error {
p.Select(ctx, r.db)
p.SetEx(ctx, r.key(applicationId, endpoint), "authorized", r.duration)
return nil
})
if err != nil {
return errors.WithMessage(err, "pipelined")
}
err = result[1].Err()
if err != nil {
return errors.WithMessage(err, "set ex")
}
return nil
}
func (r RedisAuthzCache) key(applicationId int, endpoint string) string {
return fmt.Sprintf("%d:%s", applicationId, endpoint)
}
+120
View File
@@ -0,0 +1,120 @@
package request
import (
"context"
"net/http"
"strings"
"github.com/pkg/errors"
)
var (
ErrNotAuthenticated = errors.New("not authenticated")
)
type AuthData struct {
AppName string
SystemId int
DomainId int
ServiceId int
ApplicationId int
}
type Context struct {
request *http.Request
responseWriter http.ResponseWriter
endpoint string
authenticated bool
authData *AuthData
adminAuthenticated bool
adminId int
adminToken string
queryParams map[string]string
}
func NewContext(request *http.Request, response http.ResponseWriter, endpoint string) *Context {
return &Context{
request: request,
responseWriter: response,
endpoint: endpoint,
}
}
func (c *Context) Request() *http.Request {
return c.request
}
func (c *Context) ResponseWriter() http.ResponseWriter {
return c.responseWriter
}
func (c *Context) SetResponseWriter(writer http.ResponseWriter) {
c.responseWriter = writer
}
func (c *Context) Endpoint() string {
return c.endpoint
}
func (c *Context) Authenticate(authData AuthData) {
c.authenticated = true
c.authData = &authData
}
func (c *Context) GetAuthData() (AuthData, error) {
if !c.authenticated {
return AuthData{}, ErrNotAuthenticated
}
return *c.authData, nil
}
func (c *Context) IsAdminAuthenticated() bool {
return c.adminAuthenticated
}
func (c *Context) AdminId() int {
return c.adminId
}
func (c *Context) AdminToken() string {
return c.adminToken
}
func (c *Context) AuthenticateAdmin(adminId int, adminToken string) {
c.adminAuthenticated = true
c.adminId = adminId
c.adminToken = adminToken
}
func (c *Context) Context() context.Context {
return c.request.Context()
}
func (c *Context) SetContext(ctx context.Context) {
c.request = c.request.WithContext(ctx)
}
func (c *Context) Param(name string) string {
value := c.request.Header.Get(name)
if value != "" {
return strings.TrimSpace(value)
}
if c.queryParams == nil {
query := c.request.URL.Query()
c.queryParams = map[string]string{}
for key, values := range query {
if len(values) == 0 {
continue
}
c.queryParams[strings.ToLower(key)] = values[0]
}
}
value = c.queryParams[strings.ToLower(name)]
return strings.TrimSpace(value)
}
+86
View File
@@ -0,0 +1,86 @@
package routes
import (
"context"
"fmt"
"isp-gate-service/middleware"
"strings"
"github.com/txix-open/isp-kit/cluster"
)
type Routes struct {
allEndpoints map[string]bool
innerEndpoints map[string]bool
requiredPermissions map[string]string
}
func NewRoutes() *Routes {
return &Routes{
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 {
newAllEndpoints := make(map[string]bool)
newInnerMethods := make(map[string]bool)
newRequiredPermissions := make(map[string]string)
for _, backend := range routes {
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.allEndpoints = newAllEndpoints
s.innerEndpoints = newInnerMethods
s.requiredPermissions = newRequiredPermissions
return nil
}
func (s *Routes) ResolveEndpoint(path string, cfg middleware.EntryPointConfig) string {
if cfg.WithPrefix {
return path
}
prefix := fmt.Sprintf("%s/", cfg.PathPrefix)
noPrefixPath := strings.TrimPrefix(path, prefix)
ok := s.allEndpoints[noPrefixPath]
if ok {
return noPrefixPath
}
invertedLeadingSlash := invertLeadingSlash(noPrefixPath)
ok = s.allEndpoints[invertedLeadingSlash]
if ok {
return invertedLeadingSlash
}
return noPrefixPath // pdp-webapi-service(анонсирует вот такой ендпоинт GET /api/:token/profile/me/:blocks) hack =(
}
func (s *Routes) IsInnerEndpoint(endpoint string) bool {
return s.innerEndpoints[endpoint]
}
func (s *Routes) RequiredAdminPermission(endpoint string) (string, bool) {
perm, ok := s.requiredPermissions[endpoint]
return perm, ok
}
func invertLeadingSlash(path string) string {
path, withoutSlash := strings.CutPrefix(path, "/")
if withoutSlash {
return path
}
return "/" + path
}
-56
View File
@@ -1,56 +0,0 @@
package routing
import (
"github.com/integration-system/isp-lib/v2/structure"
)
var (
InnerMethods = make(map[string]bool)
AllMethods = make(map[string]bool)
AuthUserMethods = make(map[string]bool)
)
func InitRoutes(configs structure.RoutingConfig) {
newAddressMap := make(map[string]bool)
newInnerAddressMap := make(map[string]bool)
newAuthUserAddressMap := make(map[string]bool)
for i := range configs {
backend := &configs[i]
if backend.Address.IP == "" {
continue
}
if len(backend.HandlersInfo) == 0 {
if len(backend.Endpoints) == 0 || backend.Address.Port == "" {
continue
}
addEndpointsToMaps(backend.Endpoints, "", newAddressMap, newInnerAddressMap, newAuthUserAddressMap)
} else {
for _, info := range backend.HandlersInfo {
if info.Port != "" {
addEndpointsToMaps(info.Endpoints, info.PathPrefix, newAddressMap, newInnerAddressMap, newAuthUserAddressMap)
}
}
}
}
AllMethods = newAddressMap
InnerMethods = newInnerAddressMap
AuthUserMethods = newAuthUserAddressMap
}
func addEndpointsToMaps(endpoints []structure.EndpointDescriptor,
pathPrefix string, newAddressMap map[string]bool,
newInnerAddressMap map[string]bool,
newAuthUserAddressMap map[string]bool) {
for _, el := range endpoints {
if pathPrefix != "" {
el.Path = pathPrefix + "/" + el.Path
}
newAddressMap[el.Path] = true
if el.Inner {
newInnerAddressMap[el.Path] = true
}
if el.UserAuthRequired {
newAuthUserAddressMap[el.Path] = true
}
}
}
-66
View File
@@ -1,66 +0,0 @@
package server
import (
"github.com/integration-system/go-cmp/cmp"
"github.com/integration-system/isp-lib/v2/config"
log "github.com/integration-system/isp-log"
"github.com/valyala/fasthttp"
"isp-gate-service/conf"
"isp-gate-service/handler"
"isp-gate-service/log_code"
"sync"
"time"
)
const defaultTimeout = 60 * time.Second
var Http = &httpSrv{mx: sync.Mutex{}}
type httpSrv struct {
working bool
srv *fasthttp.Server
mx sync.Mutex
}
func (s *httpSrv) Init(new, old conf.HttpSetting) {
if s.working {
if !cmp.Equal(new, old) {
s.run(new.GetMaxRequestBodySize())
}
} else {
s.run(new.GetMaxRequestBodySize())
}
}
func (s *httpSrv) run(maxRequestBodySize int64) {
s.mx.Lock()
s.working = true
if s.srv != nil {
if err := s.srv.Shutdown(); err != nil {
log.Warn(log_code.WarnHttpServerShutdown, err)
}
}
localConfig := config.Get().(*conf.Configuration)
restAddress := localConfig.HttpInnerAddress.GetAddress()
s.srv = &fasthttp.Server{
Handler: handler.CompleteRequest,
WriteTimeout: defaultTimeout,
ReadTimeout: defaultTimeout,
MaxRequestBodySize: int(maxRequestBodySize),
}
go func() {
if err := s.srv.ListenAndServe(restAddress); err != nil {
log.Error(log_code.ErrorHttpServerListen, err)
}
}()
s.mx.Unlock()
}
func (s *httpSrv) Close() {
if s.srv != nil {
s.working = false
if err := s.srv.Shutdown(); err != nil {
log.Warn(log_code.WarnHttpServerShutdown, err)
}
}
}
+57
View File
@@ -0,0 +1,57 @@
package service
import (
"context"
"isp-gate-service/domain"
"github.com/pkg/errors"
)
type AdminAuth interface {
Authenticate(ctx context.Context, token string) (*domain.AdminAuthenticateResponse, error)
Authorize(ctx context.Context, adminId int, permission string) (bool, error)
}
type Admin struct {
cache AuthorizationCache
repo AdminAuth
}
func NewAdmin(cache AuthorizationCache, adminAuth AdminAuth) Admin {
return Admin{
cache: cache,
repo: adminAuth,
}
}
func (s Admin) AdminAuthenticate(ctx context.Context, token string) (*domain.AdminAuthenticateResponse, error) {
resp, err := s.repo.Authenticate(ctx, token)
if err != nil {
return nil, errors.WithMessage(err, "get admin token data from admin service")
}
return resp, nil
}
func (s Admin) AdminAuthorize(ctx context.Context, adminId int, permission string) (bool, error) {
ok, err := s.cache.Get(ctx, adminId, permission)
if err != nil {
return false, errors.WithMessage(err, "authz cache get")
}
if ok {
return ok, nil
}
ok, err = s.repo.Authorize(ctx, adminId, permission)
if err != nil {
return false, errors.WithMessagef(err, "authz repo authorize")
}
if ok {
err = s.cache.SetAuthorized(ctx, adminId, permission)
if err != nil {
return false, errors.WithMessagef(err, "authz cache set")
}
}
return ok, nil
}
+55
View File
@@ -0,0 +1,55 @@
package service
import (
"context"
"github.com/pkg/errors"
"isp-gate-service/domain"
)
type AuthenticationCache interface {
Get(ctx context.Context, token string) (*domain.AuthData, error)
Set(ctx context.Context, token string, data domain.AuthData) error
}
type AuthenticationRepo interface {
Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error)
}
type Auth struct {
cache AuthenticationCache
repo AuthenticationRepo
}
func NewAuthentication(cache AuthenticationCache, repo AuthenticationRepo) Auth {
return Auth{
cache: cache,
repo: repo,
}
}
func (s Auth) Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error) {
authData, err := s.cache.Get(ctx, token)
if errors.Is(err, domain.ErrAuthenticationCacheMiss) {
resp, err := s.repo.Authenticate(ctx, token)
if err != nil {
return nil, errors.WithMessage(err, "auth repo authenticate")
}
if !resp.Authenticated {
return resp, nil
}
err = s.cache.Set(ctx, token, *resp.AuthData)
if err != nil {
return nil, errors.WithMessage(err, "auth cache set")
}
return resp, nil
}
if err != nil {
return nil, errors.WithMessage(err, "auth cache get")
}
return &domain.AuthenticateResponse{
Authenticated: true,
ErrorReason: "",
AuthData: authData,
}, nil
}
+51
View File
@@ -0,0 +1,51 @@
package service
import (
"context"
"github.com/pkg/errors"
)
type AuthorizationCache interface {
Get(ctx context.Context, applicationId int, endpoint string) (bool, error)
SetAuthorized(ctx context.Context, applicationId int, endpoint string) error
}
type AuthorizationRepo interface {
Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error)
}
type Authorization struct {
cache AuthorizationCache
repo AuthorizationRepo
}
func NewAuthorization(cache AuthorizationCache, repo AuthorizationRepo) Authorization {
return Authorization{
cache: cache,
repo: repo,
}
}
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 ok, nil
}
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, endpoint)
if err != nil {
return false, errors.WithMessagef(err, "authz cache set")
}
}
return ok, nil
}
+50
View File
@@ -0,0 +1,50 @@
package service
import (
"context"
"fmt"
"time"
"github.com/pkg/errors"
"isp-gate-service/conf"
)
type DailyLimitRepo interface {
Increment(ctx context.Context, key string, today time.Time) (int64, error)
}
type DailyLimit struct {
repo DailyLimitRepo
limits map[int]int64
}
func NewDailyLimit(repo DailyLimitRepo, configs []conf.DailyLimit) DailyLimit {
limits := make(map[int]int64)
for _, config := range configs {
limits[config.ApplicationId] = config.RequestsPerDay
}
return DailyLimit{
repo: repo,
limits: limits,
}
}
func (s DailyLimit) IncrementAndCheck(ctx context.Context, applicationId int) (bool, error) {
limit, ok := s.limits[applicationId]
if !ok {
return true, nil
}
key := s.key(applicationId, time.Now())
newValue, err := s.repo.Increment(ctx, key, time.Now())
if err != nil {
return false, errors.WithMessage(err, "increment")
}
return newValue <= limit, nil
}
func (s DailyLimit) key(applicationId int, today time.Time) string {
y, m, d := today.Date()
return fmt.Sprintf("isp-gate-service::daily-limit::%d:%d-%d-%d", applicationId, y, m, d)
}
-33
View File
@@ -1,33 +0,0 @@
package matcher
import "sync"
type atLeastOneMatcher struct {
cache map[string]bool
lock sync.RWMutex
rm runtimeMatcher
}
func (mm *atLeastOneMatcher) Match(method string) bool {
if len(mm.rm.patterns) == 0 {
return false
}
mm.lock.RLock()
matched, ok := mm.cache[method]
mm.lock.RUnlock()
if ok {
return matched
}
mm.lock.Lock()
defer mm.lock.Unlock()
if matched, ok = mm.cache[method]; ok {
return matched
} else {
arrayPattern := mm.rm.Match(method)
matched = len(arrayPattern) > 0
}
mm.cache[method] = matched
return matched
}
-32
View File
@@ -1,32 +0,0 @@
package matcher
import "sync"
type cacheableMatcher struct {
cache map[string][]string
lock sync.RWMutex
rm runtimeMatcher
}
func (mm *cacheableMatcher) Match(method string) []string {
if len(mm.rm.patterns) == 0 {
return []string{}
}
mm.lock.RLock()
arrayPattern, ok := mm.cache[method]
mm.lock.RUnlock()
if ok {
return arrayPattern
}
mm.lock.Lock()
defer mm.lock.Unlock()
if arrayPattern, ok = mm.cache[method]; ok {
return arrayPattern
} else if arrayPattern = mm.rm.Match(method); len(arrayPattern) > 0 {
mm.cache[method] = arrayPattern
}
return arrayPattern
}
-31
View File
@@ -1,31 +0,0 @@
package matcher
var JournalMethods AtLeastOneMatcher = &atLeastOneMatcher{}
type Matcher interface {
Match(method string) []string
}
type AtLeastOneMatcher interface {
Match(method string) bool
}
func NewRuntimeMatcher(patterns []string) Matcher {
return &runtimeMatcher{
patterns: patterns,
}
}
func NewCacheableMatcher(patterns []string) Matcher {
return &cacheableMatcher{
cache: make(map[string][]string),
rm: runtimeMatcher{patterns: patterns},
}
}
func NewAtLeastOneMatcher(patterns []string) AtLeastOneMatcher {
return &atLeastOneMatcher{
cache: make(map[string]bool),
rm: runtimeMatcher{patterns: patterns},
}
}
-66
View File
@@ -1,66 +0,0 @@
//nolint
package matcher
import (
"testing"
)
var (
patterns = []string{
"mdm-master/group/method",
"mdm-master/group/*",
"mdm-master/group2/method",
"mdm-master/group3/*",
}
cases = []struct {
method string
coincidence int
atLeastOne bool
}{
{method: "mdm-master/group/method", coincidence: 2, atLeastOne: true},
{method: "mdm-master/group/method2", coincidence: 1, atLeastOne: true},
{method: "mdm-master/group2/", coincidence: 0, atLeastOne: false},
{method: "mdm-master/group2/method3", coincidence: 0, atLeastOne: false},
{method: "mdm-master/group2/method", coincidence: 1, atLeastOne: true},
{method: "mdm-master/group3/some", coincidence: 1, atLeastOne: true},
{method: "mdm-master/group3/", coincidence: 1, atLeastOne: true},
}
)
func TestCacheableMatcher_Match(t *testing.T) {
matcher := NewCacheableMatcher(patterns)
for _, c := range cases {
res := matcher.Match(c.method)
if c.coincidence != len(res) {
t.Error(c)
}
}
}
func TestAtLeastOneMatcher_Match(t *testing.T) {
matcher := NewAtLeastOneMatcher(patterns)
for _, c := range cases {
res := matcher.Match(c.method)
if c.atLeastOne != res {
t.Error(c)
}
}
}
func BenchmarkCacheableMatcher_Match(b *testing.B) {
matcher := NewCacheableMatcher(patterns)
for i := 0; i < b.N; i++ {
for _, c := range cases {
_ = matcher.Match(c.method)
}
}
}
func BenchmarkRuntimeMatcher_Match(b *testing.B) {
matcher := NewRuntimeMatcher(patterns)
for i := 0; i < b.N; i++ {
for _, c := range cases {
_ = matcher.Match(c.method)
}
}
}
-24
View File
@@ -1,24 +0,0 @@
package matcher
import (
"strings"
)
type runtimeMatcher struct {
patterns []string
}
func (mm runtimeMatcher) Match(method string) []string {
resp := make([]string, 0)
for _, pattern := range mm.patterns {
patternLen := len(pattern)
if patternLen > 0 && pattern[patternLen-1] == '*' {
if strings.HasPrefix(method, pattern[:patternLen-1]) {
resp = append(resp, pattern)
}
} else if strings.EqualFold(method, pattern) {
resp = append(resp, pattern)
}
}
return resp
}
-90
View File
@@ -1,90 +0,0 @@
package service
import (
"github.com/integration-system/isp-lib/v2/metric"
"github.com/rcrowley/go-metrics"
"sync"
"time"
)
const (
defaultSampleSize = 2048
)
var Metrics = &metricService{mh: nil}
type (
metricService struct {
mh *metricHolder
}
metricHolder struct {
methodHistograms map[string]metrics.Histogram
methodLock sync.RWMutex
statusCounters map[string]metrics.Counter
statusLock sync.RWMutex
}
)
func (m *metricService) Init() {
m.mh = &metricHolder{
methodHistograms: make(map[string]metrics.Histogram),
statusCounters: make(map[string]metrics.Counter),
}
}
func (m *metricService) UpdateMethodResponseTime(uri string, time time.Duration) {
if m.notEmptyHolder() {
m.getOrRegisterHistogram(uri).Update(int64(time))
}
}
func (m *metricService) UpdateStatusCounter(status string) {
if m.notEmptyHolder() {
m.getOrRegisterCounter(status).Inc(1)
}
}
func (m *metricService) getOrRegisterHistogram(uri string) metrics.Histogram {
m.mh.methodLock.RLock()
histogram, ok := m.mh.methodHistograms[uri]
m.mh.methodLock.RUnlock()
if ok {
return histogram
}
m.mh.methodLock.Lock()
defer m.mh.methodLock.Unlock()
if d, ok := m.mh.methodHistograms[uri]; ok {
return d
}
histogram = metrics.GetOrRegisterHistogram(
"http.response.time_"+uri,
metric.GetRegistry(),
metrics.NewUniformSample(defaultSampleSize),
)
m.mh.methodHistograms[uri] = histogram
return histogram
}
func (m *metricService) getOrRegisterCounter(status string) metrics.Counter {
m.mh.statusLock.RLock()
d, ok := m.mh.statusCounters[status]
m.mh.statusLock.RUnlock()
if ok {
return d
}
m.mh.statusLock.Lock()
defer m.mh.statusLock.Unlock()
if d, ok := m.mh.statusCounters[status]; ok {
return d
}
d = metrics.GetOrRegisterCounter("http.response.count."+status, metric.GetRegistry())
m.mh.statusCounters[status] = d
return d
}
func (m *metricService) notEmptyHolder() bool {
return m.mh != nil
}
+58
View File
@@ -0,0 +1,58 @@
package service
import (
"context"
"fmt"
"github.com/pkg/errors"
"isp-gate-service/conf"
"isp-gate-service/domain"
"isp-gate-service/entity"
)
type LockRepo interface {
IsAllowRequestPerSecond(ctx context.Context, key string, rate int) (*entity.RateLimiterResponse, error)
}
type Throttling struct {
repo LockRepo
limits map[int]int
}
func NewThrottling(repo LockRepo, configs []conf.Throttling) Throttling {
limits := make(map[int]int)
for _, config := range configs {
limits[config.ApplicationId] = config.RequestsPerSeconds
}
return Throttling{
repo: repo,
limits: limits,
}
}
func (s Throttling) AllowRateLimit(ctx context.Context, applicationId int) (*domain.RateLimitResult, error) {
rate, ok := s.limits[applicationId]
if !ok {
return &domain.RateLimitResult{
Allow: true,
Remaining: -1,
RetryAfter: -1,
}, nil
}
key := s.key(applicationId)
result, err := s.repo.IsAllowRequestPerSecond(ctx, key, rate)
if err != nil {
return nil, errors.WithMessage(err, "is allow request per second")
}
return &domain.RateLimitResult{
Allow: result.Allow,
Remaining: result.Remaining,
RetryAfter: result.RetryAfter,
}, nil
}
func (s Throttling) key(applicationId int) string {
return fmt.Sprintf("isp-gate-service::rate-limit::%d", applicationId)
}
@@ -1,60 +0,0 @@
package veritification
import (
"sync"
"time"
)
type (
cacheablesVerify struct {
cache map[string]cacheInfo
timeout time.Duration
rv *runtimeVerify
lock sync.RWMutex
}
cacheInfo struct {
created time.Time
identity map[string]string
}
)
func (cv *cacheablesVerify) ApplicationToken(token string) (map[string]string, error) {
cv.lock.RLock()
cache, ok := cv.cache[token]
cv.lock.RUnlock()
if ok {
if time.Since(cache.created) < cv.timeout {
return cv.copyCache(cache.identity), nil
}
}
cv.lock.Lock()
defer cv.lock.Unlock()
cache, ok = cv.cache[token]
if ok {
if time.Since(cache.created) < cv.timeout {
return cv.copyCache(cache.identity), nil
}
delete(cv.cache, token)
}
identity, err := cv.rv.ApplicationToken(token)
if err != nil {
return nil, err
}
cv.cache[token] = cacheInfo{created: time.Now(), identity: identity}
return cv.copyCache(identity), nil
}
func (cv *cacheablesVerify) Identity(identity map[string]string, uri string) (map[string]string, error) {
return cv.rv.Identity(identity, uri)
}
func (cv *cacheablesVerify) copyCache(cache map[string]string) map[string]string {
resp := make(map[string]string, 4)
for key, value := range cache {
resp[key] = value
}
return resp
}
-9
View File
@@ -1,9 +0,0 @@
package veritification
import "errors"
var (
ErrorInvalidUserId = errors.New("received unexpected user identity")
ErrorPermittedToCallApplication = errors.New("application has no rights to call this method")
ErrorPermittedToCallUser = errors.New("user has no rights to call this method")
)
-162
View File
@@ -1,162 +0,0 @@
package veritification
import (
"context"
rd "github.com/go-redis/redis/v8"
"github.com/integration-system/isp-lib/v2/config"
"github.com/integration-system/isp-lib/v2/redis"
"github.com/integration-system/isp-lib/v2/utils"
"github.com/pkg/errors"
"isp-gate-service/conf"
rdClient "isp-gate-service/redis"
)
const (
permittedToCallInfo = "0"
)
var (
errNoRedisCmd = errors.New("no redis cmd")
errUnexpectedCmd = errors.New("expected StringCmd")
headerKeyByRedisIdentity = map[string]string{
"1": utils.SystemIdHeader,
"2": utils.DomainIdHeader,
"3": utils.ServiceIdHeader,
"4": utils.ApplicationIdHeader,
}
)
type runtimeVerify struct{}
func (v *runtimeVerify) ApplicationToken(token string) (map[string]string, error) {
instanceUuid := config.Get().(*conf.Configuration).InstanceUuid
key := makeDbKey(token, instanceUuid)
resp, err := rdClient.Client.UseDb(redis.ApplicationTokenDb, func(p rd.Pipeliner) error {
if cmd := p.HGetAll(context.Background(), key); v.isError(cmd.Err()) {
return cmd.Err()
}
return nil
})
if err != nil {
return nil, err
}
if len(resp) < 2 || resp[1].Err() == rd.Nil {
return nil, nil
} else if resp[1].Err() != nil {
return nil, err
} else if stringStringMapCmd, ok := resp[1].(*rd.StringStringMapCmd); !ok {
return nil, errUnexpectedCmd
} else {
vals := stringStringMapCmd.Val()
identityMap := make(map[string]string, len(vals))
for i, value := range vals {
identityMap[headerKeyByRedisIdentity[i]] = value
}
return identityMap, nil
}
}
func (v *runtimeVerify) Identity(t map[string]string, uri string) (map[string]string, error) {
secondDbKey := makeDbKey(t[utils.ApplicationIdHeader], uri)
thirdDbKey := makeDbKey(t[utils.UserTokenHeader], t[utils.DomainIdHeader])
fourthDbKey := makeDbKey(t[utils.UserIdHeader], uri)
fifthDbKey := makeDbKey(t[utils.DeviceTokenHeader], t[utils.DomainIdHeader])
resp, err := rdClient.Client.Pipelined(context.Background(), func(p rd.Pipeliner) error {
if _, err := p.Select(context.Background(), int(redis.ApplicationPermissionDb)).Result(); v.isError(err) {
return err
}
if _, err := p.Get(context.Background(), secondDbKey).Result(); v.isError(err) {
return err
}
if _, err := p.Select(context.Background(), int(redis.UserTokenDb)).Result(); v.isError(err) {
return err
}
if _, err := p.Get(context.Background(), thirdDbKey).Result(); v.isError(err) {
return err
}
if _, err := p.Select(context.Background(), int(redis.UserPermissionDb)).Result(); v.isError(err) {
return err
}
if _, err := p.Get(context.Background(), fourthDbKey).Result(); v.isError(err) {
return err
}
if _, err := p.Select(context.Background(), int(redis.DeviceTokenDb)).Result(); v.isError(err) {
return err
}
if _, err := p.Get(context.Background(), fifthDbKey).Result(); v.isError(err) {
return err
}
return nil
})
if v.isError(err) {
return t, err
}
// ===== NOT PERMITTED BY APPLICATION ID =====
msg, err := v.findStringCmd(resp, 1)
if err != nil {
return t, err
}
if msg == permittedToCallInfo {
return t, ErrorPermittedToCallApplication
}
// ===== CHECK USER TOKEN =====
msg, err = v.findStringCmd(resp, 3)
if err != nil {
return t, err
}
userIdentity, found := t[utils.UserIdHeader]
if found && msg != userIdentity {
return t, ErrorInvalidUserId
}
// ===== NOT PERMITTED BY USER ID =====
msg, err = v.findStringCmd(resp, 5)
if err != nil {
return t, err
}
if msg == permittedToCallInfo {
return t, ErrorPermittedToCallUser
}
// ===== CHECK DEVICE TOKEN =====
msg, err = v.findStringCmd(resp, 7)
if err != nil {
return t, err
}
t[utils.DeviceIdHeader] = msg
return t, nil
}
func (v *runtimeVerify) isError(err error) bool {
return err != nil && err != rd.Nil
}
func (v *runtimeVerify) findStringCmd(cmders []rd.Cmder, arrayKey int) (string, error) {
if len(cmders) <= arrayKey {
return "", errNoRedisCmd
}
cmd := cmders[arrayKey]
if cmd == nil {
return "", errNoRedisCmd
}
if v.isError(cmd.Err()) {
return "", cmd.Err()
}
if stringCmd, ok := cmd.(*rd.StringCmd); !ok {
return "", errUnexpectedCmd
} else {
return stringCmd.Val(), nil
}
}
func makeDbKey(key, val string) string {
return key + "|" + val
}
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff. Show more