Compare commits
357
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
503b6b5de6 | ||
|
|
6d4f4fe554 | ||
|
|
4e924575ce | ||
|
|
7abecf78ad | ||
|
|
657d430288 | ||
|
|
d2167d2f07 | ||
|
|
2fb58a7195 | ||
|
|
72f2d37920 | ||
|
|
1a1f764f75 | ||
|
|
fbf10c8722 | ||
|
|
227a2a069d | ||
|
|
cf4979560b | ||
|
|
7d936adaf0 | ||
|
|
a8af70f93c | ||
|
|
d6b8ed5f2d | ||
|
|
81e9195d79 | ||
|
|
c5626b5aca | ||
|
|
e0e3609185 | ||
|
|
6ec6987597 | ||
|
|
ac8a556442 | ||
|
|
5cb927d4dc | ||
|
|
587e369e08 | ||
|
|
87bfa22b52 | ||
|
|
cca6ce0ad1 | ||
|
|
f98ecd049e | ||
|
|
ff560441b2 | ||
|
|
81ece162cc | ||
|
|
48e5315986 | ||
|
|
da38b66d9a | ||
|
|
206e64f9e1 | ||
|
|
1b0651e42f | ||
|
|
215ccbd25b | ||
|
|
1b2b9c5817 | ||
|
|
23a4d94cff | ||
|
|
6186f7bdb5 | ||
|
|
2e0889491d | ||
|
|
3484276256 | ||
|
|
f13c1ced4f | ||
|
|
9d9353cf57 | ||
|
|
a185cb0878 | ||
|
|
41762113e7 | ||
|
|
7cca2eb773 | ||
|
|
eb6326c343 | ||
|
|
b67eb8137c | ||
|
|
8b672bdd30 | ||
|
|
1363935f66 | ||
|
|
77f3311401 | ||
|
|
c523d2347d | ||
|
|
7ff454d6d9 | ||
|
|
7b5ff23615 | ||
|
|
1bd032e5aa | ||
|
|
f160467e77 | ||
|
|
59875487ae | ||
|
|
b692728cc3 | ||
|
|
f5a5e7d8bb | ||
|
|
aae3c28225 | ||
|
|
d417e202e0 | ||
|
|
211b47d21e | ||
|
|
e623018b72 | ||
|
|
56548cbf4d | ||
|
|
e4869135b4 | ||
|
|
40e521462d | ||
|
|
c422de39b4 | ||
|
|
c0bb6fdc7e | ||
|
|
01b6263f29 | ||
|
|
30d731ebfa | ||
|
|
8a0dce574a | ||
|
|
e5e723811e | ||
|
|
56518b86f0 | ||
|
|
6acaf9c7ee | ||
|
|
2ddb3a3d1f | ||
|
|
29cdf42808 | ||
|
|
b2ffc15cfa | ||
|
|
7cb16f87e5 | ||
|
|
63c694e2a3 | ||
|
|
b7028f3c9e | ||
|
|
de80daad81 | ||
|
|
54a3ac5ed4 | ||
|
|
9e6846ac03 | ||
|
|
4f90477e73 | ||
|
|
8b92a460de | ||
|
|
68105a2179 | ||
|
|
1a274e79e5 | ||
|
|
690820b7c4 | ||
|
|
d4f5d7d66f | ||
|
|
e6c241f112 | ||
|
|
2b5ee66527 | ||
|
|
4ddc963481 | ||
|
|
16cdb18f43 | ||
|
|
e9c5c9b805 | ||
|
|
d447bb52bc | ||
|
|
102fa48a92 | ||
|
|
96f8e79d33 | ||
|
|
9b9b66c07c | ||
|
|
abfd06b407 | ||
|
|
325ededd86 | ||
|
|
069881f85f | ||
|
|
fa803e9cac | ||
|
|
a39036a051 | ||
|
|
c3e3ed9636 | ||
|
|
2d8e24ef2b | ||
|
|
566b601c85 | ||
|
|
181edb8823 | ||
|
|
d4a097a7a7 | ||
|
|
5f556dcde3 | ||
|
|
13db082fca | ||
|
|
bebd43dde2 | ||
|
|
b17e4b78aa | ||
|
|
dc61927345 | ||
|
|
5230e9ac42 | ||
|
|
f5bfe7d2ba | ||
|
|
0dfbe57af1 | ||
|
|
a4b6e5fd1d | ||
|
|
14f3c541e4 | ||
|
|
aa704effde | ||
|
|
9f485b5e57 | ||
|
|
52d8504089 | ||
|
|
26691b99de | ||
|
|
f45f62c4b1 | ||
|
|
66e6c4b9c4 | ||
|
|
61f11c0bda | ||
|
|
343f9d0cfa | ||
|
|
cd721daa81 | ||
|
|
e7bfd34e9e | ||
|
|
6491e79afd | ||
|
|
5fed5d7683 | ||
|
|
0c2bcc6cfe | ||
|
|
e56a2b829f | ||
|
|
944c7b7415 | ||
|
|
dbf094afd8 | ||
|
|
b7912dcd9f | ||
|
|
01f8dcdc36 | ||
|
|
dce66f423d | ||
|
|
4f8d2e9ae9 | ||
|
|
1c8ba2d700 | ||
|
|
16a0c66ab7 | ||
|
|
49d1bfaa3f | ||
|
|
c6685ddfb9 | ||
|
|
6a24a7bdd8 | ||
|
|
738146be5c | ||
|
|
357ce03935 | ||
|
|
ce4d8ec165 | ||
|
|
0793b8f90f | ||
|
|
d954b8d828 | ||
|
|
600b3d7808 | ||
|
|
9808e30cb9 | ||
|
|
7acd770e26 | ||
|
|
87af899a0d | ||
|
|
82ac257e91 | ||
|
|
3d22feec9c | ||
|
|
7b5fc0b416 | ||
|
|
576ef18526 | ||
|
|
03df79d7b3 | ||
|
|
136024c387 | ||
|
|
7cd5b507c4 | ||
|
|
02cc03e744 | ||
|
|
1999ea366b | ||
|
|
57e788e7dc | ||
|
|
93482f05d3 | ||
|
|
4898a95fc4 | ||
|
|
95f9e46f45 | ||
|
|
9ec52bd852 | ||
|
|
bf6ba426f6 | ||
|
|
744eaa2605 | ||
|
|
b21f96b8a5 | ||
|
|
45e6d9128b | ||
|
|
7f99b95cea | ||
|
|
ac8cbcef8a | ||
|
|
914e9e1226 | ||
|
|
d09e784ca8 | ||
|
|
875d3985bd | ||
|
|
f9b2632335 | ||
|
|
01159874b8 | ||
|
|
843c6d36c2 | ||
|
|
4480d932e1 | ||
|
|
54292a9597 | ||
|
|
27c825f705 | ||
|
|
0d0cf8f2a0 | ||
|
|
200f65a8ba | ||
|
|
d3624ee87e | ||
|
|
56d3e06e49 | ||
|
|
f6dbff900b | ||
|
|
6683d2dcd0 | ||
|
|
1f40e9d5d3 | ||
|
|
87690bbd12 | ||
|
|
e4892b737f | ||
|
|
f94672569b | ||
|
|
c390fe3948 | ||
|
|
8a83ba0b3a | ||
|
|
402c6c18cf | ||
|
|
0c62aa8b1b | ||
|
|
6ba1761634 | ||
|
|
ca5dc08fbd | ||
|
|
219d4ce382 | ||
|
|
3f88c01417 | ||
|
|
ac7f26f705 | ||
|
|
960ad5a253 | ||
|
|
365bddceda | ||
|
|
7069f43366 | ||
|
|
b938e2f81d | ||
|
|
011cdd022c | ||
|
|
5d2e6753a0 | ||
|
|
82a6d1959a | ||
|
|
c7295c6219 | ||
|
|
1f808ea387 | ||
|
|
9639b312b2 | ||
|
|
7039bf2cf7 | ||
|
|
2f74836b5c | ||
|
|
ed9ba371f7 | ||
|
|
0d430df928 | ||
|
|
037b3bebda | ||
|
|
1fa746c3e9 | ||
|
|
dfbc05cd7d | ||
|
|
0d60ec0798 | ||
|
|
2332737031 | ||
|
|
ae1bba7575 | ||
|
|
716428dd58 | ||
|
|
9e68e9662c | ||
|
|
3483b1f52b | ||
|
|
1d34dc6f2e | ||
|
|
5139158d7a | ||
|
|
3182cefbe2 | ||
|
|
bce6527dc7 | ||
|
|
d430e1e402 | ||
|
|
08c39a9b58 | ||
|
|
f78db86e39 | ||
|
|
02334b3617 | ||
|
|
cbbc03acb9 | ||
|
|
d298485722 | ||
|
|
390bd0423e | ||
|
|
35e9311cc7 | ||
|
|
0e51c54415 | ||
|
|
c650929476 | ||
|
|
2ab43de749 | ||
|
|
01027e6f29 | ||
|
|
2b329d5270 | ||
|
|
0910add54c | ||
|
|
b054257e06 | ||
|
|
614abce93f | ||
|
|
fa9a5b7633 | ||
|
|
9163d0749d | ||
|
|
57dff99bb5 | ||
|
|
8a269cd0e0 | ||
|
|
bb92f0628a | ||
|
|
8adec87573 | ||
|
|
1a1a200173 | ||
|
|
d4f8201bd5 | ||
|
|
2f714b32c8 | ||
|
|
9d400c4158 | ||
|
|
6283cc64a5 | ||
|
|
586752ac8c | ||
|
|
191e48d464 | ||
|
|
5a9fc1a59b | ||
|
|
4175a36bf8 | ||
|
|
203dbcb1bf | ||
|
|
f13e45762b | ||
|
|
aeb297065d | ||
|
|
1cb43ec54d | ||
|
|
4505292943 | ||
|
|
5bf5373056 | ||
|
|
8d2df6364b | ||
|
|
e2b2d05777 | ||
|
|
3c0e0386e1 | ||
|
|
773fbe7883 | ||
|
|
e663429dfe | ||
|
|
61f4d16ef8 | ||
|
|
ff7e47a64e | ||
|
|
d71dc62634 | ||
|
|
0367fa8ac7 | ||
|
|
14995e91dd | ||
|
|
e64a58e85a | ||
|
|
51d9cc0397 | ||
|
|
f9f127f6b9 | ||
|
|
a73b9c119e | ||
|
|
901f350adb | ||
|
|
0b08f532e1 | ||
|
|
2c29a2f0a3 | ||
|
|
71100e8c7b | ||
|
|
fd40a83e83 | ||
|
|
e7a165875d | ||
|
|
cd5e286fb0 | ||
|
|
9408f5d83f | ||
|
|
cd6b4729aa | ||
|
|
5d4729e0c7 | ||
|
|
4b0ff6f627 | ||
|
|
b415ce8acf | ||
|
|
9e205573ea | ||
|
|
6a8c628570 | ||
|
|
83668d944a | ||
|
|
a6c7ff3af3 | ||
|
|
5bda86fe46 | ||
|
|
46f447447b | ||
|
|
2ca358a4ea | ||
|
|
bd4b52e5cc | ||
|
|
ed77144fdf | ||
|
|
963d8a1dfe | ||
|
|
12908ef2dc | ||
|
|
a7e312b066 | ||
|
|
3a526a25cc | ||
|
|
363785db94 | ||
|
|
3999f9c514 | ||
|
|
f2928ddcf7 | ||
|
|
ba2aeaf556 | ||
|
|
1a63a616ee | ||
|
|
668cbb37d2 | ||
|
|
538e9a7aab | ||
|
|
c1dd4b1846 | ||
|
|
266f3cbc20 | ||
|
|
6940b30756 | ||
|
|
3f9d25c217 | ||
|
|
828ac1cd4f | ||
|
|
db3b6aa32f | ||
|
|
39a7899a98 | ||
|
|
39dbeda9d8 | ||
|
|
9307c80b2b | ||
|
|
d9605304d2 | ||
|
|
29ed65b193 | ||
|
|
ad57079fc6 | ||
|
|
6f511ddc53 | ||
|
|
b0f871d032 | ||
|
|
6a150402d2 | ||
|
|
626eda7990 | ||
|
|
d207e56e68 | ||
|
|
be6cce7bd1 | ||
|
|
f71e29f145 | ||
|
|
5157143904 | ||
|
|
0102206734 | ||
|
|
67d0512c6b | ||
|
|
0f002b5633 | ||
|
|
1fdc36d797 | ||
|
|
3fe2126eaa | ||
|
|
f82c264f95 | ||
|
|
104524855c | ||
|
|
468653eba8 | ||
|
|
d6e1356b2a | ||
|
|
97912e5d5a | ||
|
|
eeddba7858 | ||
|
|
63f14564b8 | ||
|
|
ed7a49ef04 | ||
|
|
7b5c6165f2 | ||
|
|
04a07377c1 | ||
|
|
24b22aa7f1 | ||
|
|
05bdf75e95 | ||
|
|
71e78d01e7 | ||
|
|
ed83722c76 | ||
|
|
43679853e7 | ||
|
|
13477fa8ca | ||
|
|
b25956d028 | ||
|
|
f2e9438605 | ||
|
|
0afe95786f | ||
|
|
814d8dc15a | ||
|
|
7db2eb84b5 | ||
|
|
77112d82f8 | ||
|
|
3125d7cd10 | ||
|
|
3608c729f7 | ||
|
|
248801bbf7 | ||
|
|
607ecf629c |
No files matched your search
+5
-1
@@ -71,4 +71,8 @@ fabric.properties
|
|||||||
/vendor/
|
/vendor/
|
||||||
google/
|
google/
|
||||||
package.json
|
package.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|
||||||
|
conf/config_dev.yml
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
include:
|
||||||
|
- project: '$CI_PROJECT_PATH'
|
||||||
|
file: '/ci-isp-go-service.yml'
|
||||||
+81
-36
@@ -1,38 +1,83 @@
|
|||||||
|
version: "2"
|
||||||
|
run:
|
||||||
|
allow-parallel-runners: true
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
default: all
|
||||||
disable:
|
disable:
|
||||||
- goimports
|
- contextcheck # не имеет смысла
|
||||||
- depguard # не используется
|
- depguard # не всегда имеет смысл
|
||||||
- gochecknoinits
|
- dupword # не имеет смысла
|
||||||
- gochecknoglobals
|
- exhaustruct # не имеет смысла
|
||||||
- wsl
|
- godot # не актуально для swagger
|
||||||
- gocognit
|
- godox # не позволяет оставлять todo
|
||||||
- godox # находит тудушки, не нужно
|
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
|
||||||
- golint # подумать, может вернуть
|
- nlreturn # не всегда имеет смысл
|
||||||
- stylecheck # подумать, может вернуть
|
- nolintlint # Goland все равно форматирует с отступом
|
||||||
- goerr113
|
- perfsprint # мнимая производительность в угоду читаемости
|
||||||
|
- tagalign # не всегда имеет смысл
|
||||||
linters-settings:
|
- varnamelen # очень индивидуально (db)
|
||||||
maligned:
|
- wsl # расставление пробелов очень индивидуально
|
||||||
suggest-new: true
|
- wsl_v5 # расставление пробелов очень индивидуально
|
||||||
lll:
|
- godoclint # ругается на // nolint, не удобно
|
||||||
line-length: 140
|
- prealloc # слишком аггресивный, в большинстве случаев не требуется
|
||||||
tab-width: 1
|
- gomodguard # deprecated
|
||||||
funlen:
|
- goconst # слишком агрессивный
|
||||||
lines: 80
|
settings:
|
||||||
statements: 40
|
exhaustruct_v5:
|
||||||
prealloc:
|
allow-empty: true
|
||||||
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
|
explicit-mode: true
|
||||||
# True by default.
|
cyclop:
|
||||||
simple: true
|
max-complexity: 15 # по умолчанию 10 мало
|
||||||
range-loops: true # Report preallocation suggestions on range loops, true by default
|
funlen:
|
||||||
for-loops: true # Report preallocation suggestions on for loops, false by default
|
lines: 80
|
||||||
gocritic:
|
lll:
|
||||||
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
|
line-length: 150
|
||||||
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
revive:
|
||||||
enabled-tags:
|
rules:
|
||||||
- diagnostic
|
- name: var-naming # отключаем Id -> ID
|
||||||
- performance
|
disabled: true
|
||||||
settings:
|
staticcheck:
|
||||||
hugeParam:
|
checks: # отключаем Id -> ID
|
||||||
sizeThreshold: 90
|
- -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:
|
||||||
|
- unqueryvet
|
||||||
|
- prealloc
|
||||||
|
path: ".*_test\\.go$"
|
||||||
|
- linters:
|
||||||
|
- goconst
|
||||||
|
path: "tests/" # компонентные тесты: фикстуры и моки не выносим в константы
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
+137
@@ -1,3 +1,140 @@
|
|||||||
|
### v5.11.5
|
||||||
|
* Обновлена версия go до версии 1.27
|
||||||
|
* Обновлены правила для linter
|
||||||
|
* Обновлены зависимости
|
||||||
|
### v5.11.4
|
||||||
|
* добавлена возможность через переменную окружения `adminServiceName` переопределить название сервиса `msp-admin-service`
|
||||||
|
### v5.11.3
|
||||||
|
* добавлена настройка для преопределения content-type в ответе с `application/json` на `application/json; charset=utf-8` для конкретных приложений
|
||||||
|
### v5.11.2
|
||||||
|
* обновлены зависимости
|
||||||
|
### v5.11.1
|
||||||
|
* Обновлен isp-kit
|
||||||
|
### v5.11.0
|
||||||
|
* Добавлена поддержка нескольких `tokenProvider` для `customAuth.userAuthSettings`: используется первый провайдер, вернувший токен
|
||||||
|
### v5.10.2
|
||||||
|
* Убрано дублирование поля `requestId` при логгировании
|
||||||
|
### v5.10.1
|
||||||
|
* Изменен нейминг настройки `customAuth.userAuthSettings.authenticateMethodPath` на `customAuth.userAuthSettings.authenticateEndpoint`
|
||||||
|
### v5.10.0
|
||||||
|
* Добавлена конфигурируемая аутентификация/авторизация пользователя
|
||||||
|
### v5.9.3
|
||||||
|
* Исправлена опечатка при вызове `strings.TrimPrefix`
|
||||||
|
### v5.9.2
|
||||||
|
* При проверке `logging.skipBodyLoggingEndpointPrefixes` игнорируется `/` в начале, путь для проверки берётся из `pathSchema`, если `pathSchema` пустая, берётся вызываемый `endpoint`
|
||||||
|
* В логе `log request` из значения в поле `endpoint` удаляется `/` в начале, путь берётся из `pathSchema`, если `pathSchema` пустая, берётся вызываемый `endpoint`
|
||||||
|
### v5.9.1
|
||||||
|
* Добавлен `warn` лог на неизвестный endpoint
|
||||||
|
### v5.9.0
|
||||||
|
* Теперь в зависимоси от `StatusCode` выводится соотвествующий уровень логирования: 400 -> warn, 500 -> error
|
||||||
|
* Исправлен порядок мидлварей, для корректного проброса `requestId`
|
||||||
|
### v5.8.1
|
||||||
|
* Обновлены зависимости
|
||||||
|
### v5.8.0
|
||||||
|
* Изменён resolve для endpoint'ов, теперь используется `lookup` у `github.com/julienschmidt/httprouter`
|
||||||
|
* Добавлен http метод в запрос авторизации (`system/secure/authorize`)
|
||||||
|
### v5.7.0
|
||||||
|
* Добавлено лог поле `applicationName` в логи `log request` и `bypassing unauthorized request because it has admin privilege`
|
||||||
|
### v5.6.2
|
||||||
|
* Обновлено заполнение заголовка `x-application-name` для поддержки кириллических символов
|
||||||
|
### v5.6.1
|
||||||
|
* Добавлен проброс заголовка `x-application-name`
|
||||||
|
### v5.6.0
|
||||||
|
* Добавлена поддержка метрик для http запросов
|
||||||
|
### v5.5.1
|
||||||
|
* повышен приоритет `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
|
## 2.7.2
|
||||||
* fix accounting
|
* fix accounting
|
||||||
## 2.7.1
|
## 2.7.1
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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)
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
package assembly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/cache"
|
||||||
|
"isp-gate-service/conf"
|
||||||
|
"isp-gate-service/routes"
|
||||||
|
|
||||||
|
"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/errors"
|
||||||
|
"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"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
routerModuleName = "isp-router-service"
|
||||||
|
defaultAdminServiceName = "msp-admin-service"
|
||||||
|
usersAuthCachePurgeInterval = 5 * time.Second
|
||||||
|
)
|
||||||
|
|
||||||
|
type Assembly struct {
|
||||||
|
boot *bootstrap.Bootstrap
|
||||||
|
server *http.Server
|
||||||
|
logger *log.Adapter
|
||||||
|
routes *routes.Routes
|
||||||
|
systemCli *client.Client
|
||||||
|
adminCli *client.Client
|
||||||
|
lockerCli *client.Client
|
||||||
|
routerLb *lb.RoundRobin
|
||||||
|
|
||||||
|
localConfig conf.Local
|
||||||
|
grpcClientByModuleName map[string]*client.Client
|
||||||
|
httpHostManagerByModuleName map[string]*lb.RoundRobin
|
||||||
|
|
||||||
|
usersAuthCache *cache.Cache
|
||||||
|
}
|
||||||
|
|
||||||
|
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(boot.App.Logger()),
|
||||||
|
localConfig: localConfig,
|
||||||
|
grpcClientByModuleName: grpcClientByModuleName,
|
||||||
|
httpHostManagerByModuleName: httpHostManagerByModuleName,
|
||||||
|
systemCli: systemCli,
|
||||||
|
adminCli: adminCli,
|
||||||
|
lockerCli: lockerCli,
|
||||||
|
routerLb: lb.NewRoundRobin(nil),
|
||||||
|
usersAuthCache: cache.New(),
|
||||||
|
}, 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,
|
||||||
|
a.routerLb,
|
||||||
|
a.usersAuthCache,
|
||||||
|
)
|
||||||
|
handler, err := locator.Handler(newCfg, a.localConfig.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)
|
||||||
|
}
|
||||||
|
adminServiceName := a.localConfig.AdminServiceName
|
||||||
|
if adminServiceName == "" {
|
||||||
|
adminServiceName = defaultAdminServiceName
|
||||||
|
}
|
||||||
|
eventHandler.RequireModule("isp-system-service", a.systemCli)
|
||||||
|
eventHandler.RequireModule(adminServiceName, a.adminCli)
|
||||||
|
eventHandler.RequireModule("isp-lock-service", a.lockerCli)
|
||||||
|
eventHandler.RequireModule(routerModuleName, a.routerLb)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}),
|
||||||
|
app.RunnerFunc(func(ctx context.Context) error {
|
||||||
|
a.usersAuthCache.StartCleaner(ctx, usersAuthCachePurgeInterval)
|
||||||
|
return nil
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
package assembly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/metrics"
|
||||||
|
"github.com/txix-open/isp-kit/metrics/http_metrics"
|
||||||
|
|
||||||
|
"isp-gate-service/cache"
|
||||||
|
"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/txix-open/isp-kit/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
|
||||||
|
routerLb *lb.RoundRobin
|
||||||
|
usersAuthCache *cache.Cache
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
routerLb *lb.RoundRobin,
|
||||||
|
usersAuthCache *cache.Cache,
|
||||||
|
) Locator {
|
||||||
|
return Locator{
|
||||||
|
logger: logger,
|
||||||
|
grpcClientByModuleName: grpcClientByModuleName,
|
||||||
|
httpHostManagerByModuleName: httpHostManagerByModuleName,
|
||||||
|
routes: routes,
|
||||||
|
systemCli: systemCli,
|
||||||
|
adminCli: adminCli,
|
||||||
|
lockerCli: lockerCli,
|
||||||
|
routerLb: routerLb,
|
||||||
|
usersAuthCache: usersAuthCache,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
userAuthenticationCache := repository.NewUserAuthenticationCache(l.usersAuthCache)
|
||||||
|
userAuthRepo := repository.NewUserAuth(l.routerLb)
|
||||||
|
userAuthentication, err := service.NewUserAuthentication(
|
||||||
|
config.CustomAuth,
|
||||||
|
userAuthenticationCache,
|
||||||
|
userAuthRepo,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "new user authentication")
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
skipBodyLoggingEndpointPrefixes := make([]string, 0, len(config.Logging.SkipBodyLoggingEndpointPrefixes))
|
||||||
|
for _, prefix := range config.Logging.SkipBodyLoggingEndpointPrefixes {
|
||||||
|
skipBodyLoggingEndpointPrefixes = append(skipBodyLoggingEndpointPrefixes, strings.TrimPrefix(prefix, "/"))
|
||||||
|
}
|
||||||
|
|
||||||
|
mux := mux2.NewRouter()
|
||||||
|
for _, location := range locations {
|
||||||
|
var proxyFunc middleware.Handler
|
||||||
|
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]
|
||||||
|
if location.TargetModule == routerModuleName {
|
||||||
|
hostManager = l.routerLb
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
enableUtf8JsonCharsetByApp := make(map[int]bool, len(config.ResponseContentTypeSettings))
|
||||||
|
for _, setting := range config.ResponseContentTypeSettings {
|
||||||
|
enableUtf8JsonCharsetByApp[setting.ApplicationId] = setting.AddJsonUtf8Charset
|
||||||
|
}
|
||||||
|
|
||||||
|
metricsStorage := http_metrics.NewServerStorage(metrics.DefaultRegistry)
|
||||||
|
|
||||||
|
handler := middleware.Chain(
|
||||||
|
proxyFunc,
|
||||||
|
middleware.Logger(
|
||||||
|
l.logger, config.Logging.RequestLogEnable,
|
||||||
|
enableBodyLog,
|
||||||
|
config.Logging.SkipBodyLoggingEndpointPrefixes,
|
||||||
|
config.Logging.EnableForceUnescapingUnicode,
|
||||||
|
),
|
||||||
|
middleware.RequestId(),
|
||||||
|
middleware.ErrorHandler(l.logger),
|
||||||
|
middleware.UserAuthenticate(userAuthentication, l.logger),
|
||||||
|
middleware.Authenticate(authentication),
|
||||||
|
middleware.AdminAuthenticate(adminService),
|
||||||
|
middleware.ClientRequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
|
||||||
|
middleware.JsonResponseUtf8Charset(enableUtf8JsonCharsetByApp),
|
||||||
|
middleware.Authorize(authorization, l.logger),
|
||||||
|
middleware.AdminAuthorize(adminService),
|
||||||
|
middleware.Throttling(throttlingService),
|
||||||
|
middleware.DailyLimit(dailyLimitService),
|
||||||
|
middleware.Metrics(metricsStorage),
|
||||||
|
)
|
||||||
|
|
||||||
|
errorOnUnknownEndpoint := true
|
||||||
|
if location.SkipAuth {
|
||||||
|
errorOnUnknownEndpoint = false
|
||||||
|
handler = middleware.Chain(
|
||||||
|
proxyFunc,
|
||||||
|
middleware.Logger(l.logger, config.Logging.RequestLogEnable,
|
||||||
|
enableBodyLog,
|
||||||
|
skipBodyLoggingEndpointPrefixes,
|
||||||
|
config.Logging.EnableForceUnescapingUnicode,
|
||||||
|
),
|
||||||
|
middleware.RequestId(),
|
||||||
|
middleware.ErrorHandler(l.logger),
|
||||||
|
middleware.ClientRequestId(config.EnableClientRequestIdForwarding, forwardReqIdByAppId),
|
||||||
|
middleware.Metrics(metricsStorage),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
entrypoint := middleware.Entrypoint(
|
||||||
|
config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:mnd
|
||||||
|
handler,
|
||||||
|
middleware.EntryPointConfig{
|
||||||
|
WithPrefix: location.WithPrefix,
|
||||||
|
PathPrefix: location.PathPrefix,
|
||||||
|
ErrorOnUnknownEndpoint: errorOnUnknownEndpoint,
|
||||||
|
WithLendingSlash: location.Protocol != conf.GrpcProtocol,
|
||||||
|
},
|
||||||
|
l.routes,
|
||||||
|
l.logger,
|
||||||
|
)
|
||||||
|
mux.PathPrefix(location.PathPrefix).Handler(entrypoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
return mux, nil
|
||||||
|
}
|
||||||
@@ -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)
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
Vendored
+82
@@ -0,0 +1,82 @@
|
|||||||
|
package cache
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"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),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartCleaner runs periodic cleanup.
|
||||||
|
// Blocking call: intended to be run in a separate goroutine.
|
||||||
|
func (c *Cache) StartCleaner(ctx context.Context, interval time.Duration) {
|
||||||
|
ticker := time.NewTicker(interval)
|
||||||
|
defer ticker.Stop()
|
||||||
|
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case <-ticker.C:
|
||||||
|
c.cleanup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Cache) cleanup() {
|
||||||
|
c.lock.Lock()
|
||||||
|
defer c.lock.Unlock()
|
||||||
|
|
||||||
|
now := c.now()
|
||||||
|
for k, v := range c.store {
|
||||||
|
if now.After(v.expiredAt) {
|
||||||
|
delete(c.store, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Cache) now() time.Time {
|
||||||
|
return time.Now()
|
||||||
|
}
|
||||||
Vendored
+50
@@ -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)
|
||||||
|
}
|
||||||
+15
-8
@@ -1,18 +1,25 @@
|
|||||||
configServiceAddress:
|
configServiceAddress:
|
||||||
ip: 127.0.0.1
|
ip: 127.0.0.1
|
||||||
port: 9001
|
port: 9001
|
||||||
httpOuterAddress:
|
grpcOuterAddress:
|
||||||
ip: 127.0.0.1
|
#ip: 127.0.0.1
|
||||||
port: 9003
|
port: 9003
|
||||||
httpInnerAddress:
|
grpcInnerAddress:
|
||||||
ip: 0.0.0.0
|
ip: 0.0.0.0
|
||||||
port: 9003
|
port: 9003
|
||||||
moduleName: isp-gate
|
moduleName: isp-gate-service
|
||||||
instanceUuid: 9d89354b-c728-4b48-b002-a7d3b229f151
|
|
||||||
|
infraServerPort: 9553
|
||||||
|
|
||||||
|
logfile:
|
||||||
|
path: /var/log/isp-gate-service/runtime.log
|
||||||
|
maxSizeMb: 512
|
||||||
|
maxBackups: 4
|
||||||
|
compress: true
|
||||||
|
|
||||||
|
adminServiceName: msp-admin-service
|
||||||
|
|
||||||
locations:
|
locations:
|
||||||
- pathPrefix: /api
|
- pathPrefix: /api
|
||||||
protocol: grpc
|
protocol: grpc
|
||||||
targetModule: router
|
targetModule: router
|
||||||
- pathPrefix: /mdm
|
|
||||||
protocol: http
|
|
||||||
targetModule: mdm-api
|
|
||||||
@@ -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
|
||||||
@@ -1,65 +1,17 @@
|
|||||||
{
|
{
|
||||||
"database": {
|
"logging": {
|
||||||
"address": "{{ msp_pgsql_address }}",
|
"logLevel": "debug",
|
||||||
"port": "{{ msp_pgsql_port }}",
|
"requestLogEnable": true,
|
||||||
"schema": "gate_service",
|
"bodyLogEnable": false,
|
||||||
"database": "{{ msp_pgsql_name }}",
|
"skipBodyLoggingEndpointPrefixes": [],
|
||||||
"username": "{{ msp_pgsql_user }}",
|
"enableForceUnescapingUnicode": false
|
||||||
"password": "{{ msp_pgsql_password }}",
|
},
|
||||||
"createSchema": true
|
"caching": {
|
||||||
},
|
"authenticationDataInSec": 60,
|
||||||
"grpcSetting": {
|
"authorizationDataInSec": 60
|
||||||
"proxyGrpcErrorDetails": true,
|
},
|
||||||
"enableOriginalProtoErrors": false
|
"http": {
|
||||||
},
|
"maxRequestBodySizeInMb": 64,
|
||||||
"httpSetting": {
|
"proxyTimeoutInSec": 60
|
||||||
"maxRequestBodySizeBytes": 0
|
|
||||||
},
|
|
||||||
"accountingSetting": {
|
|
||||||
"enable": false,
|
|
||||||
"snapshotTimeout": "15m",
|
|
||||||
"setting": [
|
|
||||||
],
|
|
||||||
"storing": {
|
|
||||||
"size": 10000,
|
|
||||||
"timeout": "10m"
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package conf
|
||||||
|
|
||||||
|
const (
|
||||||
|
HttpProtocol = "http"
|
||||||
|
GrpcProtocol = "grpc"
|
||||||
|
WsProtocol = "ws"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Local struct {
|
||||||
|
Locations []Location
|
||||||
|
AdminServiceName string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Location struct {
|
||||||
|
WithPrefix bool
|
||||||
|
SkipAuth bool
|
||||||
|
PathPrefix string `validate:"required"`
|
||||||
|
Protocol string `validate:"required,oneof=http grpc ws"`
|
||||||
|
TargetModule string `validate:"required"`
|
||||||
|
}
|
||||||
@@ -1,41 +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"`
|
|
||||||
Locations []Location
|
|
||||||
}
|
|
||||||
|
|
||||||
Location struct {
|
|
||||||
SkipAuth bool
|
|
||||||
SkipExistCheck bool
|
|
||||||
PathPrefix string `valid:"required~Required"`
|
|
||||||
Protocol string `valid:"required~Required"`
|
|
||||||
TargetModule string `valid:"required~Required"`
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func GetLocationsByTargetModule(locations []Location) map[string][]Location {
|
|
||||||
requiredModules := make(map[string][]Location)
|
|
||||||
|
|
||||||
for _, location := range locations {
|
|
||||||
if location.TargetModule == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if loc, ok := requiredModules[location.TargetModule]; ok {
|
|
||||||
requiredModules[location.TargetModule] = append(loc, location)
|
|
||||||
} else {
|
|
||||||
requiredModules[location.TargetModule] = []Location{location}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return requiredModules
|
|
||||||
}
|
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
// 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"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
HeaderTokenProviderType = "HEADER"
|
||||||
|
CookieTokenProviderType = "COOKIE"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Schema) {
|
||||||
|
t.Type = "string"
|
||||||
|
t.Enum = []any{"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 для приложений"`
|
||||||
|
CustomAuth CustomAuth `schema:"Настройка кастомной аутентификации/авторизации"`
|
||||||
|
ResponseContentTypeSettings []ResponseContentTypeSetting `schema:"Настройки Content-Type ответов"`
|
||||||
|
}
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CustomAuth struct {
|
||||||
|
TokenProviders []TokenProvider `schema:"Настройки получения токена из запроса"`
|
||||||
|
UserAuthSettings []UserAuthSetting `schema:"Настройка пользовательской аутентификации/авторизации"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthProvider struct {
|
||||||
|
Name string `schema:"Название настройки аутентификации/авторизации,должно быть уникальным" validate:"required"`
|
||||||
|
ModuleName string `schema:"Название модуля,реализующего аутентификацию/авторизацию" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TokenProvider struct {
|
||||||
|
Name string `schema:"Название метода получения токена из запроса,должно быть уникальным" validate:"required"`
|
||||||
|
Type string `schema:"Тип метода получения токена,один из: HEADER COOKIE" validate:"required,oneof=HEADER COOKIE"`
|
||||||
|
HeaderProvider *HeaderTokenProvider `schema:"Настройки для получения токена из заголовка"`
|
||||||
|
CookieProvider *CookieTokenProvider `schema:"Настройки для получения токена из cookie"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HeaderTokenProvider struct {
|
||||||
|
HeaderName string `schema:"Название заголовка,из которого берётся токен" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CookieTokenProvider struct {
|
||||||
|
CookieName string `schema:"Название cookie,из которого берётся токен" validate:"required"`
|
||||||
|
Validate bool `schema:"Проверить валидность cookie"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserAuthSetting struct {
|
||||||
|
ModuleNameList []string `schema:"Название модулей,для которых настраивается аутентификация/авторизация,название модулей должно быть уникальным" validate:"required"`
|
||||||
|
TokenProviders []string `schema:"Список названий методов получения токена из запроса,используется первый провайдер, вернувший токен"`
|
||||||
|
AuthenticateEndpoint string `schema:"Endpoint для аутентификации пользователя,вызывается через isp-router-service" validate:"required"`
|
||||||
|
CacheDataInSec int `schema:"Время кеширования данных аутентификации/авторизации пользователя,отключен при значениях <=0,в секундах"`
|
||||||
|
SkipAppAuth bool `schema:"Пропустить аутентификацию и авторизацию приложения"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResponseContentTypeSetting struct {
|
||||||
|
ApplicationId int `validate:"required" schema:"ID приложения"`
|
||||||
|
AddJsonUtf8Charset bool `schema:"Добавлять charset=utf-8 в Content-Type ответа: application/json для locations с protocol=http"`
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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{})
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type AdminAuthenticateResponse struct {
|
||||||
|
Authenticated bool
|
||||||
|
ErrorReason string
|
||||||
|
AdminId int
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type AuthenticateAppResponse struct {
|
||||||
|
Authenticated bool
|
||||||
|
ErrorReason string
|
||||||
|
AuthData *AppAuthData
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppAuthData struct {
|
||||||
|
AppName string
|
||||||
|
SystemId int
|
||||||
|
DomainId int
|
||||||
|
ServiceId int
|
||||||
|
ApplicationId int
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApplicationToken struct {
|
||||||
|
AppToken string
|
||||||
|
AppName string
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserToken struct {
|
||||||
|
Token string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthenticateUserResponse struct {
|
||||||
|
Authenticated bool
|
||||||
|
SkipUserAuth bool
|
||||||
|
ErrorReason string
|
||||||
|
AuthData *UserAuthData
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserAuthData struct {
|
||||||
|
SkipAppAuth bool
|
||||||
|
Identity string
|
||||||
|
IdentityHeader string
|
||||||
|
ExtraHeaders map[string][]string
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrAuthenticationCacheMiss = errors.New("authentication not found in cache")
|
||||||
|
)
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EndpointMeta struct {
|
||||||
|
Inner bool
|
||||||
|
UserAuthRequired bool
|
||||||
|
|
||||||
|
ModuleName string
|
||||||
|
RequiredAdminPermission string
|
||||||
|
// Объявляемый сервисом метод
|
||||||
|
PathSchema string
|
||||||
|
// Вызываемый метод
|
||||||
|
Endpoint string
|
||||||
|
// Нормализованный путь, для известных путей берётся объявляемый метод, для неизвестных - вызываемый
|
||||||
|
// Удаляет '/' из начала пути
|
||||||
|
NormalizedEndpoint string
|
||||||
|
}
|
||||||
|
|
||||||
|
type endpointMetaKey struct{}
|
||||||
|
|
||||||
|
func (m EndpointMeta) ToContext(ctx context.Context) context.Context {
|
||||||
|
return context.WithValue(ctx, endpointMetaKey{}, m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EndpointMetaFromContext(ctx context.Context) EndpointMeta {
|
||||||
|
meta, _ := ctx.Value(endpointMetaKey{}).(EndpointMeta)
|
||||||
|
return meta
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import "github.com/txix-open/isp-kit/errors"
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrUserAuthSettingNotFound = errors.New("user auth setting not found")
|
||||||
|
ErrEmptyUserToken = errors.New("failed to extract user token")
|
||||||
|
ErrInvalidUserToken = errors.New("invalid user token")
|
||||||
|
)
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RateLimitResult struct {
|
||||||
|
Allow bool
|
||||||
|
Remaining int
|
||||||
|
RetryAfter time.Duration
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type AdminAuthenticateResponse struct {
|
||||||
|
Authenticated bool
|
||||||
|
ErrorReason string
|
||||||
|
AdminId int
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type AppAuthData struct {
|
||||||
|
AppName string
|
||||||
|
SystemId int
|
||||||
|
DomainId int
|
||||||
|
ServiceId int
|
||||||
|
ApplicationId int
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type AuthenticateRequest struct {
|
||||||
|
Token string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthenticateResponse struct {
|
||||||
|
Authenticated bool
|
||||||
|
ErrorReason string
|
||||||
|
AuthData *AppAuthData
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthorizeRequest struct {
|
||||||
|
ApplicationId int
|
||||||
|
HttpMethod string
|
||||||
|
Endpoint string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AuthorizeResponse struct {
|
||||||
|
Authorized bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminAuthorizeRequest struct {
|
||||||
|
AdminId int
|
||||||
|
Permission string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminAuthorizeResponse struct {
|
||||||
|
Authorized bool
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
type UserAuthenticateRequest struct {
|
||||||
|
Token string
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserAuthenticateResponse struct {
|
||||||
|
Authenticated bool
|
||||||
|
ErrorReason string
|
||||||
|
AuthData *UserAuthData
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserAuthData struct {
|
||||||
|
Identity string
|
||||||
|
IdentityHeader string
|
||||||
|
ExtraHeaders map[string][]string
|
||||||
|
}
|
||||||
@@ -1,23 +1,77 @@
|
|||||||
module isp-gate-service
|
module isp-gate-service
|
||||||
|
|
||||||
go 1.14
|
go 1.27.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
github.com/google/uuid v1.6.0
|
||||||
github.com/fasthttp/websocket v1.4.1
|
github.com/gorilla/mux v1.8.1
|
||||||
github.com/go-pg/pg/v9 v9.1.7
|
github.com/gorilla/websocket v1.5.3
|
||||||
github.com/go-redis/redis/v8 v8.0.0-beta.2
|
github.com/julienschmidt/httprouter v1.3.0
|
||||||
github.com/golang/protobuf v1.3.5
|
github.com/redis/go-redis/v9 v9.24.0
|
||||||
github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f
|
github.com/stretchr/testify v1.12.1
|
||||||
github.com/integration-system/isp-journal v1.5.0
|
github.com/tomakado/websocketproxy v0.1.0
|
||||||
github.com/integration-system/isp-lib/v2 v2.6.3-0.20200925192756-f336302805fa
|
github.com/txix-open/etp/v3 v3.2.0
|
||||||
github.com/integration-system/isp-log v1.1.5
|
github.com/txix-open/isp-kit v1.76.0
|
||||||
github.com/json-iterator/go v1.1.10
|
github.com/txix-open/jsonschema v1.3.0
|
||||||
github.com/pkg/errors v0.9.1
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
|
google.golang.org/grpc v1.85.0
|
||||||
github.com/spf13/cast v1.3.1
|
)
|
||||||
github.com/stretchr/testify v1.6.1
|
|
||||||
github.com/valyala/fasthttp v1.16.0
|
require (
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202
|
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||||
google.golang.org/grpc v1.29.1
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
|
github.com/buger/jsonparser v1.6.1 // indirect
|
||||||
|
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
|
github.com/coder/websocket v1.8.15 // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.16 // indirect
|
||||||
|
github.com/getsentry/sentry-go v0.50.0 // indirect
|
||||||
|
github.com/go-faker/faker/v4 v4.12.0 // indirect
|
||||||
|
github.com/go-logr/logr v1.4.4 // indirect
|
||||||
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
|
github.com/go-playground/locales v0.14.2 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.2 // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0 // indirect
|
||||||
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
|
github.com/klauspost/compress v1.20.5 // indirect
|
||||||
|
github.com/leodido/go-urn v1.5.0 // indirect
|
||||||
|
github.com/mailru/easyjson v0.9.2 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/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/pandatix/go-abnf v0.5.5 // indirect
|
||||||
|
github.com/prometheus/client_golang v1.25.0 // indirect
|
||||||
|
github.com/prometheus/client_model v0.6.3 // indirect
|
||||||
|
github.com/prometheus/common v0.74.0 // indirect
|
||||||
|
github.com/prometheus/procfs v0.23.0 // indirect
|
||||||
|
github.com/txix-open/bellows v1.2.0 // indirect
|
||||||
|
github.com/txix-open/etp/v4 v4.1.3 // indirect
|
||||||
|
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3 // 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/auto/sdk v1.2.2 // indirect
|
||||||
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0 // indirect
|
||||||
|
go.opentelemetry.io/otel v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/log v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/metric v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/sdk v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/trace v1.47.0 // indirect
|
||||||
|
go.opentelemetry.io/proto/otlp v1.11.1 // indirect
|
||||||
|
go.uber.org/atomic v1.12.0 // indirect
|
||||||
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
|
go.uber.org/zap v1.28.0 // indirect
|
||||||
|
go.yaml.in/yaml/v3 v3.0.6 // indirect
|
||||||
|
golang.org/x/crypto v0.59.0 // indirect
|
||||||
|
golang.org/x/net v0.63.0 // indirect
|
||||||
|
golang.org/x/sys v0.50.0 // indirect
|
||||||
|
golang.org/x/text v0.44.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.12 // indirect
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
@@ -1,608 +1,204 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||||
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||||
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
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/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
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/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||||
github.com/buaazp/fasthttprouter v0.1.1 h1:4oAnN0C3xZjylvZJdP35cxfclyn4TYkW6Y+DSvS+h8Q=
|
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||||
github.com/buaazp/fasthttprouter v0.1.1/go.mod h1:h/Ap5oRVLeItGKTVBb+heQPks+HdIUtGmI4H5WCYijM=
|
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||||
github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU=
|
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||||
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
|
github.com/buger/jsonparser v1.6.1 h1:I0phFv0PlbLHnM7TZAVjZ2MJ2/eWRTDyuO7GLR98IEs=
|
||||||
github.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs=
|
github.com/buger/jsonparser v1.6.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
|
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
|
||||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
||||||
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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
github.com/gabriel-vasile/mimetype v1.4.16 h1:5izNFuvA37st1dDRAcA7TtmngBmRgiIPDmTtiEvjx1E=
|
||||||
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
github.com/gabriel-vasile/mimetype v1.4.16/go.mod h1:3oFFwxX8kTklZwzIl2aQEDZT0lKY8xH92ST88bAwba4=
|
||||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
github.com/getsentry/sentry-go v0.50.0 h1:gkO59rn/i0RCAXUUTflC5QVbTQGPXbaFabs2olVzc9g=
|
||||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
github.com/getsentry/sentry-go v0.50.0/go.mod h1:+xsDuN+SoRN/xfs1hdq78wnrE3omIZf+FCuh9FOW1C8=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/go-faker/faker/v4 v4.12.0 h1:yZXxuoQjxN+C2PVgYoDSHGiD9wj6dX1/Ful4p7QQV0k=
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
github.com/go-faker/faker/v4 v4.12.0/go.mod h1:VFIEwWDd16EdYDLF6NJ5gAAzEp7vz5LgKgJ2iZ17Tdg=
|
||||||
github.com/fasthttp/websocket v1.4.1 h1:fisgNMCNCbIPM5GRRRTAckRrynbSzf76fevcJYJYnSM=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/fasthttp/websocket v1.4.1/go.mod h1:toetUvZ3KISxtZERe0wzPPpnaN8GZCKHCowWctwA50o=
|
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/go-playground/locales v0.14.2 h1:d8UmcrM6Nip0hfGZKLGpAvZH37XB4TS0xzK9B56YNCY=
|
||||||
github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
|
github.com/go-playground/locales v0.14.2/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
github.com/go-playground/universal-translator v0.18.2 h1:LCsMLC9RzmbUMNUPVYD15dmcjwYAJhmX8mPZRW4rAVU=
|
||||||
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
github.com/go-playground/universal-translator v0.18.2/go.mod h1:67VZIMp5lQpDWlnStOct22q1bkdJGJqHghbOtmkawxk=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
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/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||||
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0 h1:vzlTzzi4tHLa/JQdIE5LeXw6SEX5EVVhq/VPqKHnKOk=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0/go.mod h1:FHXQZnW5pA0txiMr3jApv9uNJzZ+7mYZd+u+PPenCFU=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||||
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||||
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
github.com/klauspost/compress v1.20.5 h1:rJj5VjH4xQxbnLphg6eqUcDxRFCw1jpMdDY9qXlrwSs=
|
||||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
github.com/klauspost/compress v1.20.5/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||||
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
|
||||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
|
||||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
|
github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
|
||||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/mailru/easyjson v0.9.2 h1:dX8U45hQsZpxd80nLvDGihsQ/OxlvTkVUXH2r/8cb2M=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/mailru/easyjson v0.9.2/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||||
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c h1:yyIH4qCFf5LD5PKhXoX4BZh3wRjd59xBV4eAQTBwS6k=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c/go.mod h1:6cf4ZNvtzZ/KMiuc+d5Y7rSHjzlYBWEqbVyDfUDhqIE=
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
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 h1:qRw4J04vwYxSm52OUIt6lKWpxEQE2aZjUT7kZDG/A4Q=
|
|
||||||
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 h1:jPsrovXg3yt+A64AQB+Mc/KyJYcC8d+MZK3OLSHCxZY=
|
|
||||||
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-0.20200925192756-f336302805fa h1:sORWdPlJqhLpYnYfyB67dDQ1u8LJqPwlawQQhEiNQ4k=
|
|
||||||
github.com/integration-system/isp-lib/v2 v2.6.3-0.20200925192756-f336302805fa/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/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/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/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
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/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.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
github.com/pandatix/go-abnf v0.5.5 h1:EXex5KkRQx4Dm6GnpAcQnIMBs9KiK0uf8p/wq+4t9PM=
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
github.com/pandatix/go-abnf v0.5.5/go.mod h1:AE0KD3/VNoCjGzc1gqetRKshbI4SYErXQ/8kPenR5mc=
|
||||||
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
|
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||||
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/pressly/goose v2.6.0+incompatible h1:3f8zIQ8rfgP9tyI0Hmcs2YNAqUCL1c+diLe3iU8Qd/k=
|
github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0=
|
||||||
github.com/pressly/goose v2.6.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8=
|
github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk=
|
||||||
github.com/profefe/profefe v0.0.0-20200307211836-5ab457f7a4d8 h1:9lI6rm0yjyeB6Q5zE/SytxlNDgRQ1thnRZGQChtsLRs=
|
github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo=
|
||||||
github.com/profefe/profefe v0.0.0-20200307211836-5ab457f7a4d8/go.mod h1:QOlABo1QFtwVrB7Rdl8gwY9pqxmln8lIWOQEW1oj1uI=
|
github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
github.com/prometheus/common v0.74.0 h1:6iYW8MsYvmEnXFD9zLGgF0qmReaRhs3OMONu1c/nrLI=
|
||||||
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
github.com/prometheus/common v0.74.0/go.mod h1:i/02C+FCst5B1etKgWesNrD49n+onplJCqUCtUKkOeA=
|
||||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4=
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
github.com/prometheus/procfs v0.23.0/go.mod h1:3AVXO0FqLafyYFU/V/IQRZlC8Rgqz8Dm/x6pKLK+RIk=
|
||||||
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
|
github.com/rabbitmq/amqp091-go v1.17.0 h1:6KmTqrnJq93cGIE3Q3UnXgsqw6NtLu8MNfFoIbfBAIQ=
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
github.com/rabbitmq/amqp091-go v1.17.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/redis/go-redis/v9 v9.24.0 h1:X1AnQHWaSfMeggDQm7UFad1YwJmoZxVm5XkaP0kr6nQ=
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/redis/go-redis/v9 v9.24.0/go.mod h1:ted97kpLnB4S2KJkTkw+7GzRjgkFnU909IIrksu+ut4=
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||||
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||||
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
|
||||||
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM=
|
github.com/tomakado/websocketproxy v0.1.0 h1:e037TLXDvEYYHlxHE5pqmj/DytFKm2NRn7i4wbVzIyE=
|
||||||
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E=
|
github.com/tomakado/websocketproxy v0.1.0/go.mod h1:EXg/3jcTJYZ04Hsf93RpY90FYA9lj1Sl+VM7lZI6xpM=
|
||||||
github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI=
|
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
||||||
github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba h1:lUPlXKqgbqT2SVg2Y+eT9mu5wbqMnG+i/+Q9nK7C0Rs=
|
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
||||||
github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba/go.mod h1:O1lAbCgAAX/KZ80LM/OXwtWFI/5TvZlwxSg8Cq08PV0=
|
github.com/txix-open/etp/v3 v3.2.0 h1:EgTchT8VtCYV1iEo/y4jII3/NybrXiQDE0y6pmS350M=
|
||||||
github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y=
|
github.com/txix-open/etp/v3 v3.2.0/go.mod h1:lgen0TJmiturgBhvlxH1/PQ7iLL/OebKbxPAQYkuKI0=
|
||||||
github.com/swaggo/swag v1.6.3/go.mod h1:wcc83tB4Mb2aNiL/HP4MFeQdpHUrca+Rp/DRNgWAUio=
|
github.com/txix-open/etp/v4 v4.1.3 h1:u9ZyU2yKGgoQ1/DSaElhazWm8xASdqGEdWjoJ2xQlfo=
|
||||||
github.com/swaggo/swag v1.6.7 h1:e8GC2xDllJZr3omJkm9YfmK0Y56+rMO3cg0JBKNz09s=
|
github.com/txix-open/etp/v4 v4.1.3/go.mod h1:9GK+Aje8BmLFq8Hk4j6Qb976LdU9WECCWAuLK1vAKgM=
|
||||||
github.com/swaggo/swag v1.6.7/go.mod h1:xDhTyuFIujYiN3DKWC/H/83xcfHp+UE/IzWWampG7Zc=
|
github.com/txix-open/grmq v1.12.0 h1:lSPYvwLfTL0+b0xDQmuuN6RaKS3NCEJNK9ccWpOWa8Y=
|
||||||
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3 h1:COy7ekr2jBEd34npP2LvMTqk9UtiLkuvkjiJFHihlTo=
|
github.com/txix-open/grmq v1.12.0/go.mod h1:6m9CCTQao/HAFalu5rFOZGJ5KLEP6WzzIwj80Ml3KGE=
|
||||||
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3/go.mod h1:ehwM4AFY4byYSorQbigh79cKUOUNL3pAOz5eCAQNlGI=
|
github.com/txix-open/isp-kit v1.76.0 h1:kqhX2DuoTfeW7BIshedG26TRIfOgX0QOInm606ssGVg=
|
||||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
github.com/txix-open/isp-kit v1.76.0/go.mod h1:hR9iAlh3x9gEg5GfALrrkN/2SbGkgZQCmwO2GZWjC1M=
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
|
||||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
||||||
github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0=
|
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3 h1:1jE11HLmMHDYYAcE+UmQ5VHgz4stzz0+daJbDWS+sEs=
|
||||||
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3/go.mod h1:Yf41v210LFyYAj+tGmDh7PHdGsTaZjdBzHG0ptUvihw=
|
||||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||||
github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI=
|
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
|
||||||
github.com/valyala/fasthttp v1.4.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
github.com/valyala/fasthttp v1.9.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
|
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||||
github.com/valyala/fasthttp v1.16.0 h1:9zAqOYLl8Tuy3E5R6ckzGDJ1g8+pw15oQp2iL9Jl6gQ=
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA=
|
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
|
||||||
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
|
||||||
github.com/vmihailenco/bufpool v0.1.5 h1:mEO/biwhAgiY97yPMmAdH4PvaIu63C6uGBdfSdoMo/I=
|
go.opentelemetry.io/auto/sdk v1.2.2 h1:ErNn7NW2t1F9CFBLb9iyPMyLRbcEd07l5m/StCe9AEE=
|
||||||
github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk=
|
go.opentelemetry.io/auto/sdk v1.2.2/go.mod h1:Ca3X8ec6gdTYjAirla//dnp05ECtQPfN4Ut74OJLVsQ=
|
||||||
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0 h1:jva1c3z2ZFEQ5sTvnLG2tBALNehO+QvdXKQii6eKRoo=
|
||||||
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0/go.mod h1:3pjFS5EnOVfjvYO6/NMdtJFHFQR+8uiGtrZ965nZP4w=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.5/go.mod h1:DuaveEe48abshDmz5UBKyZ+yDugvaeFk5ayfrewUOaw=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 h1:LxwW/9ctSCv+QkE/cLR7M91ZIkXNMqJtEMi1vCw9U8s=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.7 h1:Aj4eMY2qXTRfWRwHKJ2n/CWKVy15pCYN327QMJ/OUVs=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0/go.mod h1:tOsftB4SslBwwErVEPaenU2RpThXWPIU8DoJHEC4dyw=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.7/go.mod h1:Ii+PksJlvFT5ZRcB/4YLAInMIp6a0WOCm0L3BU0aNG4=
|
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.11 h1:Q47CePddpNGNhk4GCnAx9DDtASi2rasatE0cd26cZoE=
|
go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.11/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54=
|
||||||
github.com/vmihailenco/tagparser v0.1.0/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck=
|
||||||
github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 h1:aXZXsZ012wOgVkqaiQv+Z/d8V0xKjmg70F6m4CE94lc=
|
||||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0/go.mod h1:ziu1gUIJhAaxM3EV1e3Ralk5AAyL1UOYz3lJJ4VSI38=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI=
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw=
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY=
|
||||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU=
|
||||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I=
|
||||||
go.opentelemetry.io/otel v0.5.0 h1:tdIR1veg/z+VRJaw/6SIxz+QX3l+m+BDleYLTs+GC1g=
|
go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0=
|
||||||
go.opentelemetry.io/otel v0.5.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek=
|
go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw=
|
||||||
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
|
go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw=
|
||||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM=
|
||||||
go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
|
go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0=
|
||||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
go.opentelemetry.io/proto/otlp v1.11.1 h1:SCrPqH9NE5CmBrOqpjNCiT0X5mGwMyGERXdogfR7Yjw=
|
||||||
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
|
go.opentelemetry.io/proto/otlp v1.11.1/go.mod h1:wq8W4aSf6bOy8RZyESOeQFr9Pu7wydWX/TY4sgvrTPg=
|
||||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
go.uber.org/atomic v1.12.0 h1:BvcXdFKuviU4fTL/f+SxdQ5qJX/Jix8pAkgdUcb3XOE=
|
||||||
go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc=
|
go.uber.org/atomic v1.12.0/go.mod h1:I6c4cg+6HCxRjfjSsYtApoFILnpc0CGUdGkXVqbYVNk=
|
||||||
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q=
|
||||||
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
go.yaml.in/yaml/v2 v2.4.5 h1:a5nxWvYi94DRl6QSLlTbLpVmutgx2qg8EVjnJtuFpwI=
|
||||||
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
go.yaml.in/yaml/v2 v2.4.5/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c=
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U=
|
||||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
golang.org/x/net v0.63.0 h1:HCoTmNh9EpD1PpK8gBNFY4gcTY4N+KQEO8ylfIKqFJ0=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig=
|
||||||
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs=
|
||||||
golang.org/x/crypto v0.0.0-20191128160524-b544559bb6d1/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||||
golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
|
||||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw=
|
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2 h1:TVEW5ciB4lPlyo3RBDd2JTlUY0vAzMkPlU/qAzC+rqU=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
google.golang.org/genproto/googleapis/api v0.0.0-20261123191846-1e707ab9fbc2/go.mod h1:3q/FqMoaJXT/mbOLAkZaCXuOEpmvBNwYXqdJKeN0gD0=
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2 h1:FCWn4wv5of/ooWpbWDIeOXqI3+h2MGnV7SvvcJ8f+bQ=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20261123191846-1e707ab9fbc2/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw=
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ=
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
|
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
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 h1:oQFmpjL+rb2xLkgPCpdGSAGDdq1geTZVvIfCMxSB/wQ=
|
|
||||||
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=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
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=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.2 h1:8w2Ud1JmaU9M5os2j8aKMpPs4guVq+RMUN5phK2najE=
|
|
||||||
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=
|
|
||||||
@@ -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, path := proxy.Find(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
|
|
||||||
}
|
|
||||||
@@ -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\"}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
// nolint:mnd,gosec
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package httperrors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"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]any{
|
||||||
|
"errorCode": http.StatusText(e.statusCode),
|
||||||
|
"errorMessage": e.userMessage,
|
||||||
|
"details": e.details,
|
||||||
|
}
|
||||||
|
err := json.NewEncoder(w).Encode(data)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "json encode error")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *HttpError) WithDetails(details ...any) {
|
||||||
|
e.details = details
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
)
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,117 +1,39 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"isp-gate-service/assembly"
|
||||||
"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"
|
|
||||||
log "github.com/integration-system/isp-log"
|
|
||||||
"github.com/integration-system/isp-log/stdcodes"
|
|
||||||
"isp-gate-service/accounting"
|
|
||||||
"isp-gate-service/authenticate"
|
|
||||||
"isp-gate-service/conf"
|
"isp-gate-service/conf"
|
||||||
"isp-gate-service/invoker"
|
|
||||||
"isp-gate-service/model"
|
"github.com/txix-open/isp-kit/bootstrap"
|
||||||
"isp-gate-service/proxy"
|
"github.com/txix-open/isp-kit/cluster"
|
||||||
"isp-gate-service/redis"
|
"github.com/txix-open/isp-kit/shutdown"
|
||||||
"isp-gate-service/routing"
|
|
||||||
"isp-gate-service/server"
|
|
||||||
"isp-gate-service/service"
|
|
||||||
"isp-gate-service/service/matcher"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg := config.InitConfig(&conf.Configuration{}).(*conf.Configuration)
|
boot := bootstrap.New(version, conf.Remote{}, nil, cluster.HttpTransport)
|
||||||
|
app := boot.App
|
||||||
|
logger := app.Logger()
|
||||||
|
|
||||||
bs := bootstrap.
|
assembly, err := assembly.New(boot)
|
||||||
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())
|
|
||||||
|
|
||||||
requiredModules, err := proxy.InitProxies(cfg.Locations)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(stdcodes.ModuleInvalidLocalConfig, err)
|
logger.Fatal(app.Context(), err)
|
||||||
}
|
}
|
||||||
for module, consumer := range requiredModules {
|
app.AddRunners(assembly.Runners()...)
|
||||||
bs.RequireModule(module, consumer, false)
|
app.AddClosers(assembly.Closers()...)
|
||||||
}
|
|
||||||
bs.RequireModule(cfg.ModuleName, accounting.NewConnectionConsumer, false).
|
|
||||||
OnShutdown(onShutdown).
|
|
||||||
OnRemoteConfigReceive(onRemoteConfigReceive).
|
|
||||||
Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
func onLocalConfigLoad(_ *conf.Configuration) {
|
shutdown.On(func() {
|
||||||
|
logger.Info(app.Context(), "starting shutdown")
|
||||||
|
app.Shutdown()
|
||||||
|
logger.Info(app.Context(), "shutdown completed")
|
||||||
|
})
|
||||||
|
|
||||||
}
|
err = app.Run()
|
||||||
|
|
||||||
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)
|
|
||||||
err := proxy.InitProxiesFromConfigs(configs)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(stdcodes.ReceiveErrorFromConfig, err)
|
app.Shutdown()
|
||||||
}
|
logger.Fatal(app.Context(), err)
|
||||||
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{},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AdminAuthorizer interface {
|
||||||
|
AdminAuthorize(ctx context.Context, adminId int, permission string) (bool, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdminAuthorize(authorizer AdminAuthorizer) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
endpointMeta := ctx.EndpointMeta()
|
||||||
|
|
||||||
|
isInner := endpointMeta.Inner
|
||||||
|
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'",
|
||||||
|
endpointMeta.Endpoint),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
requiredPerm := endpointMeta.RequiredAdminPermission
|
||||||
|
if requiredPerm == "" {
|
||||||
|
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",
|
||||||
|
endpointMeta.Endpoint, requiredPerm, ctx.AdminId(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return next.Handle(ctx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
applicationTokenHeader = "x-application-token"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Authenticator interface {
|
||||||
|
Authenticate(ctx context.Context, token string) (*domain.AuthenticateAppResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Authenticate(authenticator Authenticator) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
if ctx.SkipAppAuth() {
|
||||||
|
return next.Handle(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
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(*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
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Authorizer interface {
|
||||||
|
Authorize(ctx context.Context, applicationId int, httpMethod string, pathSchema string) (bool, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Authorize(authorizer Authorizer, logger log.Logger) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
if ctx.SkipAppAuth() {
|
||||||
|
return next.Handle(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
authData, err := ctx.GetAuthData()
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "authorize: get auth data")
|
||||||
|
}
|
||||||
|
|
||||||
|
endpointMeta := ctx.EndpointMeta()
|
||||||
|
ok, err := authorizer.Authorize(
|
||||||
|
ctx.Context(),
|
||||||
|
authData.ApplicationId,
|
||||||
|
ctx.Request().Method,
|
||||||
|
endpointMeta.PathSchema,
|
||||||
|
)
|
||||||
|
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.String("applicationName", authData.AppName),
|
||||||
|
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' with http method '%s' is not allowed for application '%d'",
|
||||||
|
endpointMeta.PathSchema, ctx.Request().Method, authData.ApplicationId,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return next.Handle(ctx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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 {
|
||||||
|
if ctx.SkipAppAuth() {
|
||||||
|
return next.Handle(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EntryPointConfig struct {
|
||||||
|
PathPrefix string
|
||||||
|
WithPrefix bool
|
||||||
|
ErrorOnUnknownEndpoint bool
|
||||||
|
WithLendingSlash bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type EndpointResolver interface {
|
||||||
|
ResolveEndpoint(method string, path string, cfg EntryPointConfig) (*domain.EndpointMeta, error)
|
||||||
|
GetPaths(path string, cfg EntryPointConfig) (string, 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, err := entryPointResolver.ResolveEndpoint(req.Method, req.URL.Path, cfg)
|
||||||
|
if err != nil {
|
||||||
|
lookupPath, endpoint := entryPointResolver.GetPaths(req.URL.Path, cfg)
|
||||||
|
logger.Warn(
|
||||||
|
req.Context(),
|
||||||
|
"call unknown method",
|
||||||
|
log.String("pathPrefix", cfg.PathPrefix),
|
||||||
|
log.String("httpMethod", req.Method),
|
||||||
|
log.String("originalPath", req.URL.Path),
|
||||||
|
log.String("lookupPath", lookupPath),
|
||||||
|
log.String("enpoint", endpoint),
|
||||||
|
)
|
||||||
|
|
||||||
|
http.Error(writer, err.Error(), http.StatusNotImplemented)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := request.NewContext(req, writer, endpoint)
|
||||||
|
|
||||||
|
err = next.Handle(ctx)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(req.Context(), errors.WithMessage(err, "uncaught error"))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -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())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"isp-gate-service/request"
|
||||||
|
)
|
||||||
|
|
||||||
|
func JsonResponseUtf8Charset(applicationIds map[int]bool) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
authData, _ := ctx.GetAuthData()
|
||||||
|
ctx.EnableHttpJsonUtf8Charset(applicationIds[authData.ApplicationId])
|
||||||
|
return next.Handle(ctx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"isp-gate-service/helpers"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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")
|
||||||
|
}
|
||||||
|
conn, rw, err := upstream.Hijack()
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, errors.WithMessage(err, "hijack error")
|
||||||
|
}
|
||||||
|
return conn, rw, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
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,funlen
|
||||||
|
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()
|
||||||
|
|
||||||
|
endpoint := ctx.EndpointMeta().NormalizedEndpoint
|
||||||
|
logBodyFromCurrenRequest := enableBodyLogging
|
||||||
|
if logBodyFromCurrenRequest {
|
||||||
|
for _, prefix := range skipBodyLoggingEndpointPrefixes {
|
||||||
|
if strings.HasPrefix(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", endpoint),
|
||||||
|
log.Int("applicationId", authData.ApplicationId),
|
||||||
|
log.String("applicationName", authData.AppName),
|
||||||
|
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()))
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case scSrc.StatusCode() >= http.StatusInternalServerError:
|
||||||
|
logger.Error(ctx.Context(), "log request", fields...)
|
||||||
|
case scSrc.StatusCode() >= http.StatusBadRequest:
|
||||||
|
logger.Warn(ctx.Context(), "log request", fields...)
|
||||||
|
default:
|
||||||
|
logger.Debug(ctx.Context(), "log request", fields...)
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors.WithMessage(err, "logger middleware error")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/metrics/http_metrics"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Metrics(storage *http_metrics.ServerStorage) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
pathSchema := ctx.EndpointMeta().PathSchema
|
||||||
|
if pathSchema == "" {
|
||||||
|
return next.Handle(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
r := ctx.Request()
|
||||||
|
|
||||||
|
start := time.Now()
|
||||||
|
err := next.Handle(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "metrics middleware error")
|
||||||
|
}
|
||||||
|
|
||||||
|
storage.ObserveDuration(r.Method, pathSchema, time.Since(start))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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, modernize
|
||||||
|
func Chain(root Handler, middlewares ...Middleware) Handler {
|
||||||
|
for i := len(middlewares) - 1; i >= 0; i-- {
|
||||||
|
root = middlewares[i](root)
|
||||||
|
}
|
||||||
|
return root
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
"github.com/txix-open/isp-kit/requestid"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RequestId() Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
requestId := requestid.Next()
|
||||||
|
|
||||||
|
context := requestid.ToContext(ctx.Context(), requestId)
|
||||||
|
context = log.ToContext(context, log.String(requestid.LogKey, requestId))
|
||||||
|
|
||||||
|
ctx.SetContext(context)
|
||||||
|
return next.Handle(ctx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ClientRequestId(forwardClientRequestId bool, forwardReqIdByApp map[int]bool) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
requestId := requestid.FromContext(ctx.Context())
|
||||||
|
clientRequestId := strings.TrimSpace(ctx.Request().Header.Get(requestid.Header))
|
||||||
|
|
||||||
|
clientLogFields := make([]log.Field, 0, 1)
|
||||||
|
if clientRequestId != "" {
|
||||||
|
authData, _ := ctx.GetAuthData()
|
||||||
|
if forwardClientRequestId || forwardReqIdByApp[authData.ApplicationId] {
|
||||||
|
requestId = clientRequestId
|
||||||
|
}
|
||||||
|
|
||||||
|
clientLogFields = append(clientLogFields, log.String("clientRequestId", clientRequestId))
|
||||||
|
}
|
||||||
|
|
||||||
|
context := requestid.ToContext(ctx.Context(), requestId)
|
||||||
|
context = log.RewriteContextField(context, log.String(requestid.LogKey, requestId))
|
||||||
|
context = log.ToContext(context, clientLogFields...)
|
||||||
|
|
||||||
|
ctx.SetContext(context)
|
||||||
|
return next.Handle(ctx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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 {
|
||||||
|
if ctx.SkipAppAuth() {
|
||||||
|
return next.Handle(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserAuthenticator interface {
|
||||||
|
Authenticate(ctx *request.Context) (*domain.AuthenticateUserResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func UserAuthenticate(authenticator UserAuthenticator, logger log.Logger) Middleware {
|
||||||
|
return func(next Handler) Handler {
|
||||||
|
return HandlerFunc(func(ctx *request.Context) error {
|
||||||
|
resp, err := authenticator.Authenticate(ctx)
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, domain.ErrEmptyUserToken):
|
||||||
|
return httperrors.New(
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
"user token required",
|
||||||
|
errors.New("customAuth: authenticate user: user token required"),
|
||||||
|
)
|
||||||
|
case errors.Is(err, domain.ErrInvalidUserToken):
|
||||||
|
return httperrors.New(
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
"invalid user token",
|
||||||
|
errors.WithMessage(err, "customAuth: authenticate user: invalid user token"),
|
||||||
|
)
|
||||||
|
case err != nil:
|
||||||
|
return errors.WithMessage(err, "customAuth: authenticate user: authenticator error")
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp.SkipUserAuth {
|
||||||
|
return next.Handle(ctx)
|
||||||
|
}
|
||||||
|
if !resp.Authenticated {
|
||||||
|
return httperrors.New(
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
"invalid user token",
|
||||||
|
errors.Errorf("customAuth: authenticate user: authenticate: %s", resp.ErrorReason),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.AuthenticateUser(*resp.AuthData)
|
||||||
|
|
||||||
|
if ctx.SkipAppAuth() {
|
||||||
|
logger.Debug(
|
||||||
|
ctx.Context(),
|
||||||
|
"skip app auth is set. All steps that require app auth data are skipped",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return next.Handle(ctx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
@@ -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}
|
|
||||||
)
|
|
||||||
@@ -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()
|
|
||||||
}
|
|
||||||
@@ -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()
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package proxy
|
||||||
|
|
||||||
|
const (
|
||||||
|
xAdminIdHeader = "x-admin-id"
|
||||||
|
)
|
||||||
+193
@@ -0,0 +1,193 @@
|
|||||||
|
// nolint:gochecknoinits
|
||||||
|
package proxy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
|
"io"
|
||||||
|
"maps"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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 (
|
||||||
|
// nolint: gochecknoglobals
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
// nolint: gochecknoglobals
|
||||||
|
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 := p.writeMetadata(ctx)
|
||||||
|
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.EndpointMeta().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 any, 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
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Grpc) writeMetadata(ctx *request.Context) metadata.MD {
|
||||||
|
requestId := requestid.FromContext(ctx.Context())
|
||||||
|
md := metadata.MD{
|
||||||
|
grpc.ProxyMethodNameHeader: {ctx.EndpointMeta().Endpoint},
|
||||||
|
requestid.Header: {requestId},
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.skipAuth {
|
||||||
|
return md
|
||||||
|
}
|
||||||
|
|
||||||
|
appAuthData, err := ctx.GetAuthData()
|
||||||
|
if err == nil {
|
||||||
|
md[grpc.SystemIdHeader] = []string{strconv.Itoa(appAuthData.SystemId)}
|
||||||
|
md[grpc.DomainIdHeader] = []string{strconv.Itoa(appAuthData.DomainId)}
|
||||||
|
md[grpc.ServiceIdHeader] = []string{strconv.Itoa(appAuthData.ServiceId)}
|
||||||
|
md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(appAuthData.ApplicationId)}
|
||||||
|
encodedAppName := base64.StdEncoding.EncodeToString([]byte(appAuthData.AppName))
|
||||||
|
md[grpc.ApplicationNameHeader] = []string{encodedAppName}
|
||||||
|
}
|
||||||
|
|
||||||
|
userAuthData, err := ctx.GetUserAuthData()
|
||||||
|
if err == nil {
|
||||||
|
proxyHeaders := maps.Clone(userAuthData.ExtraHeaders)
|
||||||
|
proxyHeaders[userAuthData.IdentityHeader] = []string{userAuthData.Identity}
|
||||||
|
for header, values := range proxyHeaders {
|
||||||
|
header = strings.ToLower(header)
|
||||||
|
if strings.HasPrefix(header, "x-") {
|
||||||
|
md.Set(header, values...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.IsAdminAuthenticated() {
|
||||||
|
md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())}
|
||||||
|
}
|
||||||
|
return md
|
||||||
|
}
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package grpc
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/integration-system/isp-lib/v2/backend"
|
|
||||||
"github.com/integration-system/isp-lib/v2/structure"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"isp-gate-service/conf"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/proxy/grpc/handlers"
|
|
||||||
)
|
|
||||||
|
|
||||||
type grpcProxy struct {
|
|
||||||
client *backend.RxGrpcClient
|
|
||||||
skipAuth bool
|
|
||||||
skipExistCheck bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewProxy(skipAuth, skipExistCheck bool) *grpcProxy {
|
|
||||||
return &grpcProxy{
|
|
||||||
client: backend.NewRxGrpcClient(
|
|
||||||
backend.WithDialOptions(
|
|
||||||
grpc.WithInsecure(),
|
|
||||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(conf.DefaultMaxResponseBodySize))),
|
|
||||||
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(int(conf.DefaultMaxResponseBodySize))),
|
|
||||||
)),
|
|
||||||
skipAuth: skipAuth,
|
|
||||||
skipExistCheck: skipExistCheck,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *grpcProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.ProxyResponse {
|
|
||||||
return handlers.Handler.Get(ctx).Complete(ctx, path, p.client)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *grpcProxy) Consumer(addr []structure.AddressConfiguration) bool {
|
|
||||||
return p.client.ReceiveAddressList(addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *grpcProxy) SkipAuth() bool {
|
|
||||||
return p.skipAuth
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *grpcProxy) SkipExistCheck() bool {
|
|
||||||
return p.skipExistCheck
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *grpcProxy) Close() {
|
|
||||||
_ = p.client.Close()
|
|
||||||
}
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
package handlers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
structpb "github.com/golang/protobuf/ptypes/struct"
|
|
||||||
"github.com/integration-system/isp-lib/v2/backend"
|
|
||||||
"github.com/integration-system/isp-lib/v2/config"
|
|
||||||
http2 "github.com/integration-system/isp-lib/v2/http"
|
|
||||||
"github.com/integration-system/isp-lib/v2/isp"
|
|
||||||
"github.com/integration-system/isp-lib/v2/structure"
|
|
||||||
"github.com/integration-system/isp-lib/v2/utils"
|
|
||||||
log "github.com/integration-system/isp-log"
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
"isp-gate-service/conf"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/log_code"
|
|
||||||
utils2 "isp-gate-service/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
headerKeyContentDisposition = "Content-Disposition"
|
|
||||||
headerKeyContentType = "Content-Type"
|
|
||||||
headerKeyContentLength = "Content-Length"
|
|
||||||
headerKeyTransferEncoding = "Transfer-Encoding"
|
|
||||||
|
|
||||||
errorMsgInternal = "Internal server error"
|
|
||||||
errorMsgInvalidArg = "Not able to read request body"
|
|
||||||
)
|
|
||||||
|
|
||||||
var json = jsoniter.ConfigFastest
|
|
||||||
|
|
||||||
func convertError(err error) ([]byte, int) {
|
|
||||||
s, ok := status.FromError(err)
|
|
||||||
if !ok {
|
|
||||||
return []byte(utils.ServiceError), http.StatusServiceUnavailable
|
|
||||||
}
|
|
||||||
cfg := config.GetRemote().(*conf.RemoteConfig).GrpcSetting
|
|
||||||
if cfg.EnableOriginalProtoErrors {
|
|
||||||
body, err := proto.Marshal(s.Proto())
|
|
||||||
if err != nil {
|
|
||||||
return []byte(utils.ServiceError), http.StatusServiceUnavailable
|
|
||||||
}
|
|
||||||
return body, http2.CodeToHttpStatus(s.Code())
|
|
||||||
}
|
|
||||||
|
|
||||||
details := s.Details()
|
|
||||||
newDetails := make([]interface{}, len(details))
|
|
||||||
for i, detail := range details {
|
|
||||||
switch typeOfDetail := detail.(type) {
|
|
||||||
case *structpb.Struct:
|
|
||||||
newDetails[i] = utils.ConvertGrpcStructToInterface(
|
|
||||||
&structpb.Value{Kind: &structpb.Value_StructValue{StructValue: typeOfDetail}},
|
|
||||||
)
|
|
||||||
case *isp.Message:
|
|
||||||
newDetails[i] = utils.ConvertGrpcStructToInterface(
|
|
||||||
backend.ResolveBody(typeOfDetail),
|
|
||||||
)
|
|
||||||
default:
|
|
||||||
newDetails[i] = typeOfDetail
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var respBody interface{}
|
|
||||||
if cfg.ProxyGrpcErrorDetails && len(newDetails) > 0 {
|
|
||||||
respBody = newDetails[0]
|
|
||||||
} else {
|
|
||||||
respBody = structure.GrpcError{ErrorMessage: s.Message(), ErrorCode: s.Code().String(), Details: newDetails}
|
|
||||||
}
|
|
||||||
|
|
||||||
errorData, err := json.Marshal(respBody)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn(log_code.WarnConvertErrorDataMarshalResponse, err)
|
|
||||||
return []byte(utils.ServiceError), http.StatusServiceUnavailable
|
|
||||||
}
|
|
||||||
return errorData, http2.CodeToHttpStatus(s.Code())
|
|
||||||
}
|
|
||||||
|
|
||||||
func getResponse(msg *isp.Message, err error) ([]byte, int, error) {
|
|
||||||
if err != nil {
|
|
||||||
errorBody, errorStatus := convertError(err)
|
|
||||||
return errorBody, errorStatus, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes := msg.GetBytesBody()
|
|
||||||
if bytes != nil {
|
|
||||||
return bytes, http.StatusOK, nil
|
|
||||||
}
|
|
||||||
result := backend.ResolveBody(msg)
|
|
||||||
data := utils.ConvertGrpcStructToInterface(result)
|
|
||||||
byteResponse, err := json.Marshal(data)
|
|
||||||
return byteResponse, http.StatusOK, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func logHandlerError(typeData, method string, err error) {
|
|
||||||
log.WithMetadata(map[string]interface{}{
|
|
||||||
log_code.MdTypeData: typeData,
|
|
||||||
log_code.MdMethod: method,
|
|
||||||
}).Warn(log_code.WarnProxyGrpcHandler, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func openStream(headers *fasthttp.RequestHeader, method string, timeout time.Duration, client *backend.RxGrpcClient) (
|
|
||||||
isp.BackendService_RequestStreamClient, context.CancelFunc, error) {
|
|
||||||
cli := client.Conn()
|
|
||||||
md, _ := makeMetadata(headers, method)
|
|
||||||
ctx := metadata.NewOutgoingContext(context.Background(), md)
|
|
||||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
|
||||||
stream, err := cli.RequestStream(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
return stream, cancel, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeMetadata(r *fasthttp.RequestHeader, method string) (metadata.MD, string) {
|
|
||||||
md := make(metadata.MD, 5)
|
|
||||||
md[utils.ProxyMethodNameHeader] = []string{method}
|
|
||||||
r.VisitAll(func(key, v []byte) {
|
|
||||||
lowerHeader := bytes.ToLower(key)
|
|
||||||
if len(v) > 0 && bytes.HasPrefix(lowerHeader, []byte("x-")) {
|
|
||||||
md[string(lowerHeader)] = []string{string(v)}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return md, method
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkError(err error, ctx *fasthttp.RequestCtx, method string) (bool, bool, domain.ProxyResponse) {
|
|
||||||
var (
|
|
||||||
ok = true
|
|
||||||
eof = false
|
|
||||||
resp = domain.ProxyResponse{}
|
|
||||||
msg = errorMsgInternal
|
|
||||||
code = codes.Internal
|
|
||||||
details []interface{} = nil
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
if err != io.EOF {
|
|
||||||
s, itStatus := status.FromError(err)
|
|
||||||
if itStatus {
|
|
||||||
msg = s.Message()
|
|
||||||
code = s.Code()
|
|
||||||
details = s.Details()
|
|
||||||
}
|
|
||||||
logHandlerError(log_code.TypeData.GetFile, method, err)
|
|
||||||
utils2.WriteError(ctx, msg, code, details)
|
|
||||||
resp = domain.Create().SetError(err)
|
|
||||||
ok, eof = false, false
|
|
||||||
} else {
|
|
||||||
ok, eof = true, true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok, eof, resp
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package handlers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/integration-system/isp-lib/v2/backend"
|
|
||||||
u "github.com/integration-system/isp-lib/v2/utils"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/utils"
|
|
||||||
"mime"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Handler handlerHelper
|
|
||||||
|
|
||||||
type (
|
|
||||||
handlerHelper struct{}
|
|
||||||
|
|
||||||
handler interface {
|
|
||||||
Complete(ctx *fasthttp.RequestCtx, method string, client *backend.RxGrpcClient) domain.ProxyResponse
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func (h handlerHelper) Get(ctx *fasthttp.RequestCtx) handler {
|
|
||||||
isMultipart := h.isMultipart(ctx)
|
|
||||||
isExpectFile := string(ctx.Request.Header.Peek(u.ExpectFileHeader)) == "true"
|
|
||||||
|
|
||||||
if isMultipart {
|
|
||||||
ctx.Response.Header.SetContentTypeBytes(utils.JsonContentType)
|
|
||||||
return sendMultipartData
|
|
||||||
}
|
|
||||||
if isExpectFile {
|
|
||||||
return getFile
|
|
||||||
}
|
|
||||||
ctx.Response.Header.SetContentTypeBytes(utils.JsonContentType)
|
|
||||||
return handleJson
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h handlerHelper) isMultipart(ctx *fasthttp.RequestCtx) bool {
|
|
||||||
if !ctx.IsPost() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
v := string(ctx.Request.Header.ContentType())
|
|
||||||
if v == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
d, params, err := mime.ParseMediaType(v)
|
|
||||||
if err != nil || d != "multipart/form-data" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
_, ok := params["boundary"]
|
|
||||||
return ok
|
|
||||||
}
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
package handlers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/integration-system/isp-lib/v2/backend"
|
|
||||||
"github.com/integration-system/isp-lib/v2/config"
|
|
||||||
"github.com/integration-system/isp-lib/v2/isp"
|
|
||||||
s "github.com/integration-system/isp-lib/v2/streaming"
|
|
||||||
u "github.com/integration-system/isp-lib/v2/utils"
|
|
||||||
log "github.com/integration-system/isp-log"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"io"
|
|
||||||
"isp-gate-service/conf"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/log_code"
|
|
||||||
"isp-gate-service/utils"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
errInvalidJson = errors.New("invalid json format. Expected object or array")
|
|
||||||
getFile getFileDesc
|
|
||||||
)
|
|
||||||
|
|
||||||
type getFileDesc struct{}
|
|
||||||
|
|
||||||
func (g getFileDesc) Complete(ctx *fasthttp.RequestCtx, method string, client *backend.RxGrpcClient) domain.ProxyResponse {
|
|
||||||
req, err := g.readJsonBody(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return g.formError(ctx, err, method, err.Error(), codes.InvalidArgument)
|
|
||||||
}
|
|
||||||
|
|
||||||
timeout := config.GetRemote().(*conf.RemoteConfig).GrpcSetting.GetStreamInvokeTimeout()
|
|
||||||
stream, cancel, err := openStream(&ctx.Request.Header, method, timeout, client)
|
|
||||||
defer func() {
|
|
||||||
if cancel != nil {
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
return g.formError(ctx, err, method, errorMsgInternal, codes.Internal)
|
|
||||||
}
|
|
||||||
|
|
||||||
if req != nil {
|
|
||||||
value := u.ConvertInterfaceToGrpcStruct(req)
|
|
||||||
err := stream.Send(backend.WrapBody(value))
|
|
||||||
if err != nil {
|
|
||||||
return g.formError(ctx, err, method, errorMsgInternal, codes.Internal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := stream.Recv()
|
|
||||||
if err != nil {
|
|
||||||
response, status, err := getResponse(nil, err)
|
|
||||||
if err == nil {
|
|
||||||
ctx.SetStatusCode(status)
|
|
||||||
ctx.SetBody(response)
|
|
||||||
}
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
bf := s.BeginFile{}
|
|
||||||
err = bf.FromMessage(msg)
|
|
||||||
if err != nil {
|
|
||||||
response, status, err := getResponse(nil, err)
|
|
||||||
if err == nil {
|
|
||||||
ctx.SetStatusCode(status)
|
|
||||||
ctx.SetBody(response)
|
|
||||||
}
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
header := &ctx.Response.Header
|
|
||||||
header.Set(headerKeyContentDisposition, fmt.Sprintf("attachment; filename=%s", bf.FileName))
|
|
||||||
header.Set(headerKeyContentType, bf.ContentType)
|
|
||||||
if bf.ContentLength > 0 {
|
|
||||||
header.Set(headerKeyContentLength, strconv.Itoa(int(bf.ContentLength)))
|
|
||||||
} else {
|
|
||||||
header.Set(headerKeyTransferEncoding, "chunked")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = g.write(ctx, stream, method)
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
//nolint
|
|
||||||
func (getFileDesc) write(ctx *fasthttp.RequestCtx, stream isp.BackendService_RequestStreamClient, method string) error {
|
|
||||||
for {
|
|
||||||
msg, err := stream.Recv()
|
|
||||||
if s.IsEndOfFile(msg) || err == io.EOF {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
logHandlerError(log_code.TypeData.GetFile, method, err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
bytes := msg.GetBytesBody()
|
|
||||||
if bytes == nil {
|
|
||||||
log.WithMetadata(map[string]interface{}{
|
|
||||||
log_code.MdTypeData: log_code.TypeData.GetFile,
|
|
||||||
log_code.MdMethod: method,
|
|
||||||
}).Errorf(log_code.WarnProxyGrpcHandler, "Method %s. Expected bytes array", method)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
_, err = ctx.Write(bytes)
|
|
||||||
if err != nil {
|
|
||||||
logHandlerError(log_code.TypeData.GetFile, method, err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (getFileDesc) readJsonBody(ctx *fasthttp.RequestCtx) (interface{}, error) {
|
|
||||||
requestBody := ctx.Request.Body()
|
|
||||||
var body interface{}
|
|
||||||
if len(requestBody) == 0 {
|
|
||||||
requestBody = []byte("{}")
|
|
||||||
}
|
|
||||||
switch requestBody[0] {
|
|
||||||
case '{':
|
|
||||||
body = make(map[string]interface{})
|
|
||||||
case '[':
|
|
||||||
body = make([]interface{}, 0)
|
|
||||||
default:
|
|
||||||
return nil, errInvalidJson
|
|
||||||
}
|
|
||||||
err := json.Unmarshal(requestBody, &body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return body, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (getFileDesc) formError(ctx *fasthttp.RequestCtx, err error, method, msg string, code codes.Code) domain.ProxyResponse {
|
|
||||||
logHandlerError(log_code.TypeData.GetFile, method, err)
|
|
||||||
utils.WriteError(ctx, msg, code, nil)
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package handlers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/integration-system/isp-lib/v2/backend"
|
|
||||||
"github.com/integration-system/isp-lib/v2/config"
|
|
||||||
"github.com/integration-system/isp-lib/v2/isp"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"isp-gate-service/conf"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/log_code"
|
|
||||||
"isp-gate-service/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
var handleJson handleJsonDesc
|
|
||||||
|
|
||||||
type handleJsonDesc struct{}
|
|
||||||
|
|
||||||
func (p handleJsonDesc) Complete(c *fasthttp.RequestCtx, method string, client *backend.RxGrpcClient) domain.ProxyResponse {
|
|
||||||
body := c.Request.Body()
|
|
||||||
|
|
||||||
md, methodName := makeMetadata(&c.Request.Header, method)
|
|
||||||
ctx := metadata.NewOutgoingContext(context.Background(), md)
|
|
||||||
grpcSetting := config.GetRemote().(*conf.RemoteConfig).GrpcSetting
|
|
||||||
ctx, cancel := context.WithTimeout(ctx, grpcSetting.GetSyncInvokeTimeout())
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
cli := client.Conn()
|
|
||||||
|
|
||||||
msg, invokerErr := cli.Request(
|
|
||||||
ctx,
|
|
||||||
&isp.Message{
|
|
||||||
Body: &isp.Message_BytesBody{BytesBody: body},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
if response, status, err := getResponse(msg, invokerErr); err == nil {
|
|
||||||
c.SetStatusCode(status)
|
|
||||||
c.SetContentTypeBytes(utils.JsonContentType)
|
|
||||||
c.Response.Header.SetContentLength(len(response))
|
|
||||||
_, _ = c.Write(response)
|
|
||||||
return domain.Create().SetRequestBody(body).SetResponseBody(c.Response.Body()).SetError(invokerErr)
|
|
||||||
} else {
|
|
||||||
logHandlerError(log_code.TypeData.JsonContent, methodName, err)
|
|
||||||
utils.WriteError(c, errorMsgInternal, codes.Internal, nil)
|
|
||||||
return domain.Create().SetRequestBody(body).SetResponseBody(c.Response.Body()).SetError(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
package handlers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/integration-system/isp-lib/v2/backend"
|
|
||||||
"github.com/integration-system/isp-lib/v2/config"
|
|
||||||
"github.com/integration-system/isp-lib/v2/isp"
|
|
||||||
s "github.com/integration-system/isp-lib/v2/streaming"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"isp-gate-service/conf"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/log_code"
|
|
||||||
"isp-gate-service/utils"
|
|
||||||
"mime/multipart"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var sendMultipartData sendMultipartDataDesc
|
|
||||||
|
|
||||||
type sendMultipartDataDesc struct{}
|
|
||||||
|
|
||||||
func (h sendMultipartDataDesc) Complete(c *fasthttp.RequestCtx, method string, client *backend.RxGrpcClient) domain.ProxyResponse {
|
|
||||||
cfg := config.GetRemote().(*conf.RemoteConfig).GrpcSetting
|
|
||||||
timeout := cfg.GetStreamInvokeTimeout()
|
|
||||||
|
|
||||||
stream, cancel, err := openStream(&c.Request.Header, method, timeout, client)
|
|
||||||
defer func() {
|
|
||||||
if cancel != nil {
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if err != nil {
|
|
||||||
logHandlerError(log_code.TypeData.SendMultipart, method, err)
|
|
||||||
utils.WriteError(c, errorMsgInternal, codes.Internal, nil)
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
form, err := c.MultipartForm()
|
|
||||||
defer func() {
|
|
||||||
if form != nil {
|
|
||||||
_ = form.RemoveAll()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
logHandlerError(log_code.TypeData.SendMultipart, method, err)
|
|
||||||
utils.WriteError(c, errorMsgInvalidArg, codes.InvalidArgument, nil)
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, proxyResp, ok := h.formResponse(c, stream, form, method)
|
|
||||||
err = stream.CloseSend()
|
|
||||||
if err != nil {
|
|
||||||
logHandlerError(log_code.TypeData.SendMultipart, method, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ok {
|
|
||||||
arrayBody := strings.Join(resp, ",")
|
|
||||||
_, err = c.WriteString("[" + arrayBody + "]")
|
|
||||||
if err != nil {
|
|
||||||
logHandlerError(log_code.TypeData.SendMultipart, method, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return proxyResp
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h sendMultipartDataDesc) formResponse(c *fasthttp.RequestCtx, stream isp.BackendService_RequestStreamClient,
|
|
||||||
form *multipart.Form, method string) ([]string, domain.ProxyResponse, bool) {
|
|
||||||
formData := make(map[string]interface{}, len(form.Value))
|
|
||||||
for k, v := range form.Value {
|
|
||||||
if len(v) > 0 {
|
|
||||||
formData[k] = v[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
resp = make([]string, 0)
|
|
||||||
buffer = make([]byte, config.GetRemote().(*conf.RemoteConfig).GrpcSetting.GetTransferFileBufferSize())
|
|
||||||
proxyResp domain.ProxyResponse
|
|
||||||
ok = true
|
|
||||||
eof bool
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
for formDataName, files := range form.File {
|
|
||||||
if len(files) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
file := files[0]
|
|
||||||
fileName := file.Filename
|
|
||||||
contentType := file.Header.Get(headerKeyContentType)
|
|
||||||
contentLength := file.Size
|
|
||||||
bf := s.BeginFile{
|
|
||||||
FileName: fileName,
|
|
||||||
FormDataName: formDataName,
|
|
||||||
ContentType: contentType,
|
|
||||||
ContentLength: contentLength,
|
|
||||||
FormData: formData,
|
|
||||||
}
|
|
||||||
err = stream.Send(bf.ToMessage())
|
|
||||||
ok, eof, proxyResp = checkError(err, c, method)
|
|
||||||
if !ok || eof {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
f, err := file.Open()
|
|
||||||
ok, eof, proxyResp = checkError(err, c, method)
|
|
||||||
if !ok || eof {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
ok, eof, proxyResp = h.transferFile(f, stream, buffer, c, method)
|
|
||||||
if !ok || eof {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, invokeErr := stream.Recv()
|
|
||||||
ok, eof, proxyResp = checkError(invokeErr, c, method)
|
|
||||||
if !ok || eof {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
response, _, err := getResponse(msg, invokeErr)
|
|
||||||
if err != nil {
|
|
||||||
ok = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
resp = append(resp, string(response))
|
|
||||||
}
|
|
||||||
return resp, proxyResp, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sendMultipartDataDesc) transferFile(f multipart.File, stream isp.BackendService_RequestStreamClient,
|
|
||||||
buffer []byte, ctx *fasthttp.RequestCtx, method string) (bool, bool, domain.ProxyResponse) {
|
|
||||||
var (
|
|
||||||
ok = true
|
|
||||||
eof bool
|
|
||||||
proxyResp domain.ProxyResponse
|
|
||||||
)
|
|
||||||
for {
|
|
||||||
n, err := f.Read(buffer)
|
|
||||||
if n > 0 {
|
|
||||||
err = stream.Send(&isp.Message{Body: &isp.Message_BytesBody{BytesBody: buffer[:n]}})
|
|
||||||
ok, eof, proxyResp = checkError(err, ctx, method)
|
|
||||||
if !ok || eof {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
ok, eof, proxyResp = checkError(err, ctx, method)
|
|
||||||
if ok && eof {
|
|
||||||
err = stream.Send(s.FileEnd())
|
|
||||||
ok, eof, proxyResp = checkError(err, ctx, method)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok, eof, proxyResp
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package health_check
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/integration-system/isp-lib/v2/structure"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
)
|
|
||||||
|
|
||||||
type healthCheckProxy struct {
|
|
||||||
skipAuth bool
|
|
||||||
skipExistCheck bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewProxy(skipAuth, skipExistCheck bool) *healthCheckProxy {
|
|
||||||
return &healthCheckProxy{skipAuth: skipAuth, skipExistCheck: skipExistCheck}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *healthCheckProxy) Consumer(addressList []structure.AddressConfiguration) bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *healthCheckProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.ProxyResponse {
|
|
||||||
ctx.Response.SetBody(ctx.Request.Body())
|
|
||||||
ctx.Request.SetRequestURI(path)
|
|
||||||
return domain.Create()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *healthCheckProxy) SkipAuth() bool {
|
|
||||||
return p.skipAuth
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *healthCheckProxy) SkipExistCheck() bool {
|
|
||||||
return p.skipExistCheck
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *healthCheckProxy) Close() {
|
|
||||||
|
|
||||||
}
|
|
||||||
+140
@@ -0,0 +1,140 @@
|
|||||||
|
package proxy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/grpc"
|
||||||
|
"github.com/txix-open/isp-kit/requestid"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// nolint: gochecknoglobals, mnd
|
||||||
|
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.EndpointMeta().Endpoint
|
||||||
|
setHttpHeaders(ctx, request.Header, p.skipAuth)
|
||||||
|
|
||||||
|
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),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if ctx.IsJsonUtf8CharsetEnabled() {
|
||||||
|
reverseProxy.ModifyResponse = addJsonUtf8Charset
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
header.Set(requestid.Header, requestid.FromContext(ctx.Context()))
|
||||||
|
if skipAuth {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
userAuthData, err := ctx.GetUserAuthData()
|
||||||
|
if err == nil {
|
||||||
|
for key, values := range userAuthData.ExtraHeaders {
|
||||||
|
for _, value := range values {
|
||||||
|
header.Add(key, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.Set(userAuthData.IdentityHeader, userAuthData.Identity)
|
||||||
|
}
|
||||||
|
|
||||||
|
appAuthData, err := ctx.GetAuthData()
|
||||||
|
if err == nil {
|
||||||
|
header.Set(grpc.SystemIdHeader, strconv.Itoa(appAuthData.SystemId))
|
||||||
|
header.Set(grpc.DomainIdHeader, strconv.Itoa(appAuthData.DomainId))
|
||||||
|
header.Set(grpc.ServiceIdHeader, strconv.Itoa(appAuthData.ServiceId))
|
||||||
|
header.Set(grpc.ApplicationIdHeader, strconv.Itoa(appAuthData.ApplicationId))
|
||||||
|
encodedAppName := base64.StdEncoding.EncodeToString([]byte(appAuthData.AppName))
|
||||||
|
header.Set(grpc.ApplicationNameHeader, encodedAppName) //nolint:canonicalheader
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.IsAdminAuthenticated() {
|
||||||
|
header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader
|
||||||
|
} else {
|
||||||
|
header.Del(xAdminIdHeader) //nolint:canonicalheader
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) {
|
||||||
|
return dialer.DialContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func addJsonUtf8Charset(response *http.Response) error {
|
||||||
|
contentType := response.Header.Get("Content-Type")
|
||||||
|
if strings.EqualFold(contentType, "application/json") {
|
||||||
|
response.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
-168
@@ -1,168 +0,0 @@
|
|||||||
package proxy
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/integration-system/isp-lib/v2/structure"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/valyala/fasthttp"
|
|
||||||
"isp-gate-service/conf"
|
|
||||||
"isp-gate-service/domain"
|
|
||||||
"isp-gate-service/proxy/grpc"
|
|
||||||
"isp-gate-service/proxy/health_check"
|
|
||||||
"isp-gate-service/proxy/http"
|
|
||||||
"isp-gate-service/proxy/websocket"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
store = make([]storeItem, 0)
|
|
||||||
locationsStore = make([]storeItem, 0)
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
httpProtocol = "http"
|
|
||||||
websocketProtocol = "websocket"
|
|
||||||
grpcProtocol = "grpc"
|
|
||||||
healthCheckProtocol = "healthсheck"
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
Proxy interface {
|
|
||||||
ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.ProxyResponse
|
|
||||||
Consumer([]structure.AddressConfiguration) bool
|
|
||||||
SkipAuth() bool
|
|
||||||
SkipExistCheck() bool
|
|
||||||
Close()
|
|
||||||
}
|
|
||||||
storeItem struct {
|
|
||||||
pathPrefix string
|
|
||||||
paths []string // if pathPrefix is empty
|
|
||||||
proxy Proxy
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func InitProxies(locations []conf.Location) (map[string]func([]structure.AddressConfiguration) bool, error) {
|
|
||||||
locationsByTargetModule := conf.GetLocationsByTargetModule(locations)
|
|
||||||
requiredModules := make(map[string]func([]structure.AddressConfiguration) bool)
|
|
||||||
|
|
||||||
for targetModule, locations := range locationsByTargetModule {
|
|
||||||
consumerStorage := make([]func([]structure.AddressConfiguration) bool, len(locations))
|
|
||||||
for i, location := range locations {
|
|
||||||
if location.PathPrefix[0] != '/' {
|
|
||||||
return nil, errors.Errorf("path must begin with '/' in path '%s'", location.PathPrefix)
|
|
||||||
}
|
|
||||||
p, err := makeProxy(location.Protocol, location.SkipAuth, location.SkipExistCheck)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
store = append(store, storeItem{
|
|
||||||
pathPrefix: location.PathPrefix,
|
|
||||||
proxy: p,
|
|
||||||
})
|
|
||||||
consumerStorage[i] = p.Consumer
|
|
||||||
}
|
|
||||||
requiredModules[targetModule] = aggregateConsumers(consumerStorage...)
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Slice(store, func(i, j int) bool {
|
|
||||||
return store[i].pathPrefix > store[j].pathPrefix
|
|
||||||
})
|
|
||||||
locationsStore = store
|
|
||||||
return requiredModules, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func InitProxiesFromConfigs(configs structure.RoutingConfig) error {
|
|
||||||
store = locationsStore
|
|
||||||
for _, config := range configs { //nolint
|
|
||||||
ip := config.Address.IP
|
|
||||||
|
|
||||||
for protocol, info := range config.HandlersInfo {
|
|
||||||
p, err := makeProxy(protocol, info.SkipAuth, info.SkipExistCheck)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrapf(err, "bad dynamic config in service %s with protocol %s", config.ModuleName, protocol)
|
|
||||||
}
|
|
||||||
addressConfig := []structure.AddressConfiguration{{
|
|
||||||
Port: info.Port,
|
|
||||||
IP: ip,
|
|
||||||
}}
|
|
||||||
p.Consumer(addressConfig)
|
|
||||||
item := storeItem{
|
|
||||||
pathPrefix: "",
|
|
||||||
proxy: p,
|
|
||||||
paths: getPathsFromEndpoints(info.Endpoints),
|
|
||||||
}
|
|
||||||
store = append(store, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getPathsFromEndpoints(endpoints []structure.EndpointDescriptor) []string {
|
|
||||||
paths := make([]string, len(endpoints)-1)
|
|
||||||
for i := range endpoints {
|
|
||||||
endpoint := endpoints[i]
|
|
||||||
paths = append(paths, endpoint.Path)
|
|
||||||
}
|
|
||||||
return paths
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeProxy(protocol string, skipAuth, skipExistCheck bool) (Proxy, error) {
|
|
||||||
var proxy Proxy
|
|
||||||
switch protocol {
|
|
||||||
case httpProtocol:
|
|
||||||
proxy = http.NewProxy(skipAuth, skipExistCheck)
|
|
||||||
case grpcProtocol:
|
|
||||||
proxy = grpc.NewProxy(skipAuth, skipExistCheck)
|
|
||||||
case healthCheckProtocol:
|
|
||||||
proxy = health_check.NewProxy(skipAuth, skipExistCheck)
|
|
||||||
case websocketProtocol:
|
|
||||||
proxy = websocket.NewProxy(skipAuth, skipExistCheck)
|
|
||||||
default:
|
|
||||||
return nil, errors.Errorf("unknown protocol '%s'", protocol)
|
|
||||||
}
|
|
||||||
|
|
||||||
return proxy, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Find(path string) (Proxy, string) {
|
|
||||||
for _, item := range store {
|
|
||||||
if item.pathPrefix != "" {
|
|
||||||
if strings.HasPrefix(path, item.pathPrefix) {
|
|
||||||
return item.proxy, getPathWithoutPrefix(path, item.pathPrefix)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, iPath := range item.paths {
|
|
||||||
if path == iPath {
|
|
||||||
return item.proxy, path
|
|
||||||
}
|
|
||||||
if path == "/"+iPath {
|
|
||||||
return item.proxy, path[1:]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func Close() {
|
|
||||||
for _, p := range store {
|
|
||||||
p.proxy.Close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getPathWithoutPrefix(path, prefix string) string {
|
|
||||||
s := strings.TrimPrefix(path, prefix)
|
|
||||||
if len(s) > 0 && s[0] == '/' {
|
|
||||||
return s[1:]
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func aggregateConsumers(consumers ...func([]structure.AddressConfiguration) bool) func([]structure.AddressConfiguration) bool {
|
|
||||||
return func(list []structure.AddressConfiguration) bool {
|
|
||||||
for _, consumer := range consumers {
|
|
||||||
consumer(list)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package proxy //nolint
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Test_getPathWithoutPrefix(t *testing.T) {
|
|
||||||
type args struct {
|
|
||||||
path string
|
|
||||||
prefix string
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
args args
|
|
||||||
want string
|
|
||||||
}{
|
|
||||||
{name: "#1", args: args{
|
|
||||||
path: "/api/some/11/22",
|
|
||||||
prefix: "/api/some",
|
|
||||||
}, want: "11/22"},
|
|
||||||
{name: "#2", args: args{
|
|
||||||
path: "/api/service/group/method",
|
|
||||||
prefix: "/api",
|
|
||||||
}, want: "service/group/method"},
|
|
||||||
}
|
|
||||||
for _, test := range tests {
|
|
||||||
tt := test
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
if got := getPathWithoutPrefix(tt.args.path, tt.args.prefix); got != tt.want {
|
|
||||||
t.Errorf("getPathWithoutPrefix() = %v, want %v", got, tt.want)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package websocket
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/integration-system/isp-lib/v2/structure"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RoundRobinAddrs struct {
|
|
||||||
mu *sync.Mutex
|
|
||||||
addrs []structure.AddressConfiguration
|
|
||||||
index int
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *RoundRobinAddrs) Get() structure.AddressConfiguration {
|
|
||||||
u.mu.Lock()
|
|
||||||
u.index = (u.index + 1) % len(u.addrs)
|
|
||||||
addr := u.addrs[u.index]
|
|
||||||
u.mu.Unlock()
|
|
||||||
return addr
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRoundRobinAddrs(addrs []structure.AddressConfiguration) *RoundRobinAddrs {
|
|
||||||
return &RoundRobinAddrs{
|
|
||||||
addrs: addrs,
|
|
||||||
index: -1,
|
|
||||||
mu: new(sync.Mutex),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
package websocket
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"io"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
"net/http/cookiejar"
|
|
||||||
"net/url"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/fasthttp/websocket"
|
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
writeBufSize = 4 << 10
|
|
||||||
readBufSize = 4 << 10
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
errNoAddresses = errors.New("no available address")
|
|
||||||
pool = &sync.Pool{New: func() interface{} {
|
|
||||||
buf := make([]byte, readBufSize)
|
|
||||||
return &buf
|
|
||||||
}}
|
|
||||||
)
|
|
||||||
|
|
||||||
// used to filter client request headers
|
|
||||||
//
|
|
||||||
var forbiddenDuplicateHeaders = map[string]struct{}{
|
|
||||||
"Upgrade": {},
|
|
||||||
"Connection": {},
|
|
||||||
"Sec-Websocket-Key": {},
|
|
||||||
"Sec-Websocket-Version": {},
|
|
||||||
"Sec-Websocket-Extensions": {},
|
|
||||||
"Sec-Websocket-Protocol": {},
|
|
||||||
}
|
|
||||||
|
|
||||||
var upgrader = websocket.FastHTTPUpgrader{
|
|
||||||
ReadBufferSize: readBufSize,
|
|
||||||
WriteBufferSize: writeBufSize,
|
|
||||||
CheckOrigin: func(ctx *fasthttp.RequestCtx) bool {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
type websocketProxy struct {
|
|
||||||
addrs *RoundRobinAddrs
|
|
||||||
skipAuth bool
|
|
||||||
skipExistCheck bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewProxy(skipAuth, skipExistCheck bool) *websocketProxy {
|
|
||||||
return &websocketProxy{addrs: nil, skipAuth: skipAuth, skipExistCheck: skipExistCheck}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *websocketProxy) Consumer(addressList []structure.AddressConfiguration) bool {
|
|
||||||
if len(addressList) == 0 {
|
|
||||||
p.addrs = nil
|
|
||||||
} else {
|
|
||||||
p.addrs = NewRoundRobinAddrs(addressList)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *websocketProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.ProxyResponse {
|
|
||||||
addrs := p.addrs
|
|
||||||
if addrs == nil {
|
|
||||||
msg := errNoAddresses
|
|
||||||
log.Error(log_code.ErrorWebsocketProxy, msg)
|
|
||||||
utils.WriteError(ctx, msg.Error(), codes.Internal, nil)
|
|
||||||
return domain.Create().
|
|
||||||
SetRequestBody(ctx.Request.Body()).
|
|
||||||
SetResponseBody(ctx.Response.Body()).
|
|
||||||
SetError(errNoAddresses)
|
|
||||||
}
|
|
||||||
|
|
||||||
reqHeaders := fasthttp.RequestHeader{}
|
|
||||||
ctx.Request.Header.CopyTo(&reqHeaders)
|
|
||||||
reqHost := string(ctx.Request.URI().Host())
|
|
||||||
reqScheme := string(ctx.Request.URI().Scheme())
|
|
||||||
|
|
||||||
if addr, _, err := net.SplitHostPort(ctx.RemoteAddr().String()); err == nil {
|
|
||||||
reqHeaders.Add("X-Forwarded-For", addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
err := upgrader.Upgrade(ctx, func(incomingConn *websocket.Conn) {
|
|
||||||
outgoingDialer := websocket.Dialer{
|
|
||||||
ReadBufferSize: readBufSize,
|
|
||||||
WriteBufferSize: writeBufSize,
|
|
||||||
NetDial: net.Dial,
|
|
||||||
}
|
|
||||||
|
|
||||||
addr := addrs.Get()
|
|
||||||
uri := ctx.Request.URI()
|
|
||||||
uri.SetSchemeBytes([]byte("ws"))
|
|
||||||
uri.SetHost(addr.GetAddress())
|
|
||||||
uri.SetPath("/" + path)
|
|
||||||
header := http.Header{}
|
|
||||||
|
|
||||||
reqHeaders.VisitAll(func(key, value []byte) {
|
|
||||||
keyStr := string(key)
|
|
||||||
if _, forbidden := forbiddenDuplicateHeaders[keyStr]; !forbidden {
|
|
||||||
header.Add(keyStr, string(value))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
cookie := make([]*http.Cookie, 0)
|
|
||||||
reqHeaders.VisitAllCookie(func(key, value []byte) {
|
|
||||||
cookie = append(cookie, &http.Cookie{Domain: reqHost, Name: string(key), Value: string(value)})
|
|
||||||
})
|
|
||||||
cookies := &cookiejar.Jar{}
|
|
||||||
cookies.SetCookies(&url.URL{Host: reqHost, Scheme: reqScheme}, cookie)
|
|
||||||
outgoingDialer.Jar = cookies
|
|
||||||
|
|
||||||
//nolint
|
|
||||||
outgoingConn, _, err := outgoingDialer.Dial(uri.String(), header)
|
|
||||||
if err == nil {
|
|
||||||
go func() {
|
|
||||||
_ = p.proxyConn(outgoingConn, incomingConn)
|
|
||||||
}()
|
|
||||||
_ = p.proxyConn(incomingConn, outgoingConn)
|
|
||||||
} else {
|
|
||||||
log.Errorf(log_code.ErrorWebsocketProxy, "unable to connect to service %s: %v", uri.String(), err)
|
|
||||||
_ = incomingConn.Close()
|
|
||||||
_ = outgoingConn.Close()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return domain.Create().SetError(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *websocketProxy) SkipAuth() bool {
|
|
||||||
return p.skipAuth
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *websocketProxy) SkipExistCheck() bool {
|
|
||||||
return p.skipExistCheck
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *websocketProxy) Close() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *websocketProxy) proxyConn(from, to *websocket.Conn) error {
|
|
||||||
buf := pool.Get().(*[]byte)
|
|
||||||
defer func() {
|
|
||||||
_ = from.Close()
|
|
||||||
_ = to.Close()
|
|
||||||
pool.Put(buf)
|
|
||||||
}()
|
|
||||||
for {
|
|
||||||
msgType, reader, err := from.NextReader()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
writer, err := to.NextWriter(msgType)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if _, err := io.CopyBuffer(writer, reader, *buf); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := writer.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
package proxy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/httperrors"
|
||||||
|
"isp-gate-service/request"
|
||||||
|
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
|
"github.com/tomakado/websocketproxy"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
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.EndpointMeta().Endpoint
|
||||||
|
|
||||||
|
var resultError error
|
||||||
|
proxy := websocketproxy.NewProxy(target)
|
||||||
|
proxy.Director = func(incoming *http.Request, out http.Header) {
|
||||||
|
setHttpHeaders(ctx, out, ws.skipAuth)
|
||||||
|
}
|
||||||
|
// nolint: mnd
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -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)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
// nolint:dupl
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"isp-gate-service/entity"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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) (*entity.AdminAuthenticateResponse, error) {
|
||||||
|
resp := entity.AdminAuthenticateResponse{}
|
||||||
|
err := r.cli.Invoke(adminAuthenticate).
|
||||||
|
JsonRequestBody(entity.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 := entity.AdminAuthorizeResponse{}
|
||||||
|
err := r.cli.Invoke(adminAuthorize).
|
||||||
|
JsonRequestBody(entity.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
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/cache"
|
||||||
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/entity"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
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) (*entity.AppAuthData, error) {
|
||||||
|
data, ok := r.cache.Get(token)
|
||||||
|
if !ok {
|
||||||
|
return nil, domain.ErrAuthenticationCacheMiss
|
||||||
|
}
|
||||||
|
|
||||||
|
result := entity.AppAuthData{}
|
||||||
|
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 entity.AppAuthData) 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
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/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
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// nolint:dupl
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"isp-gate-service/entity"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/grpc/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
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) (*entity.AuthenticateResponse, error) {
|
||||||
|
resp := entity.AuthenticateResponse{}
|
||||||
|
err := r.cli.Invoke(authenticate).
|
||||||
|
JsonRequestBody(entity.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, req entity.AuthorizeRequest) (bool, error) {
|
||||||
|
resp := entity.AuthorizeResponse{}
|
||||||
|
err := r.cli.Invoke(authorize).
|
||||||
|
JsonRequestBody(req).
|
||||||
|
JsonResponseBody(&resp).
|
||||||
|
Do(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return false, errors.WithMessagef(err, "grpc client invoke: %s", authorize)
|
||||||
|
}
|
||||||
|
return resp.Authorized, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package unused
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"isp-gate-service/domain"
|
||||||
|
"isp-gate-service/entity"
|
||||||
|
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"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) (*entity.AppAuthData, 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 := entity.AppAuthData{}
|
||||||
|
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 entity.AppAuthData) 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
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package unused
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"isp-gate-service/entity"
|
||||||
|
|
||||||
|
"github.com/txix-open/isp-kit/errors"
|
||||||
|
"github.com/txix-open/isp-kit/http/httpcli"
|
||||||
|
"github.com/txix-open/isp-kit/http/httpclix"
|
||||||
|
"github.com/txix-open/isp-kit/lb"
|
||||||
|
"github.com/txix-open/isp-kit/metrics/http_metrics"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserAuth struct {
|
||||||
|
lb *lb.RoundRobin
|
||||||
|
cli *httpcli.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserAuth(lb *lb.RoundRobin) UserAuth {
|
||||||
|
return UserAuth{
|
||||||
|
lb: lb,
|
||||||
|
cli: httpclix.Default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r UserAuth) Authenticate(
|
||||||
|
ctx context.Context,
|
||||||
|
method string,
|
||||||
|
token string,
|
||||||
|
) (*entity.UserAuthenticateResponse, error) {
|
||||||
|
ctx = http_metrics.ClientEndpointToContext(ctx, method)
|
||||||
|
|
||||||
|
host, err := r.lb.Next()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "lb next")
|
||||||
|
}
|
||||||
|
|
||||||
|
endpoint := fmt.Sprintf("http://%s/%s", host, method)
|
||||||
|
resp := entity.UserAuthenticateResponse{}
|
||||||
|
err = r.cli.Post(endpoint).
|
||||||
|
JsonRequestBody(entity.UserAuthenticateRequest{
|
||||||
|
Token: token,
|
||||||
|
}).JsonResponseBody(&resp).
|
||||||
|
StatusCodeToError().
|
||||||
|
DoWithoutResponse(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessagef(err, "http client invoke: %s", endpoint)
|
||||||
|
}
|
||||||
|
return &resp, nil
|
||||||
|
}
|
||||||
Loaded 100 of 129 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user