diff --git a/.gitignore b/.gitignore index 3b079fc..73fbb5a 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,6 @@ fabric.properties /vendor/ google/ package.json -yarn.lock \ No newline at end of file +yarn.lock + +conf/config_dev.yml diff --git a/.version b/.version index 642c63c..56fea8a 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.8.3 \ No newline at end of file +3.0.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 470ea2f..0db6f16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +### v3.0.0 +* реализация новой схемы аутентификации/авторизации ### v2.8.3 * use isp-kit logger instead local logger * use log string instead log any (common log type) diff --git a/accounting/accountant.go b/accounting/accountant.go deleted file mode 100644 index fec042d..0000000 --- a/accounting/accountant.go +++ /dev/null @@ -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 -} diff --git a/accounting/accounting.go b/accounting/accounting.go deleted file mode 100644 index 63221ac..0000000 --- a/accounting/accounting.go +++ /dev/null @@ -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/repository" - "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 := repository.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) - } - } -} diff --git a/accounting/accounting_test.go b/accounting/accounting_test.go deleted file mode 100644 index f23de56..0000000 --- a/accounting/accounting_test.go +++ /dev/null @@ -1,205 +0,0 @@ -//nolint -package accounting - -import ( - "github.com/stretchr/testify/assert" - "isp-gate-service/conf" - "isp-gate-service/entity" - "isp-gate-service/repository" - "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) - repository.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) - repository.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 := repository.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 -} diff --git a/accounting/snapshot.go b/accounting/snapshot.go deleted file mode 100644 index ef10a72..0000000 --- a/accounting/snapshot.go +++ /dev/null @@ -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/repository" - "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 := repository.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 -} diff --git a/accounting/state/limit_state.go b/accounting/state/limit_state.go deleted file mode 100644 index 4995553..0000000 --- a/accounting/state/limit_state.go +++ /dev/null @@ -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 -} diff --git a/accounting/state/limiter.go b/accounting/state/limiter.go deleted file mode 100644 index 46e0818..0000000 --- a/accounting/state/limiter.go +++ /dev/null @@ -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 -} diff --git a/accounting/state/limiter_test.go b/accounting/state/limiter_test.go deleted file mode 100644 index 77c8ec2..0000000 --- a/accounting/state/limiter_test.go +++ /dev/null @@ -1,51 +0,0 @@ -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) -} diff --git a/accounting/storing.go b/accounting/storing.go deleted file mode 100644 index b6de27e..0000000 --- a/accounting/storing.go +++ /dev/null @@ -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/repository" - "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 := repository.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 -} diff --git a/accounting/storing_test.go b/accounting/storing_test.go deleted file mode 100644 index 954eec9..0000000 --- a/accounting/storing_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package accounting - -import ( - "sync" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "isp-gate-service/conf" - "isp-gate-service/entity" - "isp-gate-service/repository" -) - -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 { - rep := &requestsRepository{cache: make([]entity.Request, 0), wg: &sync.WaitGroup{}} - repository.RequestsRep = rep - InitStoringTask(setting) - return rep -} - -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 -} diff --git a/assembly/assembly.go b/assembly/assembly.go new file mode 100644 index 0000000..6a08a5c --- /dev/null +++ b/assembly/assembly.go @@ -0,0 +1,174 @@ +package assembly + +import ( + "context" + + "github.com/go-redis/redis/v8" + "github.com/integration-system/isp-kit/app" + "github.com/integration-system/isp-kit/bootstrap" + "github.com/integration-system/isp-kit/cluster" + "github.com/integration-system/isp-kit/grpc/client" + "github.com/integration-system/isp-kit/http" + "github.com/integration-system/isp-kit/lb" + "github.com/integration-system/isp-kit/log" + "github.com/pkg/errors" + "isp-gate-service/conf" + "isp-gate-service/routes" +) + +type Assembly struct { + boot *bootstrap.Bootstrap + server *http.Server + logger *log.Adapter + routes *routes.Routes + redisCli redis.UniversalClient + systemCli *client.Client + + locations []conf.Location + grpcClientByModuleName map[string]*client.Client + httpHostManagerByModuleName map[string]*lb.RoundRobin +} + +func New(boot *bootstrap.Bootstrap) (*Assembly, error) { + server := http.NewServer() + + 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: + 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") + } + + return &Assembly{ + boot: boot, + server: server, + logger: boot.App.Logger(), + routes: routes.NewRoutes(), + locations: localConfig.Locations, + grpcClientByModuleName: grpcClientByModuleName, + httpHostManagerByModuleName: httpHostManagerByModuleName, + systemCli: systemCli, + }, 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")) + } + err = newCfg.Validate() + if err != nil { + a.logger.Fatal(ctx, errors.WithMessage(err, "invalid remote config")) + } + + a.logger.SetLevel(newCfg.Logging.LogLevel) + + var newRedisCli redis.UniversalClient + if newCfg.Redis != nil { + newRedisCli = a.redisClient(*newCfg.Redis) + } + + locator := NewLocator(a.logger, a.grpcClientByModuleName, a.httpHostManagerByModuleName, a.routes, a.systemCli) + + handler, err := locator.Handler(newCfg, a.locations, newRedisCli) + if err != nil { + return errors.WithMessage(err, "locator handler") + } + + a.server.Upgrade(handler) + + if a.redisCli != nil { + _ = a.redisCli.Close() + a.redisCli = newRedisCli + } + + return nil +} + +func (a *Assembly) Runners() []app.Runner { + eventHandler := cluster.NewEventHandler(). + RoutesReceiver(a.routes). + RemoteConfigReceiver(a) + + for moduleName, upgrader := range a.grpcClientByModuleName { + eventHandler.RequireModule(moduleName, upgrader) + } + for moduleName, upgrader := range a.httpHostManagerByModuleName { + eventHandler.RequireModule(moduleName, upgrader) + } + + eventHandler.RequireModule("isp-system-service", a.systemCli) + + return []app.Runner{ + app.RunnerFunc(func(ctx context.Context) error { + return a.server.ListenAndServe(a.boot.BindingAddress) + }), + app.RunnerFunc(func(ctx context.Context) error { + return a.boot.ClusterCli.Run(ctx, eventHandler) + }), + } +} + +func (a *Assembly) Closers() []app.Closer { + closers := []app.Closer{ + a.boot.ClusterCli, + app.CloserFunc(func() error { + return a.server.Shutdown(context.Background()) + }), + } + for _, cliCloser := range a.grpcClientByModuleName { + closers = append(closers, cliCloser) + } + closers = append(closers, a.systemCli, app.CloserFunc(func() error { + if a.redisCli != nil { + return a.redisCli.Close() + } + return nil + })) + + return closers +} + +func (a *Assembly) redisClient(config conf.Redis) redis.UniversalClient { + if config.Sentinel != nil { + return redis.NewFailoverClient(&redis.FailoverOptions{ + MasterName: config.Sentinel.MasterName, + SentinelAddrs: config.Sentinel.Addresses, + SentinelUsername: config.Sentinel.Username, + SentinelPassword: config.Sentinel.Password, + Username: config.Username, + Password: config.Password, + }) + } + return redis.NewClient(&redis.Options{ + Addr: config.Address, + Username: config.Username, + Password: config.Password, + }) +} diff --git a/assembly/locator.go b/assembly/locator.go new file mode 100644 index 0000000..80930c3 --- /dev/null +++ b/assembly/locator.go @@ -0,0 +1,107 @@ +package assembly + +import ( + "fmt" + "net/http" + "time" + + "github.com/go-redis/redis/v8" + "github.com/integration-system/isp-kit/grpc/client" + "github.com/integration-system/isp-kit/lb" + "github.com/integration-system/isp-kit/log" + "github.com/pkg/errors" + "isp-gate-service/conf" + "isp-gate-service/middleware" + "isp-gate-service/proxy" + "isp-gate-service/repository" + "isp-gate-service/routes" + "isp-gate-service/service" +) + +type Locator struct { + logger log.Logger + grpcClientByModuleName map[string]*client.Client + httpHostManagerByModuleName map[string]*lb.RoundRobin + routes *routes.Routes + systemCli *client.Client +} + +func NewLocator( + logger log.Logger, + grpcClientByModuleName map[string]*client.Client, + httpHostManagerByModuleName map[string]*lb.RoundRobin, + routes *routes.Routes, + systemCli *client.Client, +) Locator { + return Locator{ + logger: logger, + grpcClientByModuleName: grpcClientByModuleName, + httpHostManagerByModuleName: httpHostManagerByModuleName, + routes: routes, + systemCli: systemCli, + } +} + +func (l Locator) Handler(config conf.Remote, locations []conf.Location, redisCli redis.UniversalClient) (http.Handler, error) { + systemRepo := repository.NewSystem(l.systemCli) + + authenticationCache := repository.NewAuthenticationCache(time.Duration(config.Caching.AuthenticationDataInSec) * time.Second) + authentication := service.NewAuthentication(authenticationCache, systemRepo) + + adminService := service.NewAdmin(config.Secrets.AdminTokenSecret) + + authorizationCache := repository.NewAuthorizationCache(time.Duration(config.Caching.AuthorizationDataInSec) * time.Second) + authorization := service.NewAuthorization(authorizationCache, systemRepo) + + dailyLimitRepo := repository.NewDailyLimit(redisCli) + dailyLimitService := service.NewDailyLimit(dailyLimitRepo, config.DailyLimits) + + throttlingRepo := repository.NewThrottling(redisCli) + throttlingService := service.NewThrottling(throttlingRepo, config.Throttling) + + mux := http.NewServeMux() + for _, location := range locations { + var proxyFunc middleware.Handler + switch location.Protocol { + case conf.GrpcProtocol: + cli := l.grpcClientByModuleName[location.TargetModule] + proxyFunc = proxy.NewGrpc(cli, location.SkipAuth, time.Duration(config.Http.ProxyTimeoutInSec)*time.Second) + case conf.HttpProtocol: + hostManager := l.httpHostManagerByModuleName[location.TargetModule] + proxyFunc = proxy.NewHttp(hostManager, location.SkipAuth, time.Duration(config.Http.ProxyTimeoutInSec)*time.Second) + default: + return nil, errors.Errorf("not supported protocol %s", location.Protocol) + } + + handler := middleware.Chain( + proxyFunc, + middleware.RequestId(), + middleware.Logger(l.logger, config.Logging.RequestLogEnable, config.Logging.BodyLogEnable), + middleware.ErrorHandler(l.logger), + middleware.Authenticate(authentication), + middleware.AdminAuthenticate(adminService), + middleware.Authorize(authorization, l.logger), + middleware.AdminAuthorize(l.routes), + middleware.Throttling(throttlingService), + middleware.DailyLimit(dailyLimitService), + ) + if location.SkipAuth { + handler = middleware.Chain( + proxyFunc, + middleware.RequestId(), + middleware.Logger(l.logger, config.Logging.RequestLogEnable, config.Logging.BodyLogEnable), + middleware.ErrorHandler(l.logger), + ) + } + + entrypoint := middleware.Entrypoint( + config.Http.MaxRequestBodySizeInMb*1024*1024, //nolint:gomnd + handler, + location.PathPrefix, + l.logger, + ) + mux.Handle(fmt.Sprintf("%s/", location.PathPrefix), entrypoint) + } + + return mux, nil +} diff --git a/authenticate/authenticate.go b/authenticate/authenticate.go deleted file mode 100644 index c70e809..0000000 --- a/authenticate/authenticate.go +++ /dev/null @@ -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" - - 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 - adminId int64 - 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, int64, error) { - for _, notExpectedHeader := range notExpectedHeaders { - ctx.Request.Header.Del(notExpectedHeader) - } - - verifiable := newVerifiable(ctx, path) - err := verifiable.verifyAppToken() - if err != nil { - return 0, 0, err - } - - err = verifiable.verifyUserToken() - if err != nil { - return 0, 0, err - } - - verifiable.setHeaders() - - err = verifiable.checkInnerMethods() - if err != nil { - return 0, 0, err - } - - err = verifiable.checkUserMethods() - if err != nil { - return 0, 0, err - } - - return verifiable.appId, verifiable.adminId, nil -} - -func newVerifiable(ctx *fasthttp.RequestCtx, path string) *verifiable { - return &verifiable{ - ctx: ctx, - path: path, - appId: -1, - adminId: -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) //nolint - 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") - } - adminId, err := verifyToken.Admin(adminToken) - if err != nil { - return createError("unauthorized", codes.Unauthenticated, "received invalid admin token") - } - v.adminId = adminId - } - 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) -} diff --git a/authenticate/error.go b/authenticate/error.go deleted file mode 100644 index 865a0ca..0000000 --- a/authenticate/error.go +++ /dev/null @@ -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 -} diff --git a/authenticate/token.go b/authenticate/token.go deleted file mode 100644 index 4e7828f..0000000 --- a/authenticate/token.go +++ /dev/null @@ -1,90 +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 adminClaims struct { - *jwt.StandardClaims - Id int64 -} - -type token struct{} - -func (t token) Admin(token string) (int64, error) { - secret := config.GetRemote().(*conf.RemoteConfig).TokensSetting.AdminSecret - parsed, err := t.parse(token, secret, &adminClaims{StandardClaims: &jwt.StandardClaims{}}) - if err != nil { - return 0, err - } - claims, ok := parsed.Claims.(*adminClaims) - if !ok { - return 0, errInvalidToken - } - return claims.Id, nil -} - -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 -} diff --git a/cache/cache.go b/cache/cache.go new file mode 100644 index 0000000..feb6565 --- /dev/null +++ b/cache/cache.go @@ -0,0 +1,53 @@ +package cache + +import ( + "sync" + "time" +) + +type Item struct { + data []byte + expiredAt time.Time +} + +type Cache struct { + store map[string]Item + lock *sync.RWMutex +} + +func New() *Cache { + return &Cache{ + store: map[string]Item{}, + lock: &sync.RWMutex{}, + } +} + +func (c *Cache) Get(key string) ([]byte, bool) { + c.lock.RLock() + defer c.lock.RUnlock() + + item, ok := c.store[key] + if !ok { + return nil, false + } + + if c.now().After(item.expiredAt) { + return nil, false + } + + return item.data, true +} + +func (c *Cache) Set(key string, data []byte, lifeTime time.Duration) { + c.lock.Lock() + defer c.lock.Unlock() + + c.store[key] = Item{ + data: data, + expiredAt: c.now().Add(lifeTime), + } +} + +func (c *Cache) now() time.Time { + return time.Now() +} diff --git a/cache/cache_test.go b/cache/cache_test.go new file mode 100644 index 0000000..fc373dc --- /dev/null +++ b/cache/cache_test.go @@ -0,0 +1,47 @@ +package cache_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + "isp-gate-service/cache" +) + +func TestGetBasic(t *testing.T) { + 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) { + 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) { + 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) +} diff --git a/conf/config.yml b/conf/config.yml index 8938823..c0ae2a1 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -1,14 +1,16 @@ configServiceAddress: ip: 127.0.0.1 port: 9001 -httpOuterAddress: +grpcOuterAddress: #ip: 127.0.0.1 port: 9003 -httpInnerAddress: +grpcInnerAddress: ip: 0.0.0.0 port: 9003 -moduleName: isp-gate -instanceUuid: 9d89354b-c728-4b48-b002-a7d3b229f151 +moduleName: isp-gate-service + +infraServerPort: 9553 + locations: - pathPrefix: /api protocol: grpc @@ -16,7 +18,3 @@ locations: - pathPrefix: /mdm protocol: http targetModule: mdm-api - - pathPrefix: /ws - protocol: websocket - skipAuth: true - targetModule: admin diff --git a/conf/default_remote_config.json b/conf/default_remote_config.json index 1cdb787..e809500 100644 --- a/conf/default_remote_config.json +++ b/conf/default_remote_config.json @@ -1,62 +1,18 @@ { - "database": { - "address": "{{ msp_pgsql_address }}", - "port": "{{ msp_pgsql_port }}", - "schema": "gate_service", - "database": "{{ msp_pgsql_name }}", - "username": "{{ msp_pgsql_user }}", - "password": "{{ msp_pgsql_password }}", - "createSchema": true + "secrets": { + "adminTokenSecret": "{{ msp_admin_secret }}" }, - "grpcSetting": { - "proxyGrpcErrorDetails": true, - "enableOriginalProtoErrors": false + "logging": { + "logLevel": "debug", + "requestLogEnable": true, + "bodyLogEnable": false }, - "httpSetting": { - "maxRequestBodySizeBytes": 0 + "caching": { + "authenticationDataInSec": 60, + "authorizationDataInSec": 60 }, - "accountingSetting": { - "enable": false, - "snapshotTimeout": "15m", - "setting": [ - ], - "storing": { - "size": 10000, - "timeout": "10m" - } - }, - "journalSetting": { - "journal": { - "filename": "/var/log/isp-gate-service/runtime.log", - "maxSizeMb": 512, - "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" + "http": { + "maxRequestBodySizeInMb": 64, + "proxyTimeoutInSec": 60 } } diff --git a/conf/local.go b/conf/local.go new file mode 100644 index 0000000..3ca105b --- /dev/null +++ b/conf/local.go @@ -0,0 +1,17 @@ +package conf + +const ( + HttpProtocol = "http" + GrpcProtocol = "grpc" +) + +type Local struct { + Locations []Location +} + +type Location struct { + SkipAuth bool + PathPrefix string `valid:"required"` + Protocol string `valid:"required,in(http|grpc)"` + TargetModule string `valid:"required"` +} diff --git a/conf/local_config.go b/conf/local_config.go deleted file mode 100644 index e89de94..0000000 --- a/conf/local_config.go +++ /dev/null @@ -1,34 +0,0 @@ -package conf - -import ( - "github.com/integration-system/isp-lib/v2/config" - "github.com/integration-system/isp-lib/v2/structure" -) - -type ( - Configuration struct { - config.CommonLocalConfig - InstanceUuid string `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 _, loc := range locations { - requiredModules[loc.TargetModule] = append(requiredModules[loc.TargetModule], loc) - } - - return requiredModules -} diff --git a/conf/remote.go b/conf/remote.go new file mode 100644 index 0000000..fa8758b --- /dev/null +++ b/conf/remote.go @@ -0,0 +1,81 @@ +package conf + +import ( + "reflect" + + "github.com/integration-system/isp-kit/log" + "github.com/integration-system/isp-kit/rc/schema" + "github.com/integration-system/jsonschema" + "github.com/pkg/errors" +) + +func init() { + schema.CustomGenerators.Register("logLevel", func(field reflect.StructField, t *jsonschema.Type) { + t.Type = "string" + t.Enum = []interface{}{"debug", "info", "error", "fatal"} + }) +} + +type Remote struct { + Redis *Redis `schema:"Настройки Redis,обязательно, если используется механизм суточных ограничений или ограничений пропускной способности"` + Secrets Secrets `schema:"Настройки секретов"` + Http Http `schema:"Настройки HTTP"` + Logging Logging `schema:"Настройки логирования"` + Caching Caching `schema:"Настройки кеширования"` + DailyLimits []DailyLimit `schema:"Настройки суточных ограничений,сбрасываются раз в сутки в 00:00"` + Throttling []Throttling `schema:"Настройки пропускной способности"` +} + +type Secrets struct { + AdminTokenSecret string `valid:"required" schema:"Секрет токена администратора"` +} + +type Http struct { + MaxRequestBodySizeInMb int64 `valid:"required" schema:"Максимальная длинна тела запроса,в мегабайтах"` + ProxyTimeoutInSec int `valid:"required" schema:"Таймаут на проксирование,в секундах"` +} + +type Logging struct { + LogLevel log.Level `schemaGen:"logLevel" schema:"Уровень логирования,логирование запросов осуществляется на уровне debug"` + RequestLogEnable bool `schema:"Включить логирование запросов"` + BodyLogEnable bool `schema:"Включить логирование тел запросов и ответов,должно быть включено логирование запросов"` +} + +type Caching struct { + AuthenticationDataInSec int `valid:"required" schema:"Время кеширования данных аутентификации,в секундах"` + AuthorizationDataInSec int `valid:"required" schema:"Время кеширования данных авторизации,в секундах"` +} + +type DailyLimit struct { + ApplicationId int `valid:"required" schema:"ID приложения"` + RequestsPerDay int64 `valid:"required" schema:"Запросов в сутки"` +} + +type Throttling struct { + ApplicationId int `valid:"required" schema:"ID приложения"` + RequestsPerSeconds int `valid:"required,range(1|1000)" schema:"Запросов в секунду,не конфликтует с суточными ограничениями, алгоритм не работает на значениях больше 1000"` +} + +type Redis struct { + Address string `schema:"Адрес,обязателено, если sentinel не указан"` + Username string `schema:"Имя пользовтаеля"` + Password string `schema:"Пароль"` + Sentinel *RedisSentinel `schema:"Настройки sentinel,обязательно, если address не указан"` +} + +type RedisSentinel struct { + Addresses []string `valid:"required" schema:"Адреса нод в кластере"` + MasterName string `valid:"required" schema:"Имя мастера"` + Username string `schema:"Имя пользовтаеля в sentinel"` + Password string `schema:"Пароль в sentinel"` +} + +func (r Remote) Validate() error { + if (len(r.Throttling) > 0 || len(r.DailyLimits) > 0) && r.Redis == nil { + return errors.New("redis is required if dailyLimits or throttling were specified") + } + if r.Redis != nil && r.Redis.Sentinel == nil && r.Redis.Address == "" { + return errors.New("invalid redis config. sentinel or address are required") + } + return nil +} diff --git a/conf/remote_config.go b/conf/remote_config.go deleted file mode 100644 index 6c77c70..0000000 --- a/conf/remote_config.go +++ /dev/null @@ -1,121 +0,0 @@ -package conf - -import ( - "time" - - "github.com/integration-system/isp-lib/v2/structure" -) - -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 JorunalConfig `schema:"Настройка конфигурации"` - MethodsPatterns []string `schema:"Список методов для логирования,список строк вида: 'module/group/method'(* - для частичного совпадения). При обработке запроса, если вызываемый метод совпадает со строкой из списка, тела запроса и ответа записываются в лог"` - } - - JorunalConfig struct { - Enable bool `schema:"Включение/отключение журналирования"` - Filename string `schema:"Имя файла,путь до файла в который будут записываться логи"` - MaxSizeMb int `schema:"Максимальный размер файла,ограничение по размеру файла после достижения которого логи будут записываться в новый файл"` - Compress bool `schema:"Сжатие логов,архивирует файлы в gzip"` - } - - 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 -} diff --git a/domain/auth.go b/domain/auth.go new file mode 100644 index 0000000..1813906 --- /dev/null +++ b/domain/auth.go @@ -0,0 +1,8 @@ +package domain + +type AuthData struct { + SystemId int + DomainId int + ServiceId int + ApplicationId int +} diff --git a/domain/cache.go b/domain/cache.go new file mode 100644 index 0000000..9436b4f --- /dev/null +++ b/domain/cache.go @@ -0,0 +1,9 @@ +package domain + +import ( + "github.com/pkg/errors" +) + +var ( + ErrAuthenticationCacheMiss = errors.New("authentication not found in cache") +) diff --git a/domain/response.go b/domain/response.go deleted file mode 100644 index 56f8a95..0000000 --- a/domain/response.go +++ /dev/null @@ -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 -} diff --git a/domain/system.go b/domain/system.go new file mode 100644 index 0000000..445dfc1 --- /dev/null +++ b/domain/system.go @@ -0,0 +1,20 @@ +package domain + +type AuthenticateRequest struct { + Token string +} + +type AuthenticateResponse struct { + Authenticated bool + ErrorReason string + AuthData *AuthData +} + +type AuthorizeRequest struct { + ApplicationId int + Endpoint string +} + +type AuthorizeResponse struct { + Authorized bool +} diff --git a/domain/throttling.go b/domain/throttling.go new file mode 100644 index 0000000..6272732 --- /dev/null +++ b/domain/throttling.go @@ -0,0 +1,11 @@ +package domain + +import ( + "time" +) + +type RateLimitResult struct { + Allow bool + Remaining int + RetryAfter time.Duration +} diff --git a/entity/entity.go b/entity/entity.go deleted file mode 100644 index 682725b..0000000 --- a/entity/entity.go +++ /dev/null @@ -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 -} diff --git a/go.mod b/go.mod index 420df32..522bb6c 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,68 @@ module isp-gate-service -go 1.16 +go 1.17 require ( - github.com/dgrijalva/jwt-go v3.2.0+incompatible - github.com/fasthttp/websocket v1.4.3-rc.7 - github.com/go-pg/pg/v9 v9.2.1 - github.com/go-redis/redis/v8 v8.8.2 - github.com/golang/protobuf v1.5.2 - github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f - github.com/integration-system/isp-kit v1.6.0 - github.com/integration-system/isp-lib/v2 v2.8.7 - github.com/integration-system/isp-log v1.1.8 - github.com/json-iterator/go v1.1.12 + github.com/go-redis/redis/v8 v8.11.5 + github.com/go-redis/redis_rate/v9 v9.1.2 + github.com/go-resty/resty/v2 v2.7.0 + github.com/golang-jwt/jwt/v4 v4.4.2 + github.com/google/uuid v1.1.2 + github.com/integration-system/isp-kit v1.10.3 + github.com/integration-system/jsonschema v1.0.1 github.com/pkg/errors v0.9.1 - github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 - github.com/spf13/cast v1.4.1 - github.com/stretchr/testify v1.7.1 - github.com/valyala/fasthttp v1.28.0 - golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 - google.golang.org/grpc v1.46.0 - google.golang.org/protobuf v1.28.0 + github.com/stretchr/testify v1.8.0 + golang.org/x/net v0.0.0-20220708220712-1185a9018129 + google.golang.org/grpc v1.48.0 ) -replace google.golang.org/grpc v1.46.0 => google.golang.org/grpc v1.38.0 +require ( + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/integration-system/bellows v1.0.1 // indirect + github.com/integration-system/isp-etp-go/v2 v2.1.3 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/julienschmidt/httprouter v1.3.0 // indirect + github.com/klauspost/compress v1.15.9 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/magiconair/properties v1.8.6 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // 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/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.12.2 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.12.0 // indirect + github.com/subosito/gotenv v1.4.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.8.0 // indirect + go.uber.org/zap v1.21.0 // indirect + golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect + golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect + golang.org/x/text v0.3.7 // indirect + google.golang.org/genproto v0.0.0-20220720214146-176da50484ac // indirect + google.golang.org/protobuf v1.28.0 // indirect + gopkg.in/ini.v1 v1.66.6 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + nhooyr.io/websocket v1.8.7 // indirect +) diff --git a/go.sum b/go.sum index 76d75dc..c3cfb92 100644 --- a/go.sum +++ b/go.sum @@ -38,9 +38,10 @@ cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM7 cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= @@ -53,79 +54,39 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Azure/azure-sdk-for-go v51.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= -github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= -github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= -github.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= -github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -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/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/squirrel v1.5.2/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= -github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Masterminds/squirrel v1.5.3/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= 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/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E= -github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= -github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.29.9/go.mod h1:1KvfttTE3SPKMpo8g2c6jL3ZKfXtFvKscTgahTma5Xg= -github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 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 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/buaazp/fasthttprouter v0.1.1 h1:4oAnN0C3xZjylvZJdP35cxfclyn4TYkW6Y+DSvS+h8Q= -github.com/buaazp/fasthttprouter v0.1.1/go.mod h1:h/Ap5oRVLeItGKTVBb+heQPks+HdIUtGmI4H5WCYijM= -github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= -github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= -github.com/cenkalti/backoff/v4 v4.1.0 h1:c8LkOFQTzuO0WBM/ae5HdGQuZPfPxp7lqBRwQRm4fSc= -github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -139,53 +100,21 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/codemodus/kace v0.5.1 h1:4OCsBlE2c/rSJo375ggfnucv9eRzge/U5LrrOZd47HA= -github.com/codemodus/kace v0.5.1/go.mod h1:coddaHoX1ku1YFSe4Ip0mL9kQjJvKkzb9CfIdG1YR04= -github.com/containerd/containerd v1.4.4 h1:rtRG4N6Ct7GNssATwgpvMGfnjnwfjnu/Zs9W3Ikzq+M= -github.com/containerd/containerd v1.4.4/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -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/etcd v3.3.13+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-semver v0.3.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/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -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/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.5+incompatible h1:o5WL5onN4awYGwrW7+oTn5x9AF2prw7V0Ox8ZEkoCdg= -github.com/docker/docker v20.10.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20201221183957-6b6d5e2b5d80/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dop251/goja v0.0.0-20210427212725-462d53687b0d/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -194,80 +123,33 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fasthttp/websocket v1.4.3-rc.7 h1:pSzkucxZWAJUhkj4Mp3IB/6JKKDAZn/UL4+wVLXv2yw= -github.com/fasthttp/websocket v1.4.3-rc.7/go.mod h1:e5Rz5pdu69u7sj4sG3eAxWgSQEhhGVSYebdmVeJFJGY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/fsnotify/fsnotify v1.5.3 h1:vNFpj2z7YIbwh2bw7x35sqYpp2wfuq+pivKbWG09B8c= -github.com/fsnotify/fsnotify v1.5.3/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= -github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= -github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/go-chi/chi v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs= -github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 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-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= 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-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -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/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/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/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= -github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= -github.com/go-openapi/jsonreference v0.19.5/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/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28= -github.com/go-openapi/spec v0.19.14/go.mod h1:gwrgJS15eCUgjLpMjBJmbZezCsw88LmgeEip0M63doA= -github.com/go-openapi/spec v0.20.0 h1:HGLc8AJ7ynOxwv0Lq4TsnwLsWMawHAYiJIFzbcML86I= -github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= -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/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY= -github.com/go-openapi/swag v0.19.12 h1:Bc0bnY2c3AoF7Gc+IMIAQQsD8fLHjHpc19wXvYuayQI= -github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= -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.5/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg= -github.com/go-pg/pg/v9 v9.1.7/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg= -github.com/go-pg/pg/v9 v9.2.1 h1:4rWNJkj+aPuDFqgieTzNhHBuYaXREh3yaB9NlBerFys= -github.com/go-pg/pg/v9 v9.2.1/go.mod h1:fG8qbL+ei4e/fCZLHK+Z+/7b9B+pliZtbpaucG4/YNQ= -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/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg= -github.com/go-pg/zerochecker v0.1.1/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo= -github.com/go-pg/zerochecker v0.2.0 h1:pp7f72c3DobMWOb2ErtZsnrPaSvHd2W4o9//8HtF4mU= -github.com/go-pg/zerochecker v0.2.0/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= @@ -278,17 +160,16 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A= github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= -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/go.mod h1:o1M7JtsgfDYyv3o+gBn/jJ1LkqpnCrmil7PSppZGBak= -github.com/go-redis/redis/v8 v8.4.4/go.mod h1:nA0bQuF0i5JFx4Ta9RZxGKXFrQ8cRWntra97f0196iY= -github.com/go-redis/redis/v8 v8.8.2 h1:O/NcHqobw7SEptA0yA6up6spZVFtwE06SXM8rgLtsP8= -github.com/go-redis/redis/v8 v8.8.2/go.mod h1:F7resOH5Kdug49Otu24RjHWwgK7u9AmtqWMnCV1iP5Y= +github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w= +github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= +github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/go-redis/redis_rate/v9 v9.1.2 h1:H0l5VzoAtOE6ydd38j8MCq3ABlGLnvvbA1xDSVVCHgQ= +github.com/go-redis/redis_rate/v9 v9.1.2/go.mod h1:oam2de2apSgRG8aJzwJddXbNu91Iyz1m8IKJE2vpvlQ= +github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= -github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= 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= @@ -298,12 +179,10 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= 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/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= +github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 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/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -335,7 +214,6 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -351,8 +229,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -370,124 +249,73 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.15.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.16.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= -github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= -github.com/hashicorp/raft v1.1.2 h1:oxEL5DDeurYxLd3UbcY/hccgSPhLLpiBZ1YxtWEq59c= -github.com/hashicorp/raft v1.1.2/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= -github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c/go.mod h1:6cf4ZNvtzZ/KMiuc+d5Y7rSHjzlYBWEqbVyDfUDhqIE= -github.com/integration-system/bellows v1.0.0/go.mod h1:qHPg1ptN3AHHr0f/wvoicfA2LOCprOyrbXnIa5QIRe0= github.com/integration-system/bellows v1.0.1 h1:7g1lhD/6EcvsSo9iuiFqw98XGS78Sko6kUKPzfte/SY= github.com/integration-system/bellows v1.0.1/go.mod h1:qHPg1ptN3AHHr0f/wvoicfA2LOCprOyrbXnIa5QIRe0= -github.com/integration-system/cony v0.3.0 h1:wSDrThUe7JdI1kUo1PBQ+TdYcGkrPzfbV01bBC6mpbQ= -github.com/integration-system/cony v0.3.0/go.mod h1:3DTgNOKVMPhFyI0CD85HlIfeP29x3h7hAK0XLsg4mww= -github.com/integration-system/go-amqp v0.12.8/go.mod h1:ALB2VeQh/HXN/2Nk0XClCbsL30yT+6y0qKRRZg3D9FM= -github.com/integration-system/go-amqp v0.13.61/go.mod h1:8zftwPfjfeIw2XncclRoV4MuQb4v0xs30jpnpcwCiuw= -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/grmq v1.1.0/go.mod h1:hdiknZZJsTzoXxx5mZMGJGrQTIHHD9tZgGnk22e98Us= -github.com/integration-system/isp-etp-go/v2 v2.1.1/go.mod h1:Ndq5DMM3sDJjZn4cyKKvZrVED0FMeoXMRWHZTq+2Z1o= -github.com/integration-system/isp-etp-go/v2 v2.1.2/go.mod h1:fSkS09/engepaDDqaDAEeXUpzmtcMpSLjilZ35BfNcc= +github.com/integration-system/bgjob v1.2.0/go.mod h1:KYaolHZc3OYhtY+lPN71M0y+1DJXEzRanaya1MU0KvU= +github.com/integration-system/grmq v1.1.1 h1:qd3n0rvNsJCO6V8qdRRttBGIJ7gwOAerEInWcqJudsw= +github.com/integration-system/grmq v1.1.1/go.mod h1:8DkjaJB8s2onDia1qFgVNKA6gFVBr2WRaTkGuDlW00k= github.com/integration-system/isp-etp-go/v2 v2.1.3 h1:vcHP/PE7p1G3rxqoVKrKtXzoSxFA4ryxigd+zPkAb3w= github.com/integration-system/isp-etp-go/v2 v2.1.3/go.mod h1:ZpB+FIH3hy7md+f8ylVSQx5zwZVjczhkc45f1B2z9nw= -github.com/integration-system/isp-event-lib v1.6.0/go.mod h1:lCzAci6oS+vc51W8EfHVCh9p3p057r0DpMuY4T0lSj0= -github.com/integration-system/isp-event-lib v1.6.1/go.mod h1:5ZIXsMG3gC7sfQ+eICjkDpy2RSvSAxV3Cq1BVN8LFIk= -github.com/integration-system/isp-event-lib v1.6.5 h1:cHjQmp5Y48sbVgpF0sCE05INq9m1jh7vh+23Aersrns= -github.com/integration-system/isp-event-lib v1.6.5/go.mod h1:gQg0S8TMeISIkTLM9/DwgWwnpS3BUkNFjgByRg3+Ub0= -github.com/integration-system/isp-kit v1.6.0 h1:gC6/AsOOkPoIMLh6lcxX38k2jTFc96VkKuVojljQBLc= -github.com/integration-system/isp-kit v1.6.0/go.mod h1:Js7AypcB7sKz2uE4yYskKu8TQ0wF2MlFpWGowG2UdN4= -github.com/integration-system/isp-lib-test v1.5.4/go.mod h1:rD+X0QMiOIeJDhqwB4avdYhnc1hoEkL4z+7C7lwTuOA= -github.com/integration-system/isp-lib-test v1.6.0/go.mod h1:If5QK5jsXE48DZuq6WzCw8yC22k7GogLrEnMngXiE2Y= -github.com/integration-system/isp-lib-test v1.6.4 h1:5n2Srk9pjAUqllYMxWid3yaJIiejLfZj2rN70AzZa5o= -github.com/integration-system/isp-lib-test v1.6.4/go.mod h1:k8DiXG/Bx3k8cft0QI/+BTRsL/43effW5575udzWv1M= -github.com/integration-system/isp-lib/v2 v2.4.0/go.mod h1:hxyzKBD7eIf6Hm4x6zRsLW5p8m/aFeqeezKMFYBAtho= -github.com/integration-system/isp-lib/v2 v2.6.2/go.mod h1:ZGW7qQsCuELBHRBnSSDSEonPx+FxAfHiAfwsGQZzVO4= -github.com/integration-system/isp-lib/v2 v2.8.4/go.mod h1:bKFyatmLqEkaQWJjww0R1Dz+cRn8T7YSaf4VrROgeTw= -github.com/integration-system/isp-lib/v2 v2.8.7 h1:g6/pdcBwhWo89V8oSQzm/rqa3dG2arp/XXPATxcRfBc= -github.com/integration-system/isp-lib/v2 v2.8.7/go.mod h1:bJKlQ2vVrJt3n88Icdsp5gbUScihtBuddAapxUfFTaQ= -github.com/integration-system/isp-log v1.1.2/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs= -github.com/integration-system/isp-log v1.1.5/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs= -github.com/integration-system/isp-log v1.1.6/go.mod h1:TpUZ/Tx84sRipAT/YXZ8V7Z21C4iZ8o3wXQs3Cee0Pk= -github.com/integration-system/isp-log v1.1.8 h1:LqyuQmTVvUo+hyhz2mkSU36upRK8Q1oq9UtVv7YQ5Rw= -github.com/integration-system/isp-log v1.1.8/go.mod h1:xSYA6TY/N45lFYSDwhoOW96Q/4it0nufG0yQDA2BNy8= -github.com/integration-system/jsonschema v1.0.0/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0= +github.com/integration-system/isp-kit v1.10.1 h1:2z9tsDtQK8cxJG3M/X2bg8041wQoJaeM5XhkyTPbjq4= +github.com/integration-system/isp-kit v1.10.1/go.mod h1:e4OdOcoCvqop3k0UY+n/DA5IC+NbjUUp55YneA1qRxc= +github.com/integration-system/isp-kit v1.10.2 h1:v+1JePaK922IKmkNlhkNOwPo43+8SlcQFu5Qlb3x1Ak= +github.com/integration-system/isp-kit v1.10.2/go.mod h1:e4OdOcoCvqop3k0UY+n/DA5IC+NbjUUp55YneA1qRxc= +github.com/integration-system/isp-kit v1.10.3 h1:6VP1rQT0VYKJxq54zHunmLdU5HO42S7tFoxMYxybbfw= +github.com/integration-system/isp-kit v1.10.3/go.mod h1:e4OdOcoCvqop3k0UY+n/DA5IC+NbjUUp55YneA1qRxc= github.com/integration-system/jsonschema v1.0.1 h1:nR78BEDG9djX2uXQ1YP66a/9yQOMmp2HFmw8VPUdAa8= github.com/integration-system/jsonschema v1.0.1/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -499,7 +327,7 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.12.0/go.mod h1:ZkhRC59Llhrq3oSfrikvwQ5NaxYExr6twkdkMLaKono= +github.com/jackc/pgconn v1.12.1/go.mod h1:ZkhRC59Llhrq3oSfrikvwQ5NaxYExr6twkdkMLaKono= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= @@ -523,21 +351,14 @@ github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08 github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.16.0/go.mod h1:N0A9sFdWzkw/Jy1lwoiB64F2+ugFZi987zRxcPez/wI= +github.com/jackc/pgx/v4 v4.16.1/go.mod h1:SIhx0D5hoADaiXZVyv+3gSm3LCIIINTVO0PficsvWGQ= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -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/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -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/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= 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/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -545,22 +366,15 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= 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/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.8/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.10.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= -github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/compress v1.15.8/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= 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/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -572,7 +386,6 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= 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/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -585,33 +398,17 @@ github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ic github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.1/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg= github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -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.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -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.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 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= @@ -621,24 +418,18 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -648,256 +439,134 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2 h1:+RB5hMpXUUA2dfxuhBTEkMOrYmM+gKIZYS1KjSostMI= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.4/go.mod h1:Jw1Z28soD/QasIA2uWjXyM9El1jly3YwyFOuR8tH1rg= -github.com/nats-io/nats-server/v2 v2.1.7/go.mod h1:rbRrRE/Iv93O/rUvZ9dh4NfT0Cm9HWjW/BqOWLGgYiE= -github.com/nats-io/nats-server/v2 v2.1.8 h1:d5GoJA6W7vQkmt99Nfdeie3pEFFUEjIwt1YZp50DkIQ= -github.com/nats-io/nats-server/v2 v2.1.8/go.mod h1:rbRrRE/Iv93O/rUvZ9dh4NfT0Cm9HWjW/BqOWLGgYiE= -github.com/nats-io/nats-streaming-server v0.17.0/go.mod h1:ewPBEsmp62Znl3dcRsYtlcfwudxHEdYMtYqUQSt4fE0= -github.com/nats-io/nats-streaming-server v0.18.0 h1:+RDozeN9scwCm0Wc2fYlvGcP144hvxvSOtxZ8FE21ME= -github.com/nats-io/nats-streaming-server v0.18.0/go.mod h1:Y9Aiif2oANuoKazQrs4wXtF3jqt6p97ODQg68lR5TnY= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nats.go v1.10.0/go.mod h1:AjGArbfyR50+afOUotNX2Xs5SYHf+CoOa5HH1eEl2HE= -github.com/nats-io/nats.go v1.11.0 h1:L263PZkrmkRJRJT2YHU8GwWWvEvmr9/LUKuJTXsF32k= -github.com/nats-io/nats.go v1.11.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= -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/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= -github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= -github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= -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/nats-io/stan.go v0.7.0/go.mod h1:Ci6mUIpGQTjl++MqK2XzkWI/0vF+Bl72uScx7ejSYmU= -github.com/nats-io/stan.go v0.8.3 h1:XyemjL9vAeGHooHn5RQy+ngljd8AVSM2l65Jdnpv4rI= -github.com/nats-io/stan.go v0.8.3/go.mod h1:Ejm8bbHnMTSptU6uNMAVuxeapMJYBB/Ml3ej6z4GoSY= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olivere/elastic v6.2.29+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4= -github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuKHUCQ= -github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= -github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= -github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 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/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= 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/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/pressly/goose v2.6.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8= -github.com/pressly/goose v2.7.0+incompatible h1:PWejVEv07LCerQEzMMeAtjuyCKbyprZ/LBa6K5P0OCQ= github.com/pressly/goose v2.7.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8= -github.com/profefe/profefe v0.0.0-20200307211836-5ab457f7a4d8 h1:9lI6rm0yjyeB6Q5zE/SytxlNDgRQ1thnRZGQChtsLRs= -github.com/profefe/profefe v0.0.0-20200307211836-5ab457f7a4d8/go.mod h1:QOlABo1QFtwVrB7Rdl8gwY9pqxmln8lIWOQEW1oj1uI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.36.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= 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 h1:DksSrntiTPE63NQuxGcFa1OS/odKfwJu3PJHrhKAy7Q= -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/rabbitmq/amqp091-go v1.2.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rabbitmq/amqp091-go v1.3.4 h1:tXuIslN1nhDqs2t6Jrz3BAoqvt4qIZzxvdbdcxWtHYU= github.com/rabbitmq/amqp091-go v1.3.4/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= -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/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/xid v1.2.2-0.20200205151950-d13a6085d55c/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -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/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= +github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873 h1:N3Af8f13ooDKcIhsmFT7Z05CStZWu4C7Md0uDEy4q6o= -github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873/go.mod h1:dmPawKuiAeG/aFYVs2i+Dyosoo7FNcm+Pi8iK6ZUrX8= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/segmentio/encoding v0.1.10/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw= -github.com/segmentio/encoding v0.1.15 h1:btgfyAuFo3uLw7eOrRDPo8H4Bc881+bSPHzAEe0ukho= -github.com/segmentio/encoding v0.1.15/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw= -github.com/segmentio/kafka-go v0.4.9/go.mod h1:BVDwBTF24avtlj4l8/xsWNb4papVeg16+jO6/0qjvhA= -github.com/segmentio/kafka-go v0.4.10/go.mod h1:BVDwBTF24avtlj4l8/xsWNb4papVeg16+jO6/0qjvhA= -github.com/segmentio/kafka-go v0.4.16/go.mod h1:19+Eg7KwrNKy/PFhiIthEPkO8k+ac7/ZYXwYM9Df10w= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -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.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -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/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.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/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= +github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= -github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= -github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo= -github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= -github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= -github.com/swaggo/http-swagger v0.0.0-20200308142732-58ac5e232fba/go.mod h1:O1lAbCgAAX/KZ80LM/OXwtWFI/5TvZlwxSg8Cq08PV0= -github.com/swaggo/http-swagger v1.0.0 h1:ksYgVBCYmAaxFsGVGojlPROgYfiQQSllETTWMtHJHTo= -github.com/swaggo/http-swagger v1.0.0/go.mod h1:cKIcshBU9yEAnfWv6ZzVKSsEf8h5ozxB8/zHQWyOQ/8= -github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y= -github.com/swaggo/swag v1.6.3/go.mod h1:wcc83tB4Mb2aNiL/HP4MFeQdpHUrca+Rp/DRNgWAUio= -github.com/swaggo/swag v1.6.7/go.mod h1:xDhTyuFIujYiN3DKWC/H/83xcfHp+UE/IzWWampG7Zc= -github.com/swaggo/swag v1.7.0 h1:5bCA/MTLQoIqDXXyHfOpMeDvL9j68OY/udlK4pQoo4E= -github.com/swaggo/swag v1.7.0/go.mod h1:BdPIL73gvS9NBsdi7M1JOxLvlbfvNRaBP8m6WT6Aajo= -github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3/go.mod h1:ehwM4AFY4byYSorQbigh79cKUOUNL3pAOz5eCAQNlGI= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= +github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= +github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.9.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA= -github.com/valyala/fasthttp v1.18.0/go.mod h1:jjraHZVbKOXftJfsOYoAjaeygpj5hr8ermTRJNroD7A= -github.com/valyala/fasthttp v1.24.0/go.mod h1:0mw2RjXGOzxf4NL2jni3gUQ7LfjjUSiG5sskOUUSEpU= -github.com/valyala/fasthttp v1.28.0 h1:ruVmTmZaBR5i67NqnjvvH5gEv0zwHfWtbjoyW98iho4= -github.com/valyala/fasthttp v1.28.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfYYdPJBl8BA= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= -github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk= -github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94= -github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ= -github.com/vmihailenco/msgpack/v4 v4.3.5/go.mod h1:DuaveEe48abshDmz5UBKyZ+yDugvaeFk5ayfrewUOaw= -github.com/vmihailenco/msgpack/v4 v4.3.7/go.mod h1:Ii+PksJlvFT5ZRcB/4YLAInMIp6a0WOCm0L3BU0aNG4= -github.com/vmihailenco/msgpack/v4 v4.3.11/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.0/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= -github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI= +go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= +go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU= +go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -905,16 +574,6 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/otel v0.5.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek= -go.opentelemetry.io/otel v0.15.0/go.mod h1:e4GKElweB8W2gWUqbghw0B8t5MCTccc9212eNHnOHwA= -go.opentelemetry.io/otel v0.19.0 h1:Lenfy7QHRXPZVsw/12CWpxX6d/JkrX8wrx2vO8G80Ng= -go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg= -go.opentelemetry.io/otel/metric v0.19.0 h1:dtZ1Ju44gkJkYvo+3qGqVXmf88tc+a42edOywypengg= -go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc= -go.opentelemetry.io/otel/oteltest v0.19.0 h1:YVfA0ByROYqTwOxqHVZYZExzEpfZor+MU1rU+ip2v9Q= -go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA= -go.opentelemetry.io/otel/trace v0.19.0 h1:1ucYlenXIDA1OlHVLDZKX0ObXV5RLaq06DtUKz5e5zc= -go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -936,42 +595,27 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191128160524-b544559bb6d1/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1006,38 +650,27 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/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-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/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-20190108225652-1e06a53dbb7e/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-20190501004415-9ce7a6920f09/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-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/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-20200114155413-6afb5195e5aa/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-20200222125558-5a598a2470a0/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= @@ -1047,34 +680,32 @@ golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -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-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201207224615-747e23833adb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226101413-39120d07d75e/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 h1:yssD99+7tqHWO5Gwh81phT+67hg+KttniBr6UnEXOY8= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0= +golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1086,7 +717,6 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -1107,15 +737,14 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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-20181026203630-95b1ffbd15a5/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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1124,14 +753,9 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/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-20190624142023-c5567b49c5d0/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-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1139,11 +763,11 @@ golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/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-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1157,20 +781,18 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1181,9 +803,9 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210507014357-30e306a8bba5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1196,13 +818,17 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1219,25 +845,18 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 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-20190606124116-d0a3d012864b/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-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1247,7 +866,6 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn 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-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1262,7 +880,6 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200220224806-8a925fa4c0df/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= @@ -1276,12 +893,9 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200826040757-bc8aaaa29e06/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201120155355-20be4ac4bd6e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208062317-e652b2f42cc7/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1292,7 +906,6 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1300,8 +913,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1323,7 +936,6 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= @@ -1339,13 +951,15 @@ google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQ google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.81.0/go.mod h1:FA6Mb/bZxj706H2j+j2d6mHEEaHBmbbWnkfvmorOCko= 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.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/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-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1355,8 +969,6 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -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-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= @@ -1364,14 +976,12 @@ google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200211111953-2dc5924e3898/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200413115906-b5235f65be36/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -1423,14 +1033,19 @@ google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731 h1:nquqdM9+ps0JZcIiI70+tqoaIFS5Ql4ZuK8UXnz3HfE= -google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220713161829-9c7dac0a6568/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220720214146-176da50484ac h1:EOa+Yrhx1C0O+4pHeXeWrCwdI0tWI6IfUU56Vebs9wQ= +google.golang.org/genproto v0.0.0-20220720214146-176da50484ac/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/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.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -1448,7 +1063,6 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= @@ -1456,6 +1070,11 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1476,55 +1095,42 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 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/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= +gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -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/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.2/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/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/go.mod h1:PxYxCwFdFYQ0yRvtQz3s/dC+VEm7CSuC/4b9t8MQQxw= -nhooyr.io/websocket v1.8.4/go.mod h1:LiqdCg1Cu7TPWxEvPjPa0TGYxCsy4pHNTN9gGluwBpQ= -nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/handler/handler.go b/handler/handler.go deleted file mode 100644 index 75bce01..0000000 --- a/handler/handler.go +++ /dev/null @@ -1,139 +0,0 @@ -package handler - -import ( - "fmt" - "net/http" - "time" - - "github.com/integration-system/isp-kit/log" - "github.com/integration-system/isp-lib/v2/config" - "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/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") - -type Handler struct { - logger log.Logger -} - -func New(logger log.Logger) *Handler { - return &Handler{ - logger: logger, - } -} - -func (h Handler) CompleteRequest(ctx *fasthttp.RequestCtx) { - currentTime := time.Now() - - appId, adminId, path, resp := h.authenticateAccountingProxy(ctx) - executionTime := time.Since(currentTime) / execution - - statusCode := ctx.Response.StatusCode() - service.Metrics.UpdateStatusCounter(h.setMetricStatus(statusCode)) - if statusCode == http.StatusOK { - service.Metrics.UpdateMethodResponseTime(path, executionTime) - } - - logEnable := config.GetRemote().(*conf.RemoteConfig).JournalSetting.Journal.Enable - // nolintlint - if logEnable && matcher.JournalMethods.Match(path) { - requestBody, responseBody, err := resp.Get() - fields := []log.Field{ - log.ByteString("http_method", ctx.Method()), - log.String("remote_addr", ctx.RemoteAddr().String()), - log.ByteString("x_forwarded_for", ctx.Request.Header.Peek("X-Forwarded-For")), - log.Int("status_code", ctx.Response.StatusCode()), - log.String("path", path), - log.Int32("application_id", appId), - log.Int64("admin_id", adminId), - log.ByteString("request", requestBody), - log.ByteString("response", responseBody), - } - if err != nil { - fields = append(fields, log.Any("error", err)) - h.logger.Error(ctx, "unsuccessful request", fields...) - } else { - h.logger.Info(ctx, "successful request", fields...) - } - } -} - -func (h Handler) authenticateAccountingProxy(ctx *fasthttp.RequestCtx) (int32, int64, string, domain.ProxyResponse) { - var ( - appId int32 = -1 - adminId int64 = -1 - 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 appId, adminId, 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 appId, adminId, path, domain.Create().SetError(errors.New(msg)) - } - } - - if !p.SkipAuth() { - var err error - appId, adminId, 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 appId, adminId, path, domain.Create().SetError(err) - } - - if !accounting.AcceptRequest(appId, path) { - err := errAccounting - utils.WriteError(ctx, "too many requests", codes.ResourceExhausted, nil) - return appId, adminId, path, domain.Create().SetError(err) - } - } - - return appId, adminId, path, p.ProxyRequest(ctx, path) -} - -func (Handler) 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 -} diff --git a/httperrors/errors.go b/httperrors/errors.go new file mode 100644 index 0000000..df42dbe --- /dev/null +++ b/httperrors/errors.go @@ -0,0 +1,41 @@ +package httperrors + +import ( + "net/http" + + "github.com/integration-system/isp-kit/json" +) + +type HttpError struct { + statusCode int + userMessage string + details []interface{} + err error +} + +func New(statusCode int, userMessage string, internalError error) HttpError { + return HttpError{ + statusCode: statusCode, + userMessage: userMessage, + err: internalError, + } +} + +func (e HttpError) Error() string { + return e.err.Error() +} + +func (e HttpError) WriteError(w http.ResponseWriter) error { + w.Header().Set("content-type", "application/json") + w.WriteHeader(e.statusCode) + data := map[string]interface{}{ + "errorCode": http.StatusText(e.statusCode), + "errorMessage": e.userMessage, + "details": e.details, + } + return json.NewEncoder(w).Encode(data) +} + +func (e *HttpError) WithDetails(details ...interface{}) { + e.details = details +} diff --git a/log_code/code.go b/log_code/code.go deleted file mode 100644 index 131b5c0..0000000 --- a/log_code/code.go +++ /dev/null @@ -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 -) diff --git a/log_code/metadata.go b/log_code/metadata.go deleted file mode 100644 index f67952c..0000000 --- a/log_code/metadata.go +++ /dev/null @@ -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 - } -) diff --git a/main.go b/main.go index 1f70048..1a2ebb4 100644 --- a/main.go +++ b/main.go @@ -1,158 +1,37 @@ package main import ( - "context" - "os" - - "github.com/integration-system/go-cmp/cmp" - "github.com/integration-system/isp-kit/log" - "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" - "github.com/integration-system/isp-lib/v2/utils" - logrus "github.com/integration-system/isp-log" - "github.com/integration-system/isp-log/stdcodes" - "github.com/pkg/errors" - "isp-gate-service/accounting" - "isp-gate-service/authenticate" + "github.com/integration-system/isp-kit/bootstrap" + "github.com/integration-system/isp-kit/shutdown" + "isp-gate-service/assembly" "isp-gate-service/conf" - "isp-gate-service/proxy" - "isp-gate-service/redis" - "isp-gate-service/repository" - "isp-gate-service/routing" - "isp-gate-service/server" - "isp-gate-service/service" - "isp-gate-service/service/matcher" ) var ( - version = "0.1.0" - - logger *log.Adapter + version = "1.0.0" ) func main() { - cfg := config.InitConfig(&conf.Configuration{}).(*conf.Configuration) + boot := bootstrap.New(version, conf.Remote{}, nil) + app := boot.App + logger := app.Logger() - bs := bootstrap. - ServiceBootstrap(&conf.Configuration{}, &conf.RemoteConfig{}). - OnLocalConfigLoad(onLocalConfigLoad). - DefaultRemoteConfigPath(schema.ResolveDefaultConfigPath("default_remote_config.json")). - DeclareMe(makeDeclaration). - SocketConfiguration(socketConfiguration). - RequireRoutes(handleRouteUpdate). - SubscribeBroadcastEvent(bootstrap.ListenRestartEvent()) - - requiredModules, err := proxy.InitProxies(cfg.Locations) + assembly, err := assembly.New(boot) if err != nil { - logrus.Fatal(stdcodes.ModuleInvalidLocalConfig, err) + logger.Fatal(app.Context(), err) } - for module, consumer := range requiredModules { - bs.RequireModule(module, consumer, false) - } - bs.RequireModule(cfg.ModuleName, accounting.NewConnectionConsumer, false). - OnShutdown(onShutdown). - OnRemoteConfigReceive(onRemoteConfigReceive). - Run() -} + app.AddRunners(assembly.Runners()...) + app.AddClosers(assembly.Closers()...) -func onLocalConfigLoad(_ *conf.Configuration) { + shutdown.On(func() { + logger.Info(app.Context(), "starting shutdown") + app.Shutdown() + logger.Info(app.Context(), "shutdown completed") + }) -} - -func onRemoteConfigReceive(remoteConfig, oldRemoteConfig *conf.RemoteConfig) { - repository.DbClient.ReceiveConfiguration(remoteConfig.Database) - 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() - - oldLogger := setLogger(remoteConfig.JournalSetting.Journal, oldRemoteConfig.JournalSetting.Journal) - defer func() { - if oldLogger != nil { - _ = oldLogger.Close() - } - }() - - isDifferentSettingForHttpServ := - !cmp.Equal(remoteConfig.HttpSetting, oldRemoteConfig.HttpSetting) || oldLogger != nil - server.Http.Init(isDifferentSettingForHttpServ, remoteConfig.HttpSetting.GetMaxRequestBodySize(), logger) -} - -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, - }, - } -} - -func onShutdown(_ context.Context, _ os.Signal) { - server.Http.Close() - accounting.Close() - proxy.Close() - _ = redis.Client.Close() - if logger != nil { - _ = logger.Close() - } -} - -func handleRouteUpdate(configs structure.RoutingConfig) bool { - routing.InitRoutes(configs) - return true -} - -func makeDeclaration(localConfig interface{}) bootstrap.ModuleInfo { - cfg := localConfig.(*conf.Configuration) - return bootstrap.ModuleInfo{ - ModuleName: cfg.ModuleName, - ModuleVersion: version, - GrpcOuterAddress: cfg.HttpOuterAddress, - Endpoints: []structure.EndpointDescriptor{}, - } -} - -func setLogger(loggerCfg, oldLoggerCfg conf.JorunalConfig) *log.Adapter { - if cmp.Equal(loggerCfg, oldLoggerCfg) { - return nil - } - - // temporary for file rotation. Selected based on max size 512 mb - maxBackups := 2 - - var err error - oldLogger := logger - loggerOpts := []log.Option{log.WithDevelopmentMode(), log.WithLevel(log.DebugLevel)} - isDev := utils.DEV - if !isDev { - loggerOpts = []log.Option{log.WithLevel(log.InfoLevel)} - logFilePath := loggerCfg.Filename - if logFilePath != "" { - rotation := log.Rotation{ - File: logFilePath, - MaxSizeMb: loggerCfg.MaxSizeMb, - MaxDays: 0, - MaxBackups: maxBackups, - Compress: loggerCfg.Compress, - } - loggerOpts = append(loggerOpts, log.WithFileRotation(rotation)) - } - } - logger, err = log.New(loggerOpts...) + err = app.Run() if err != nil { - logrus.Fatal(stdcodes.ModuleRunFatalError, errors.WithMessage(err, "set logger")) + app.Shutdown() + logger.Fatal(app.Context(), err) } - - return oldLogger } diff --git a/middleware/admin_authenticate.go b/middleware/admin_authenticate.go new file mode 100644 index 0000000..439d50b --- /dev/null +++ b/middleware/admin_authenticate.go @@ -0,0 +1,39 @@ +package middleware + +import ( + "net/http" + "strings" + + "github.com/pkg/errors" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +const ( + adminAuthHeader = "x-auth-admin" +) + +type AdminAuthenticator interface { + Authenticate(token string) (int, error) +} + +func AdminAuthenticate(auth AdminAuthenticator) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + adminToken := strings.TrimSpace(ctx.Request().Header.Get(adminAuthHeader)) + if adminToken == "" { + return next.Handle(ctx) + } + adminId, err := auth.Authenticate(adminToken) + if err != nil { + return httperrors.New( + http.StatusUnauthorized, + "invalid admin token", + errors.WithMessage(err, "admin authenticate: authenticate"), + ) + } + ctx.AuthenticateAdmin(adminId, adminToken) + return next.Handle(ctx) + }) + } +} diff --git a/middleware/admin_authorize.go b/middleware/admin_authorize.go new file mode 100644 index 0000000..9c4ee53 --- /dev/null +++ b/middleware/admin_authorize.go @@ -0,0 +1,32 @@ +package middleware + +import ( + "net/http" + + "github.com/pkg/errors" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +type AdminMethodStore interface { + IsInnerMethod(path string) bool +} + +func AdminAuthorize(store AdminMethodStore) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + isInner := store.IsInnerMethod(ctx.Endpoint()) + if !isInner { + return next.Handle(ctx) + } + if ctx.IsAdminAuthenticated() { + return next.Handle(ctx) + } + return httperrors.New( + http.StatusForbidden, + "admin authentication required", + errors.Errorf("admin authorization: admin authentication required for '%s'", ctx.Endpoint()), + ) + }) + } +} diff --git a/middleware/authenticate.go b/middleware/authenticate.go new file mode 100644 index 0000000..c0a9c5c --- /dev/null +++ b/middleware/authenticate.go @@ -0,0 +1,50 @@ +package middleware + +import ( + "context" + "net/http" + "strings" + + "github.com/pkg/errors" + "isp-gate-service/domain" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +const ( + applicationTokenHeader = "x-application-token" +) + +type Authenticator interface { + Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error) +} + +func Authenticate(authenticator Authenticator) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + token := strings.TrimSpace(ctx.Request().Header.Get(applicationTokenHeader)) + 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.WithMessagef(err, "authenticate: authenticate") + } + if !resp.Authenticated { + return httperrors.New( + http.StatusUnauthorized, + "invalid application token", + errors.WithMessage(errors.New(resp.ErrorReason), "authenticate: authenticate"), + ) + } + ctx.Authenticate(request.AuthData(*resp.AuthData)) + + return next.Handle(ctx) + }) + } +} diff --git a/middleware/authorize.go b/middleware/authorize.go new file mode 100644 index 0000000..2a9c3b8 --- /dev/null +++ b/middleware/authorize.go @@ -0,0 +1,49 @@ +package middleware + +import ( + "context" + "net/http" + + "github.com/integration-system/isp-kit/log" + "github.com/pkg/errors" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +type Authorizer interface { + Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) +} + +func Authorize(authorizer Authorizer, logger log.Logger) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + authData, err := ctx.GetAuthData() + if err != nil { + return errors.WithMessage(err, "authorize: get auth data") + } + + ok, err := authorizer.Authorize(ctx.Context(), authData.ApplicationId, ctx.Endpoint()) + if err != nil { + return errors.WithMessage(err, "authorize: authorize") + } + if !ok && ctx.IsAdminAuthenticated() { + logger.Info( + ctx.Context(), + "bypassing unauthorized request because it has admin privilege", + log.Int("applicationId", authData.ApplicationId), + log.Int("adminId", ctx.AdminId()), + ) + return next.Handle(ctx) + } + if !ok { + return httperrors.New( + http.StatusForbidden, + "endpoint is not allowed", + errors.Errorf("authorize: endpoint '%s' is not allowed for application '%d'", ctx.Endpoint(), authData.ApplicationId), + ) + } + + return next.Handle(ctx) + }) + } +} diff --git a/middleware/daily_limit.go b/middleware/daily_limit.go new file mode 100644 index 0000000..4ca063b --- /dev/null +++ b/middleware/daily_limit.go @@ -0,0 +1,39 @@ +package middleware + +import ( + "context" + "net/http" + + "github.com/pkg/errors" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +type DailyLimitChecker interface { + IncrementAndCheck(ctx context.Context, applicationId int) (bool, error) +} + +func DailyLimit(checker DailyLimitChecker) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + authData, err := ctx.GetAuthData() + if err != nil { + return errors.WithMessage(err, "daily limit: get auth data") + } + + ok, err := checker.IncrementAndCheck(ctx.Context(), authData.ApplicationId) + if err != nil { + return errors.WithMessage(err, "daily limit: increment and check") + } + if !ok { + return httperrors.New( + http.StatusTooManyRequests, + "daily requests limit has been reached", + errors.Errorf("daily limit: daily requests limit has been reached for application '%d'", authData.ApplicationId), + ) + } + + return next.Handle(ctx) + }) + } +} diff --git a/middleware/entrypoint.go b/middleware/entrypoint.go new file mode 100644 index 0000000..6779357 --- /dev/null +++ b/middleware/entrypoint.go @@ -0,0 +1,26 @@ +package middleware + +import ( + "fmt" + "net/http" + "strings" + + "github.com/integration-system/isp-kit/log" + "github.com/pkg/errors" + "isp-gate-service/request" +) + +func Entrypoint(maxReqBodySize int64, next Handler, pathPrefix string, logger log.Logger) http.Handler { + return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) { + req.Body = http.MaxBytesReader(writer, req.Body, maxReqBodySize) + + prefix := fmt.Sprintf("%s/", pathPrefix) + endpoint := strings.TrimPrefix(req.URL.String(), prefix) + ctx := request.NewContext(req, writer, endpoint) + + err := next.Handle(ctx) + if err != nil { + logger.Error(req.Context(), errors.WithMessage(err, "uncaught error")) + } + }) +} diff --git a/middleware/error_handler.go b/middleware/error_handler.go new file mode 100644 index 0000000..09717c7 --- /dev/null +++ b/middleware/error_handler.go @@ -0,0 +1,35 @@ +package middleware + +import ( + "net/http" + + "github.com/integration-system/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()) + }) + } +} diff --git a/middleware/logger.go b/middleware/logger.go new file mode 100644 index 0000000..3e6980a --- /dev/null +++ b/middleware/logger.go @@ -0,0 +1,91 @@ +package middleware + +import ( + "bytes" + "io/ioutil" + "net/http" + + "github.com/integration-system/isp-kit/http/endpoint/buffer" + "github.com/integration-system/isp-kit/log" + "github.com/pkg/errors" + "isp-gate-service/request" +) + +type scSource interface { + StatusCode() int +} + +type writerWrapper struct { + http.ResponseWriter + statusCode int +} + +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(logger log.Logger, enableRequestLogging bool, enableBodyLogging bool) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + if !enableRequestLogging { + return next.Handle(ctx) + } + + r := ctx.Request() + var scSrc scSource + var buf *buffer.Buffer + if enableBodyLogging { + 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 = ioutil.NopCloser(bytes.NewBuffer(buf.RequestBody())) + + scSrc = buf + ctx.SetResponseWriter(buf) + } else { + writer := &writerWrapper{ResponseWriter: ctx.ResponseWriter()} + scSrc = writer + ctx.SetResponseWriter(writer) + } + + err := next.Handle(ctx) + + authData, _ := ctx.GetAuthData() + fields := []log.Field{ + log.String("http_method", r.Method), + log.String("remote_addr", r.RemoteAddr), + log.String("x_forwarded_for", r.Header.Get("X-Forwarded-For")), + log.Int("status_code", scSrc.StatusCode()), + log.String("path", r.URL.Path), + log.String("endpoint", ctx.Endpoint()), + log.Int("application_id", authData.ApplicationId), + log.Int("admin_id", ctx.AdminId()), + } + if enableBodyLogging { + fields = append(fields, + log.ByteString("request", buf.RequestBody()), + log.ByteString("response", buf.ResponseBody()), + ) + } + logger.Debug(ctx.Context(), "log request", fields...) + + return err + }) + } +} diff --git a/middleware/middleware.go b/middleware/middleware.go new file mode 100644 index 0000000..5d60db0 --- /dev/null +++ b/middleware/middleware.go @@ -0,0 +1,24 @@ +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 + +func Chain(root Handler, middlewares ...Middleware) Handler { + for i := len(middlewares) - 1; i >= 0; i-- { + root = middlewares[i](root) + } + return root +} diff --git a/middleware/request_id.go b/middleware/request_id.go new file mode 100644 index 0000000..95ed550 --- /dev/null +++ b/middleware/request_id.go @@ -0,0 +1,31 @@ +package middleware + +import ( + "strings" + + "github.com/integration-system/isp-kit/log" + "github.com/integration-system/isp-kit/requestid" + "isp-gate-service/request" +) + +const ( + requestIdHeader = "x-request-id" +) + +func RequestId() Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + requestId := strings.TrimSpace(ctx.Request().Header.Get(requestIdHeader)) + if requestId == "" { + requestId = requestid.Next() + } + + context := requestid.ToContext(ctx.Context(), requestId) + context = log.ToContext(context, log.String("requestId", requestId)) + + ctx.SetContext(context) + + return next.Handle(ctx) + }) + } +} diff --git a/middleware/throttling.go b/middleware/throttling.go new file mode 100644 index 0000000..8abd3f8 --- /dev/null +++ b/middleware/throttling.go @@ -0,0 +1,41 @@ +package middleware + +import ( + "context" + "fmt" + "net/http" + + "github.com/pkg/errors" + "isp-gate-service/domain" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +type Throttler interface { + AllowRateLimit(ctx context.Context, applicationId int) (*domain.RateLimitResult, error) +} + +func Throttling(throttler Throttler) Middleware { + return func(next Handler) Handler { + return HandlerFunc(func(ctx *request.Context) error { + authData, err := ctx.GetAuthData() + if err != nil { + return errors.WithMessage(err, "throttling: get auth data") + } + + result, err := throttler.AllowRateLimit(ctx.Context(), authData.ApplicationId) + if err != nil { + return errors.WithMessage(err, "throttling: allow rate limit") + } + if !result.Allow { + return httperrors.New( + http.StatusTooManyRequests, + fmt.Sprintf("rate limit has been reached, try after %dms", result.RetryAfter.Milliseconds()), + errors.Errorf("throttling: rate limit has been reached for application '%d'", authData.ApplicationId), + ) + } + + return next.Handle(ctx) + }) + } +} diff --git a/migrations/00001_2019-11-14_init.sql b/migrations/00001_2019-11-14_init.sql deleted file mode 100644 index 5a1c2c4..0000000 --- a/migrations/00001_2019-11-14_init.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/migrations/00002_2019-11-19_add_requests.sql b/migrations/00002_2019-11-19_add_requests.sql deleted file mode 100644 index a7de482..0000000 --- a/migrations/00002_2019-11-19_add_requests.sql +++ /dev/null @@ -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; diff --git a/migrations/00003_2019-11-25_update_snapshot.sql b/migrations/00003_2019-11-25_update_snapshot.sql deleted file mode 100644 index e69a04b..0000000 --- a/migrations/00003_2019-11-25_update_snapshot.sql +++ /dev/null @@ -1,6 +0,0 @@ --- +goose Up - -ALTER TABLE snapshot - ADD version BIGINT NOT NULL DEFAULT 0; - --- +goose Down \ No newline at end of file diff --git a/proxy/grpc.go b/proxy/grpc.go new file mode 100644 index 0000000..e01aca1 --- /dev/null +++ b/proxy/grpc.go @@ -0,0 +1,162 @@ +package proxy + +import ( + "context" + "io/ioutil" + "net/http" + "strconv" + "time" + + "github.com/integration-system/isp-kit/grpc" + "github.com/integration-system/isp-kit/grpc/client" + "github.com/integration-system/isp-kit/grpc/isp" + "github.com/integration-system/isp-kit/json" + "github.com/integration-system/isp-kit/requestid" + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +const ( + adminAuthHeader = "x-auth-admin" +) + +func init() { + for httpCode, grpcCode := range codeMap { + inverseCodeMap[grpcCode] = httpCode + } +} + +var ( + codeMap = map[int]codes.Code{ + http.StatusOK: codes.OK, + http.StatusRequestTimeout: codes.Canceled, + http.StatusBadRequest: codes.InvalidArgument, + http.StatusGatewayTimeout: codes.DeadlineExceeded, + http.StatusNotFound: codes.NotFound, + http.StatusConflict: codes.AlreadyExists, + http.StatusForbidden: codes.PermissionDenied, + http.StatusUnauthorized: codes.Unauthenticated, + http.StatusTooManyRequests: codes.ResourceExhausted, + http.StatusPreconditionFailed: codes.FailedPrecondition, + http.StatusNotImplemented: codes.Unimplemented, + http.StatusInternalServerError: codes.Internal, + http.StatusServiceUnavailable: codes.Unavailable, + } + inverseCodeMap = map[codes.Code]int{} +) + +type Grpc struct { + cli *client.Client + skipAuth bool + timeout time.Duration +} + +func NewGrpc(cli *client.Client, skipAuth bool, timeout time.Duration) Grpc { + return Grpc{ + cli: cli, + skipAuth: skipAuth, + timeout: timeout, + } +} + +func (p Grpc) Handle(ctx *request.Context) error { + body, err := ioutil.ReadAll(ctx.Request().Body) + if err != nil { + return errors.WithMessage(err, "grpc: read body") + } + + md := metadata.MD{ + grpc.ProxyMethodNameHeader: {ctx.Endpoint()}, + grpc.RequestIdHeader: {requestid.FromContext(ctx.Context())}, + } + if !p.skipAuth { + authData, err := ctx.GetAuthData() + if err != nil { + return errors.WithMessage(err, "get auth data") + } + md[grpc.SystemIdHeader] = []string{strconv.Itoa(authData.SystemId)} + md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)} + md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)} + md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)} + if ctx.IsAdminAuthenticated() { + md[adminAuthHeader] = []string{ctx.AdminToken()} + } + } + 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()) + } + + return p.writeResponse(http.StatusOK, result.GetBytesBody(), ctx.ResponseWriter()) +} + +func (p Grpc) handleError(err error, w http.ResponseWriter) 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(), + status.Err(), + ) +} + +func (p Grpc) writeProto(statusCode int, proto interface{}, w http.ResponseWriter) error { + data, err := json.Marshal(proto) + if err != nil { + return errors.WithMessage(err, "marshal grpc details to json") + } + return p.writeResponse(statusCode, data, w) +} + +func (p Grpc) writeResponse(statusCode int, data []byte, w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + 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 +} diff --git a/proxy/grpc/client.go b/proxy/grpc/client.go deleted file mode 100644 index f7e63ee..0000000 --- a/proxy/grpc/client.go +++ /dev/null @@ -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() -} diff --git a/proxy/grpc/handlers/common.go b/proxy/grpc/handlers/common.go deleted file mode 100644 index 0ac4cc0..0000000 --- a/proxy/grpc/handlers/common.go +++ /dev/null @@ -1,165 +0,0 @@ -package handlers - -import ( - "bytes" - "io" - "net/http" - "time" - - 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" - "google.golang.org/protobuf/proto" - "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" - - metadataSize = 5 -) - -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, metadataSize) - 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 -} diff --git a/proxy/grpc/handlers/description.go b/proxy/grpc/handlers/description.go deleted file mode 100644 index f34b552..0000000 --- a/proxy/grpc/handlers/description.go +++ /dev/null @@ -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 -} diff --git a/proxy/grpc/handlers/handle_get_file.go b/proxy/grpc/handlers/handle_get_file.go deleted file mode 100644 index 28e1606..0000000 --- a/proxy/grpc/handlers/handle_get_file.go +++ /dev/null @@ -1,138 +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) -} - -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) -} diff --git a/proxy/grpc/handlers/handle_json.go b/proxy/grpc/handlers/handle_json.go deleted file mode 100644 index 3508350..0000000 --- a/proxy/grpc/handlers/handle_json.go +++ /dev/null @@ -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) - } -} diff --git a/proxy/grpc/handlers/handle_send_multipart_data.go b/proxy/grpc/handlers/handle_send_multipart_data.go deleted file mode 100644 index fad7a18..0000000 --- a/proxy/grpc/handlers/handle_send_multipart_data.go +++ /dev/null @@ -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 -} diff --git a/proxy/health_check/health_check.go b/proxy/health_check/health_check.go deleted file mode 100644 index d9e80e3..0000000 --- a/proxy/health_check/health_check.go +++ /dev/null @@ -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() { - -} diff --git a/proxy/http.go b/proxy/http.go new file mode 100644 index 0000000..d7123a0 --- /dev/null +++ b/proxy/http.go @@ -0,0 +1,82 @@ +package proxy + +import ( + "fmt" + "net/http" + "net/http/httputil" + "net/url" + "strconv" + "time" + + "github.com/integration-system/isp-kit/grpc" + "github.com/integration-system/isp-kit/requestid" + "github.com/pkg/errors" + "golang.org/x/net/context" + "isp-gate-service/httperrors" + "isp-gate-service/request" +) + +type HttpHostManager interface { + Next() (string, error) +} + +type Http struct { + hostManager HttpHostManager + skipAuth bool + timeout time.Duration +} + +func NewHttp(hostManager HttpHostManager, skipAuth bool, timeout time.Duration) Http { + return Http{ + hostManager: hostManager, + skipAuth: skipAuth, + timeout: timeout, + } +} + +func (p Http) Handle(ctx *request.Context) error { + host, err := p.hostManager.Next() + if err != nil { + return errors.WithMessage(err, "http: next host") + } + + rawUrl := fmt.Sprintf("http://%s", host) // secure HTTP links are reset connection + target, err := url.Parse(rawUrl) + if err != nil { + return errors.WithMessage(err, "http: parse url") + } + + request := ctx.Request() + request.URL.Path = ctx.Endpoint() + request.Header.Set(grpc.RequestIdHeader, requestid.FromContext(ctx.Context())) + if !p.skipAuth { + authData, err := ctx.GetAuthData() + if err != nil { + return errors.WithMessage(err, "http: get auth data") + } + request.Header.Set(grpc.SystemIdHeader, strconv.Itoa(authData.SystemId)) + request.Header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId)) + request.Header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId)) + request.Header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId)) + if ctx.IsAdminAuthenticated() { + request.Header.Set(adminAuthHeader, ctx.AdminToken()) + } + } + + reverseProxy := httputil.NewSingleHostReverseProxy(target) + var resultError error + reverseProxy.ErrorHandler = func(writer http.ResponseWriter, request *http.Request, err error) { + resultError = httperrors.New( + http.StatusServiceUnavailable, + "upstream is not available", + errors.WithMessagef(err, "http proxy to %s", host), + ) + } + + context, cancel := context.WithTimeout(request.Context(), p.timeout) + defer cancel() + request = request.WithContext(context) + reverseProxy.ServeHTTP(ctx.ResponseWriter(), request) + + return resultError +} diff --git a/proxy/http/client.go b/proxy/http/client.go deleted file mode 100644 index adfe965..0000000 --- a/proxy/http/client.go +++ /dev/null @@ -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 -} diff --git a/proxy/proxy.go b/proxy/proxy.go deleted file mode 100644 index 2befa12..0000000 --- a/proxy/proxy.go +++ /dev/null @@ -1,121 +0,0 @@ -package proxy - -import ( - "isp-gate-service/conf" - "sort" - "strings" - - "github.com/integration-system/isp-lib/v2/structure" - "github.com/pkg/errors" - "github.com/valyala/fasthttp" - "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) -) - -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 - 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 - }) - - return requiredModules, nil -} - -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 strings.HasPrefix(path, item.pathPrefix) { - return item.proxy, getPathWithoutPrefix(path, item.pathPrefix) - } - } - 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 - } -} diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go deleted file mode 100644 index cd06e5e..0000000 --- a/proxy/proxy_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package proxy - -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) - } - }) - } -} diff --git a/proxy/websocket/util.go b/proxy/websocket/util.go deleted file mode 100644 index 8c30826..0000000 --- a/proxy/websocket/util.go +++ /dev/null @@ -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), - } -} diff --git a/proxy/websocket/websocket.go b/proxy/websocket/websocket.go deleted file mode 100644 index 0ceaf32..0000000 --- a/proxy/websocket/websocket.go +++ /dev/null @@ -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 - } - } -} diff --git a/redis/client.go b/redis/client.go deleted file mode 100644 index 6f07a08..0000000 --- a/redis/client.go +++ /dev/null @@ -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) - } - })) -) diff --git a/repository/authentication_cache.go b/repository/authentication_cache.go new file mode 100644 index 0000000..20b9dca --- /dev/null +++ b/repository/authentication_cache.go @@ -0,0 +1,49 @@ +package repository + +import ( + "context" + "time" + + "github.com/integration-system/isp-kit/json" + "github.com/pkg/errors" + "isp-gate-service/cache" + "isp-gate-service/domain" +) + +type AuthenticationCache struct { + cache *cache.Cache + duration time.Duration +} + +func NewAuthenticationCache(duration time.Duration) AuthenticationCache { + return AuthenticationCache{ + duration: duration, + cache: cache.New(), + } +} + +func (r AuthenticationCache) Get(ctx context.Context, token string) (*domain.AuthData, error) { + data, ok := r.cache.Get(token) + if !ok { + return nil, domain.ErrAuthenticationCacheMiss + } + + result := domain.AuthData{} + err := json.Unmarshal(data, &result) + if err != nil { + return nil, errors.WithMessage(err, "json unmarshal auth data") + } + + return &result, nil +} + +func (r AuthenticationCache) Set(ctx context.Context, token string, data domain.AuthData) error { + value, err := json.Marshal(data) + if err != nil { + return errors.WithMessage(err, "json marshal auth data") + } + + r.cache.Set(token, value, r.duration) + + return nil +} diff --git a/repository/authorization_cache.go b/repository/authorization_cache.go new file mode 100644 index 0000000..b121da8 --- /dev/null +++ b/repository/authorization_cache.go @@ -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, applicationId int, endpoint string) (bool, error) { + key := r.key(applicationId, endpoint) + _, ok := r.cache.Get(key) + return ok, nil +} + +func (r AuthorizationCache) SetAuthorized(ctx context.Context, applicationId int, endpoint string) error { + key := r.key(applicationId, endpoint) + r.cache.Set(key, nil, r.duration) + return nil +} + +func (r AuthorizationCache) key(applicationId int, endpoint string) string { + return fmt.Sprintf("%d:%s", applicationId, endpoint) +} diff --git a/repository/client.go b/repository/client.go deleted file mode 100644 index e623894..0000000 --- a/repository/client.go +++ /dev/null @@ -1,20 +0,0 @@ -package repository - -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} -) diff --git a/repository/daily_limit.go b/repository/daily_limit.go new file mode 100644 index 0000000..a27db75 --- /dev/null +++ b/repository/daily_limit.go @@ -0,0 +1,42 @@ +package repository + +import ( + "context" + "fmt" + "time" + + "github.com/go-redis/redis/v8" + "github.com/pkg/errors" +) + +type DailyLimit struct { + cli redis.UniversalClient +} + +func NewDailyLimit(cli redis.UniversalClient) DailyLimit { + return DailyLimit{ + cli: cli, + } +} + +func (r DailyLimit) Increment(ctx context.Context, applicationId int, today time.Time) (int64, error) { + key := r.key(applicationId, today) + value, err := r.cli.Incr(ctx, key).Result() + if err != nil { + return 0, errors.WithMessage(err, "incr") + } + + if value == 1 { + err := r.cli.ExpireNX(ctx, key, 24*time.Hour).Err() //nolint:gomnd + if err != nil { + return 0, errors.WithMessage(err, "expire nx") + } + } + + return value, nil +} + +func (r DailyLimit) key(applicationId int, today time.Time) string { + y, m, d := today.Date() + return fmt.Sprintf("daily_limit:%d:%d-%d-%d", applicationId, y, m, d) +} diff --git a/repository/requests.go b/repository/requests.go deleted file mode 100644 index f8e16c1..0000000 --- a/repository/requests.go +++ /dev/null @@ -1,30 +0,0 @@ -package repository - -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() -} diff --git a/repository/snapshot.go b/repository/snapshot.go deleted file mode 100644 index a08f7fb..0000000 --- a/repository/snapshot.go +++ /dev/null @@ -1,50 +0,0 @@ -package repository - -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() -} diff --git a/repository/system.go b/repository/system.go new file mode 100644 index 0000000..4830f5e --- /dev/null +++ b/repository/system.go @@ -0,0 +1,48 @@ +package repository + +import ( + "context" + + "github.com/integration-system/isp-kit/grpc/client" + "github.com/pkg/errors" + "isp-gate-service/domain" +) + +const ( + authenticate = "system/secure/authenticate" + authorize = "system/secure/authorize" +) + +type System struct { + cli *client.Client +} + +func NewSystem(cli *client.Client) System { + return System{ + cli: cli, + } +} + +func (r System) Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error) { + resp := domain.AuthenticateResponse{} + err := r.cli.Invoke(authenticate). + JsonRequestBody(domain.AuthenticateRequest{Token: token}). + ReadJsonResponse(&resp). + Do(ctx) + if err != nil { + return nil, errors.WithMessagef(err, "grpc client invoke: %s", authenticate) + } + return &resp, nil +} + +func (r System) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) { + resp := domain.AuthorizeResponse{} + err := r.cli.Invoke(authorize). + JsonRequestBody(domain.AuthorizeRequest{ApplicationId: applicationId, Endpoint: endpoint}). + ReadJsonResponse(&resp). + Do(ctx) + if err != nil { + return false, errors.WithMessagef(err, "grpc client invoke: %s", authorize) + } + return resp.Authorized, nil +} diff --git a/repository/throttling.go b/repository/throttling.go new file mode 100644 index 0000000..cd1090e --- /dev/null +++ b/repository/throttling.go @@ -0,0 +1,37 @@ +package repository + +import ( + "context" + "fmt" + + "github.com/go-redis/redis/v8" + "github.com/go-redis/redis_rate/v9" + "github.com/pkg/errors" + "isp-gate-service/domain" +) + +type Throttling struct { + cli *redis_rate.Limiter +} + +func NewThrottling(cli redis.UniversalClient) Throttling { + return Throttling{ + cli: redis_rate.NewLimiter(cli), + } +} + +func (r Throttling) IsAllowRequestPerSecond(ctx context.Context, applicationId int, rate int) (*domain.RateLimitResult, error) { + result, err := r.cli.Allow(ctx, r.key(applicationId), redis_rate.PerSecond(rate)) + if err != nil { + return nil, errors.WithMessage(err, "redis_rate/Allow") + } + return &domain.RateLimitResult{ + Allow: result.Allowed > 0, + Remaining: result.Remaining, + RetryAfter: result.RetryAfter, + }, nil +} + +func (r Throttling) key(applicationId int) string { + return fmt.Sprintf("throttling:%d", applicationId) +} diff --git a/repository/unused/redis_auth_cache.go b/repository/unused/redis_auth_cache.go new file mode 100644 index 0000000..84af175 --- /dev/null +++ b/repository/unused/redis_auth_cache.go @@ -0,0 +1,75 @@ +package unused + +import ( + "context" + "time" + + "github.com/go-redis/redis/v8" + "github.com/integration-system/isp-kit/json" + "github.com/pkg/errors" + "isp-gate-service/domain" +) + +type RedisAuthCache struct { + cli redis.UniversalClient + duration time.Duration + db int +} + +func NewRedisAuthCache(cli redis.UniversalClient, duration time.Duration, db int) RedisAuthCache { + return RedisAuthCache{ + cli: cli, + duration: duration, + db: db, + } +} + +func (r RedisAuthCache) Get(ctx context.Context, token string) (*domain.AuthData, error) { + results, err := r.cli.Pipelined(ctx, func(p redis.Pipeliner) error { + p.Select(ctx, r.db) + p.Get(ctx, token) + return nil + }) + if err != nil && err != redis.Nil { + return nil, errors.WithMessage(err, "pipelined") + } + + data, err := results[1].(*redis.StringCmd).Result() + if errors.Is(err, redis.Nil) { + return nil, domain.ErrAuthenticationCacheMiss + } + if err != nil { + return nil, errors.WithMessage(err, "get") + } + + result := domain.AuthData{} + err = json.Unmarshal([]byte(data), &result) + if err != nil { + return nil, errors.WithMessage(err, "json unmarshal auth data") + } + + return &result, nil +} + +func (r RedisAuthCache) Set(ctx context.Context, token string, data domain.AuthData) error { + value, err := json.Marshal(data) + if err != nil { + return errors.WithMessage(err, "json marshal auth data") + } + + results, err := r.cli.Pipelined(ctx, func(p redis.Pipeliner) error { + p.Select(ctx, r.db) + p.SetEX(ctx, token, string(value), r.duration) + return nil + }) + if err != nil { + return errors.WithMessage(err, "pipelined") + } + + err = results[1].Err() + if err != nil { + return errors.WithMessage(err, "set ex") + } + + return nil +} diff --git a/repository/unused/redis_authz_cache.go b/repository/unused/redis_authz_cache.go new file mode 100644 index 0000000..9e06024 --- /dev/null +++ b/repository/unused/redis_authz_cache.go @@ -0,0 +1,66 @@ +package unused + +import ( + "context" + "fmt" + "time" + + "github.com/go-redis/redis/v8" + "github.com/pkg/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 && err != redis.Nil { + return false, errors.WithMessage(err, "pipelined") + } + + _, err = result[1].(*redis.StringCmd).Result() + 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) +} diff --git a/request/context.go b/request/context.go new file mode 100644 index 0000000..e173e60 --- /dev/null +++ b/request/context.go @@ -0,0 +1,95 @@ +package request + +import ( + "context" + "net/http" + + "github.com/pkg/errors" +) + +var ( + ErrNotAuthenticated = errors.New("not authenticated") +) + +type AuthData struct { + SystemId int + DomainId int + ServiceId int + ApplicationId int +} + +type Context struct { + request *http.Request + responseWriter http.ResponseWriter + + endpoint string + + authenticated bool + authData *AuthData + + adminAuthenticated bool + adminId int + adminToken string +} + +func NewContext(request *http.Request, response http.ResponseWriter, endpoint string) *Context { + return &Context{ + request: request, + responseWriter: response, + endpoint: endpoint, + } +} + +func (c *Context) Request() *http.Request { + return c.request +} + +func (c *Context) ResponseWriter() http.ResponseWriter { + return c.responseWriter +} + +func (c *Context) SetResponseWriter(writer http.ResponseWriter) { + c.responseWriter = writer +} + +func (c *Context) Endpoint() string { + return c.endpoint +} + +func (c *Context) Authenticate(authData AuthData) { + c.authenticated = true + c.authData = &authData +} + +func (c *Context) GetAuthData() (AuthData, error) { + if !c.authenticated { + return AuthData{}, ErrNotAuthenticated + } + return *c.authData, nil +} + +func (c *Context) IsAdminAuthenticated() bool { + return c.adminAuthenticated +} + +func (c *Context) AdminId() int { + return c.adminId +} + +func (c *Context) AdminToken() string { + return c.adminToken +} + +func (c *Context) AuthenticateAdmin(adminId int, adminToken string) { + c.adminAuthenticated = true + c.adminId = adminId + c.adminToken = adminToken +} + +func (c *Context) Context() context.Context { + return c.request.Context() +} + +func (c *Context) SetContext(ctx context.Context) { + c.request = c.request.WithContext(ctx) +} diff --git a/routes/routes.go b/routes/routes.go new file mode 100644 index 0000000..f0ea6f4 --- /dev/null +++ b/routes/routes.go @@ -0,0 +1,36 @@ +package routes + +import ( + "context" + + "github.com/integration-system/isp-kit/cluster" +) + +type Routes struct { + innerMethods map[string]bool +} + +func NewRoutes() *Routes { + return &Routes{ + innerMethods: make(map[string]bool), + } +} + +func (s *Routes) ReceiveRoutes(ctx context.Context, routes cluster.RoutingConfig) error { + newInnerMethods := make(map[string]bool) + for _, backend := range routes { + for _, v := range backend.Endpoints { + if v.Inner { + newInnerMethods[v.Path] = true + } + } + } + + s.innerMethods = newInnerMethods + + return nil +} + +func (s *Routes) IsInnerMethod(path string) bool { + return s.innerMethods[path] +} diff --git a/routing/routing.go b/routing/routing.go deleted file mode 100644 index 9aa406b..0000000 --- a/routing/routing.go +++ /dev/null @@ -1,35 +0,0 @@ -package routing - -import ( - "github.com/integration-system/isp-lib/v2/structure" -) - -var ( - InnerMethods = make(map[string]bool) - AllMethods = make(map[string]bool) - AuthUserMethods = make(map[string]bool) -) - -func InitRoutes(configs structure.RoutingConfig) { - newAddressMap := make(map[string]bool) - newInnerAddressMap := make(map[string]bool) - newAuthUserAddressMap := make(map[string]bool) - for i := range configs { - backend := &configs[i] - if backend.Address.IP == "" || backend.Address.Port == "" || len(backend.Endpoints) == 0 { - continue - } - for _, v := range backend.Endpoints { - newAddressMap[v.Path] = true - if v.Inner { - newInnerAddressMap[v.Path] = true - } - if v.UserAuthRequired { - newAuthUserAddressMap[v.Path] = true - } - } - } - AllMethods = newAddressMap - InnerMethods = newInnerAddressMap - AuthUserMethods = newAuthUserAddressMap -} diff --git a/server/http.go b/server/http.go deleted file mode 100644 index 1021b9a..0000000 --- a/server/http.go +++ /dev/null @@ -1,69 +0,0 @@ -package server - -import ( - "sync" - "time" - - "github.com/integration-system/isp-kit/log" - "github.com/integration-system/isp-lib/v2/config" - logrus "github.com/integration-system/isp-log" - "github.com/valyala/fasthttp" - "isp-gate-service/conf" - "isp-gate-service/handler" - "isp-gate-service/log_code" -) - -const defaultTimeout = 60 * time.Second - -var Http = &httpSrv{mx: sync.Mutex{}} - -type httpSrv struct { - working bool - srv *fasthttp.Server - mx sync.Mutex - logger log.Logger -} - -func (s *httpSrv) Init(isDifferentSetting bool, bodySize int64, logger log.Logger) { - s.logger = logger - if s.working { - if isDifferentSetting { - s.run(bodySize) - } - } else { - s.run(bodySize) - } -} - -func (s *httpSrv) run(maxRequestBodySize int64) { - s.mx.Lock() - s.working = true - if s.srv != nil { - if err := s.srv.Shutdown(); err != nil { - logrus.Warn(log_code.WarnHttpServerShutdown, err) - } - } - localConfig := config.Get().(*conf.Configuration) - restAddress := localConfig.HttpInnerAddress.GetAddress() - s.srv = &fasthttp.Server{ - Handler: handler.New(s.logger).CompleteRequest, - WriteTimeout: defaultTimeout, - ReadTimeout: defaultTimeout, - MaxRequestBodySize: int(maxRequestBodySize), - } - go func() { - if err := s.srv.ListenAndServe(restAddress); err != nil { - logrus.Error(log_code.ErrorHttpServerListen, err) - } - }() - s.mx.Unlock() -} - -func (s *httpSrv) Close() { - if s.srv != nil { - s.working = false - if err := s.srv.Shutdown(); err != nil { - logrus.Warn(log_code.WarnHttpServerShutdown, err) - } - } -} diff --git a/service/admin.go b/service/admin.go new file mode 100644 index 0000000..89d32a6 --- /dev/null +++ b/service/admin.go @@ -0,0 +1,54 @@ +package service + +import ( + "github.com/golang-jwt/jwt/v4" + "github.com/pkg/errors" +) + +type adminClaims struct { + *jwt.RegisteredClaims + Id int64 +} + +type Admin struct { + secret string +} + +func NewAdmin(secret string) Admin { + return Admin{ + secret: secret, + } +} + +func (s Admin) Authenticate(token string) (int, error) { + parsed, err := s.parseToken(token, &adminClaims{RegisteredClaims: &jwt.RegisteredClaims{}}) + if err != nil { + return 0, errors.WithMessage(err, "parse token") + } + + claims, ok := parsed.Claims.(*adminClaims) + if !ok { + return 0, errors.New("invalid token") + } + + return int(claims.Id), nil +} + +func (s Admin) parseToken(token 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(s.secret), nil + }) + if err != nil { + return nil, errors.WithMessage(err, "jwt parse with claims") + } + if !parsed.Valid { + return nil, errors.New("invalid token") + } + + return parsed, nil +} diff --git a/service/authentication.go b/service/authentication.go new file mode 100644 index 0000000..b217f63 --- /dev/null +++ b/service/authentication.go @@ -0,0 +1,55 @@ +package service + +import ( + "context" + + "github.com/pkg/errors" + "isp-gate-service/domain" +) + +type AuthenticationCache interface { + Get(ctx context.Context, token string) (*domain.AuthData, error) + Set(ctx context.Context, token string, data domain.AuthData) error +} + +type AuthenticationRepo interface { + Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error) +} + +type Auth struct { + cache AuthenticationCache + repo AuthenticationRepo +} + +func NewAuthentication(cache AuthenticationCache, repo AuthenticationRepo) Auth { + return Auth{ + cache: cache, + repo: repo, + } +} + +func (s Auth) Authenticate(ctx context.Context, token string) (*domain.AuthenticateResponse, error) { + authData, err := s.cache.Get(ctx, token) + if errors.Is(err, domain.ErrAuthenticationCacheMiss) { + resp, err := s.repo.Authenticate(ctx, token) + if err != nil { + return nil, errors.WithMessage(err, "auth repo authenticate") + } + if !resp.Authenticated { + return resp, nil + } + err = s.cache.Set(ctx, token, *resp.AuthData) + if err != nil { + return nil, errors.WithMessage(err, "auth cache set") + } + return resp, nil + } + if err != nil { + return nil, errors.WithMessage(err, "auth cache get") + } + return &domain.AuthenticateResponse{ + Authenticated: true, + ErrorReason: "", + AuthData: authData, + }, nil +} diff --git a/service/authorization.go b/service/authorization.go new file mode 100644 index 0000000..29b296f --- /dev/null +++ b/service/authorization.go @@ -0,0 +1,51 @@ +package service + +import ( + "context" + + "github.com/pkg/errors" +) + +type AuthorizationCache interface { + Get(ctx context.Context, applicationId int, endpoint string) (bool, error) + SetAuthorized(ctx context.Context, applicationId int, endpoint string) error +} + +type AuthorizationRepo interface { + Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) +} + +type Authorization struct { + cache AuthorizationCache + repo AuthorizationRepo +} + +func NewAuthorization(cache AuthorizationCache, repo AuthorizationRepo) Authorization { + return Authorization{ + cache: cache, + repo: repo, + } +} + +func (s Authorization) Authorize(ctx context.Context, applicationId int, endpoint string) (bool, error) { + ok, err := s.cache.Get(ctx, applicationId, endpoint) + if err != nil { + return false, errors.WithMessage(err, "authz cache get") + } + if ok { + return ok, nil + } + + ok, err = s.repo.Authorize(ctx, applicationId, endpoint) + if err != nil { + return false, errors.WithMessagef(err, "authz repo authorize") + } + if ok { + err = s.cache.SetAuthorized(ctx, applicationId, endpoint) + if err != nil { + return false, errors.WithMessagef(err, "authz cache set") + } + } + + return ok, nil +} diff --git a/service/daily_limit.go b/service/daily_limit.go new file mode 100644 index 0000000..e7f058b --- /dev/null +++ b/service/daily_limit.go @@ -0,0 +1,43 @@ +package service + +import ( + "context" + "time" + + "github.com/pkg/errors" + "isp-gate-service/conf" +) + +type DailyLimitRepo interface { + Increment(ctx context.Context, applicationId int, today time.Time) (int64, error) +} + +type DailyLimit struct { + repo DailyLimitRepo + limits map[int]int64 +} + +func NewDailyLimit(repo DailyLimitRepo, configs []conf.DailyLimit) DailyLimit { + limits := make(map[int]int64) + for _, config := range configs { + limits[config.ApplicationId] = config.RequestsPerDay + } + return DailyLimit{ + repo: repo, + limits: limits, + } +} + +func (s DailyLimit) IncrementAndCheck(ctx context.Context, applicationId int) (bool, error) { + max, ok := s.limits[applicationId] + if !ok { + return true, nil + } + + newValue, err := s.repo.Increment(ctx, applicationId, time.Now()) + if err != nil { + return false, errors.WithMessage(err, "increment") + } + + return newValue <= max, nil +} diff --git a/service/matcher/at_least_one_mather.go b/service/matcher/at_least_one_mather.go deleted file mode 100644 index e781b92..0000000 --- a/service/matcher/at_least_one_mather.go +++ /dev/null @@ -1,33 +0,0 @@ -package matcher - -import "sync" - -type atLeastOneMatcher struct { - cache map[string]bool - lock sync.RWMutex - rm runtimeMatcher -} - -func (mm *atLeastOneMatcher) Match(method string) bool { - if len(mm.rm.patterns) == 0 { - return false - } - - mm.lock.RLock() - matched, ok := mm.cache[method] - mm.lock.RUnlock() - if ok { - return matched - } - - mm.lock.Lock() - defer mm.lock.Unlock() - if matched, ok = mm.cache[method]; ok { - return matched - } else { - arrayPattern := mm.rm.Match(method) - matched = len(arrayPattern) > 0 - } - mm.cache[method] = matched - return matched -} diff --git a/service/matcher/cacheable_matcher.go b/service/matcher/cacheable_matcher.go deleted file mode 100644 index 7767938..0000000 --- a/service/matcher/cacheable_matcher.go +++ /dev/null @@ -1,32 +0,0 @@ -package matcher - -import "sync" - -type cacheableMatcher struct { - cache map[string][]string - lock sync.RWMutex - rm runtimeMatcher -} - -func (mm *cacheableMatcher) Match(method string) []string { - if len(mm.rm.patterns) == 0 { - return []string{} - } - - mm.lock.RLock() - arrayPattern, ok := mm.cache[method] - mm.lock.RUnlock() - if ok { - return arrayPattern - } - - mm.lock.Lock() - defer mm.lock.Unlock() - if arrayPattern, ok = mm.cache[method]; ok { - return arrayPattern - } else if arrayPattern = mm.rm.Match(method); len(arrayPattern) > 0 { - mm.cache[method] = arrayPattern - } - - return arrayPattern -} diff --git a/service/matcher/matcher.go b/service/matcher/matcher.go deleted file mode 100644 index dcedaf1..0000000 --- a/service/matcher/matcher.go +++ /dev/null @@ -1,31 +0,0 @@ -package matcher - -var JournalMethods AtLeastOneMatcher = &atLeastOneMatcher{} - -type Matcher interface { - Match(method string) []string -} - -type AtLeastOneMatcher interface { - Match(method string) bool -} - -func NewRuntimeMatcher(patterns []string) Matcher { - return &runtimeMatcher{ - patterns: patterns, - } -} - -func NewCacheableMatcher(patterns []string) Matcher { - return &cacheableMatcher{ - cache: make(map[string][]string), - rm: runtimeMatcher{patterns: patterns}, - } -} - -func NewAtLeastOneMatcher(patterns []string) AtLeastOneMatcher { - return &atLeastOneMatcher{ - cache: make(map[string]bool), - rm: runtimeMatcher{patterns: patterns}, - } -} diff --git a/service/matcher/matcher_test.go b/service/matcher/matcher_test.go deleted file mode 100644 index b4651c3..0000000 --- a/service/matcher/matcher_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package matcher - -import ( - "testing" -) - -var ( - patterns = []string{ - "mdm-master/group/method", - "mdm-master/group/*", - "mdm-master/group2/method", - "mdm-master/group3/*", - } - cases = []struct { - method string - coincidence int - atLeastOne bool - }{ - {method: "mdm-master/group/method", coincidence: 2, atLeastOne: true}, - {method: "mdm-master/group/method2", coincidence: 1, atLeastOne: true}, - {method: "mdm-master/group2/", coincidence: 0, atLeastOne: false}, - {method: "mdm-master/group2/method3", coincidence: 0, atLeastOne: false}, - {method: "mdm-master/group2/method", coincidence: 1, atLeastOne: true}, - {method: "mdm-master/group3/some", coincidence: 1, atLeastOne: true}, - {method: "mdm-master/group3/", coincidence: 1, atLeastOne: true}, - } -) - -func TestCacheableMatcher_Match(t *testing.T) { - matcher := NewCacheableMatcher(patterns) - for _, c := range cases { - res := matcher.Match(c.method) - if c.coincidence != len(res) { - t.Error(c) - } - } -} - -func TestAtLeastOneMatcher_Match(t *testing.T) { - matcher := NewAtLeastOneMatcher(patterns) - for _, c := range cases { - res := matcher.Match(c.method) - if c.atLeastOne != res { - t.Error(c) - } - } -} - -func BenchmarkCacheableMatcher_Match(b *testing.B) { - matcher := NewCacheableMatcher(patterns) - for i := 0; i < b.N; i++ { - for _, c := range cases { - _ = matcher.Match(c.method) - } - } -} - -func BenchmarkRuntimeMatcher_Match(b *testing.B) { - matcher := NewRuntimeMatcher(patterns) - for i := 0; i < b.N; i++ { - for _, c := range cases { - _ = matcher.Match(c.method) - } - } -} diff --git a/service/matcher/runtime_matcher.go b/service/matcher/runtime_matcher.go deleted file mode 100644 index 3189411..0000000 --- a/service/matcher/runtime_matcher.go +++ /dev/null @@ -1,24 +0,0 @@ -package matcher - -import ( - "strings" -) - -type runtimeMatcher struct { - patterns []string -} - -func (mm runtimeMatcher) Match(method string) []string { - resp := make([]string, 0) - for _, pattern := range mm.patterns { - patternLen := len(pattern) - if patternLen > 0 && pattern[patternLen-1] == '*' { - if strings.HasPrefix(method, pattern[:patternLen-1]) { - resp = append(resp, pattern) - } - } else if strings.EqualFold(method, pattern) { - resp = append(resp, pattern) - } - } - return resp -} diff --git a/service/metrics.go b/service/metrics.go deleted file mode 100644 index df7e1b9..0000000 --- a/service/metrics.go +++ /dev/null @@ -1,90 +0,0 @@ -package service - -import ( - "github.com/integration-system/isp-lib/v2/metric" - "github.com/rcrowley/go-metrics" - "sync" - "time" -) - -const ( - defaultSampleSize = 2048 -) - -var Metrics = &metricService{mh: nil} - -type ( - metricService struct { - mh *metricHolder - } - - metricHolder struct { - methodHistograms map[string]metrics.Histogram - methodLock sync.RWMutex - statusCounters map[string]metrics.Counter - statusLock sync.RWMutex - } -) - -func (m *metricService) Init() { - m.mh = &metricHolder{ - methodHistograms: make(map[string]metrics.Histogram), - statusCounters: make(map[string]metrics.Counter), - } -} - -func (m *metricService) UpdateMethodResponseTime(uri string, time time.Duration) { - if m.notEmptyHolder() { - m.getOrRegisterHistogram(uri).Update(int64(time)) - } -} - -func (m *metricService) UpdateStatusCounter(status string) { - if m.notEmptyHolder() { - m.getOrRegisterCounter(status).Inc(1) - } -} - -func (m *metricService) getOrRegisterHistogram(uri string) metrics.Histogram { - m.mh.methodLock.RLock() - histogram, ok := m.mh.methodHistograms[uri] - m.mh.methodLock.RUnlock() - if ok { - return histogram - } - - m.mh.methodLock.Lock() - defer m.mh.methodLock.Unlock() - if d, ok := m.mh.methodHistograms[uri]; ok { - return d - } - histogram = metrics.GetOrRegisterHistogram( - "http.response.time_"+uri, - metric.GetRegistry(), - metrics.NewUniformSample(defaultSampleSize), - ) - m.mh.methodHistograms[uri] = histogram - return histogram -} - -func (m *metricService) getOrRegisterCounter(status string) metrics.Counter { - m.mh.statusLock.RLock() - d, ok := m.mh.statusCounters[status] - m.mh.statusLock.RUnlock() - if ok { - return d - } - - m.mh.statusLock.Lock() - defer m.mh.statusLock.Unlock() - if d, ok := m.mh.statusCounters[status]; ok { - return d - } - d = metrics.GetOrRegisterCounter("http.response.count."+status, metric.GetRegistry()) - m.mh.statusCounters[status] = d - return d -} - -func (m *metricService) notEmptyHolder() bool { - return m.mh != nil -} diff --git a/service/throttling.go b/service/throttling.go new file mode 100644 index 0000000..6e586be --- /dev/null +++ b/service/throttling.go @@ -0,0 +1,47 @@ +package service + +import ( + "context" + + "github.com/pkg/errors" + "isp-gate-service/conf" + "isp-gate-service/domain" +) + +type ThrottlingRepo interface { + IsAllowRequestPerSecond(ctx context.Context, applicationId int, rate int) (*domain.RateLimitResult, error) +} + +type Throttling struct { + repo ThrottlingRepo + limits map[int]int +} + +func NewThrottling(repo ThrottlingRepo, configs []conf.Throttling) Throttling { + limits := make(map[int]int) + for _, config := range configs { + limits[config.ApplicationId] = config.RequestsPerSeconds + } + return Throttling{ + repo: repo, + limits: limits, + } +} + +func (s Throttling) AllowRateLimit(ctx context.Context, applicationId int) (*domain.RateLimitResult, error) { + rate, ok := s.limits[applicationId] + if !ok { + return &domain.RateLimitResult{ + Allow: true, + Remaining: -1, + RetryAfter: -1, + }, nil + } + + result, err := s.repo.IsAllowRequestPerSecond(ctx, applicationId, rate) + if err != nil { + return nil, errors.WithMessage(err, "is allow request per second") + } + + return result, nil +} diff --git a/service/veritification/cacheable_verify.go b/service/veritification/cacheable_verify.go deleted file mode 100644 index 0b5b1b2..0000000 --- a/service/veritification/cacheable_verify.go +++ /dev/null @@ -1,62 +0,0 @@ -package veritification - -import ( - "sync" - "time" -) - -const identitiesCount = 4 - -type ( - cacheablesVerify struct { - cache map[string]cacheInfo - timeout time.Duration - rv *runtimeVerify - lock sync.RWMutex - } - - cacheInfo struct { - created time.Time - identity map[string]string - } -) - -func (cv *cacheablesVerify) ApplicationToken(token string) (map[string]string, error) { - cv.lock.RLock() - cache, ok := cv.cache[token] - cv.lock.RUnlock() - if ok { - if time.Since(cache.created) < cv.timeout { - return cv.copyCache(cache.identity), nil - } - } - - cv.lock.Lock() - defer cv.lock.Unlock() - cache, ok = cv.cache[token] - if ok { - if time.Since(cache.created) < cv.timeout { - return cv.copyCache(cache.identity), nil - } - delete(cv.cache, token) - } - - identity, err := cv.rv.ApplicationToken(token) - if err != nil { - return nil, err - } - cv.cache[token] = cacheInfo{created: time.Now(), identity: identity} - return cv.copyCache(identity), nil -} - -func (cv *cacheablesVerify) Identity(identity map[string]string, uri string) (map[string]string, error) { - return cv.rv.Identity(identity, uri) -} - -func (cv *cacheablesVerify) copyCache(cache map[string]string) map[string]string { - resp := make(map[string]string, identitiesCount) - for key, value := range cache { - resp[key] = value - } - return resp -} diff --git a/service/veritification/error.go b/service/veritification/error.go deleted file mode 100644 index b5cc9d4..0000000 --- a/service/veritification/error.go +++ /dev/null @@ -1,9 +0,0 @@ -package veritification - -import "errors" - -var ( - ErrorInvalidUserId = errors.New("received unexpected user identity") - ErrorPermittedToCallApplication = errors.New("application has no rights to call this method") - ErrorPermittedToCallUser = errors.New("user has no rights to call this method") -) diff --git a/service/veritification/runtime_verify.go b/service/veritification/runtime_verify.go deleted file mode 100644 index badca14..0000000 --- a/service/veritification/runtime_verify.go +++ /dev/null @@ -1,168 +0,0 @@ -package veritification - -import ( - "context" - - rd "github.com/go-redis/redis/v8" - "github.com/integration-system/isp-lib/v2/config" - "github.com/integration-system/isp-lib/v2/redis" - "github.com/integration-system/isp-lib/v2/utils" - "github.com/pkg/errors" - "isp-gate-service/conf" - rdClient "isp-gate-service/redis" -) - -const ( - permittedToCallInfo = "0" - - appIdArrayKey = 1 - userTokenArrayKey = 3 - userIdArrayKey = 5 - deviceTokenArrayKey = 7 -) - -var ( - errNoRedisCmd = errors.New("no redis cmd") - errUnexpectedCmd = errors.New("expected StringCmd") - headerKeyByRedisIdentity = map[string]string{ - "1": utils.SystemIdHeader, - "2": utils.DomainIdHeader, - "3": utils.ServiceIdHeader, - "4": utils.ApplicationIdHeader, - } -) - -type runtimeVerify struct{} - -func (v *runtimeVerify) ApplicationToken(token string) (map[string]string, error) { - instanceUuid := config.Get().(*conf.Configuration).InstanceUuid - key := makeDbKey(token, instanceUuid) - - resp, err := rdClient.Client.UseDb(redis.ApplicationTokenDb, func(p rd.Pipeliner) error { - if cmd := p.HGetAll(context.Background(), key); v.isError(cmd.Err()) { - return cmd.Err() - } - return nil - }) - if err != nil { - return nil, err - } - - if len(resp) < 2 || resp[1].Err() == rd.Nil { - return nil, nil - } else if resp[1].Err() != nil { - return nil, err - } else if stringStringMapCmd, ok := resp[1].(*rd.StringStringMapCmd); !ok { - return nil, errUnexpectedCmd - } else { - vals := stringStringMapCmd.Val() - identityMap := make(map[string]string, len(vals)) - for i, value := range vals { - identityMap[headerKeyByRedisIdentity[i]] = value - } - return identityMap, nil - } -} - -func (v *runtimeVerify) Identity(t map[string]string, uri string) (map[string]string, error) { - secondDbKey := makeDbKey(t[utils.ApplicationIdHeader], uri) - thirdDbKey := makeDbKey(t[utils.UserTokenHeader], t[utils.DomainIdHeader]) - fourthDbKey := makeDbKey(t[utils.UserIdHeader], uri) - fifthDbKey := makeDbKey(t[utils.DeviceTokenHeader], t[utils.DomainIdHeader]) - - resp, err := rdClient.Client.Pipelined(context.Background(), func(p rd.Pipeliner) error { - if _, err := p.Select(context.Background(), int(redis.ApplicationPermissionDb)).Result(); v.isError(err) { - return err - } - if _, err := p.Get(context.Background(), secondDbKey).Result(); v.isError(err) { - return err - } - - if _, err := p.Select(context.Background(), int(redis.UserTokenDb)).Result(); v.isError(err) { - return err - } - if _, err := p.Get(context.Background(), thirdDbKey).Result(); v.isError(err) { - return err - } - - if _, err := p.Select(context.Background(), int(redis.UserPermissionDb)).Result(); v.isError(err) { - return err - } - if _, err := p.Get(context.Background(), fourthDbKey).Result(); v.isError(err) { - return err - } - - if _, err := p.Select(context.Background(), int(redis.DeviceTokenDb)).Result(); v.isError(err) { - return err - } - if _, err := p.Get(context.Background(), fifthDbKey).Result(); v.isError(err) { - return err - } - - return nil - }) - if v.isError(err) { - return t, err - } - // ===== NOT PERMITTED BY APPLICATION ID ===== - msg, err := v.findStringCmd(resp, appIdArrayKey) - if err != nil { - return t, err - } - if msg == permittedToCallInfo { - return t, ErrorPermittedToCallApplication - } - // ===== CHECK USER TOKEN ===== - msg, err = v.findStringCmd(resp, userTokenArrayKey) - if err != nil { - return t, err - } - userIdentity, found := t[utils.UserIdHeader] - if found && msg != userIdentity { - return t, ErrorInvalidUserId - } - // ===== NOT PERMITTED BY USER ID ===== - msg, err = v.findStringCmd(resp, userIdArrayKey) - if err != nil { - return t, err - } - if msg == permittedToCallInfo { - return t, ErrorPermittedToCallUser - } - // ===== CHECK DEVICE TOKEN ===== - msg, err = v.findStringCmd(resp, deviceTokenArrayKey) - if err != nil { - return t, err - } - t[utils.DeviceIdHeader] = msg - return t, nil -} - -func (v *runtimeVerify) isError(err error) bool { - return err != nil && err != rd.Nil -} - -func (v *runtimeVerify) findStringCmd(cmders []rd.Cmder, arrayKey int) (string, error) { - if len(cmders) <= arrayKey { - return "", errNoRedisCmd - } - - cmd := cmders[arrayKey] - if cmd == nil { - return "", errNoRedisCmd - } - - if v.isError(cmd.Err()) { - return "", cmd.Err() - } - - if stringCmd, ok := cmd.(*rd.StringCmd); !ok { - return "", errUnexpectedCmd - } else { - return stringCmd.Val(), nil - } -} - -func makeDbKey(key, val string) string { - return key + "|" + val -} diff --git a/service/veritification/verify.go b/service/veritification/verify.go deleted file mode 100644 index df99862..0000000 --- a/service/veritification/verify.go +++ /dev/null @@ -1,22 +0,0 @@ -package veritification - -import ( - "time" -) - -type Verify interface { - ApplicationToken(string) (map[string]string, error) - Identity(map[string]string, string) (map[string]string, error) -} - -func NewRuntimeVerify() Verify { - return &runtimeVerify{} -} - -func NewCacheablesVerify(timeout time.Duration) Verify { - return &cacheablesVerify{ - cache: make(map[string]cacheInfo), - timeout: timeout, - rv: &runtimeVerify{}, - } -} diff --git a/tests/acceptance_test.go b/tests/acceptance_test.go new file mode 100644 index 0000000..fe781bf --- /dev/null +++ b/tests/acceptance_test.go @@ -0,0 +1,185 @@ +package tests + +import ( + "context" + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" + + "github.com/go-redis/redis/v8" + "github.com/go-resty/resty/v2" + "github.com/google/uuid" + "github.com/integration-system/isp-kit/grpc" + "github.com/integration-system/isp-kit/grpc/client" + "github.com/integration-system/isp-kit/lb" + "github.com/integration-system/isp-kit/log" + "github.com/integration-system/isp-kit/requestid" + "github.com/integration-system/isp-kit/test" + "github.com/integration-system/isp-kit/test/grpct" + "github.com/integration-system/isp-kit/test/httpt" + "github.com/stretchr/testify/suite" + "isp-gate-service/assembly" + "isp-gate-service/conf" + "isp-gate-service/domain" + "isp-gate-service/routes" +) + +type request struct { + Id string +} + +type response struct { + Id string +} + +type HappyPathTestSuite struct { + suite.Suite +} + +func (s *HappyPathTestSuite) TestGrpcProxy() { + test, require := test.New(s.T()) + config, redisCli, systemCli := s.commonDependencies(test) + + requestId := requestid.Next() + targetService, targetCli := grpct.NewMock(test) + targetService.Mock("endpoint", func(ctx context.Context, authData grpc.AuthData, req request) response { + systemId, err := authData.SystemId() + require.NoError(err) + domainId, err := authData.DomainId() + require.NoError(err) + serviceId, err := authData.ServiceId() + require.NoError(err) + applicationId, err := authData.ApplicationId() + require.NoError(err) + require.EqualValues(requestId, requestid.FromContext(ctx)) + require.EqualValues(1, systemId) + require.EqualValues(2, domainId) + require.EqualValues(3, serviceId) + require.EqualValues(4, applicationId) + return response{Id: req.Id} //nolint:gosimple + }) + targetClients := map[string]*client.Client{"target": targetCli} + logger, err := log.New(log.WithLevel(log.DebugLevel)) + require.NoError(err) + locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli) + locations := []conf.Location{{ + SkipAuth: false, + PathPrefix: "/api", + Protocol: "grpc", + TargetModule: "target", + }} + handler, err := locator.Handler(config, locations, redisCli) + require.NoError(err) + + srv := httptest.NewServer(handler) + cli := resty.NewWithClient(srv.Client()).SetBaseURL(srv.URL) + req := request{Id: uuid.New().String()} + resp := response{} + _, err = cli.R(). + SetHeader("x-application-token", "token"). + SetHeader("x-request-id", requestId). + SetBody(req). + SetResult(&resp). + Post("/api/endpoint") + require.NoError(err) + require.EqualValues(req.Id, resp.Id) +} + +func (s *HappyPathTestSuite) TestHttpProxy() { + test, require := test.New(s.T()) + config, redisCli, systemCli := s.commonDependencies(test) + + requestId := requestid.Next() + targetService := httpt.NewMock(test) + targetService.POST("/endpoint", func(ctx context.Context, httpReq *http.Request, req request) response { + systemId, err := strconv.Atoi(httpReq.Header.Get("x-system-identity")) + require.NoError(err) + domainId, err := strconv.Atoi(httpReq.Header.Get("x-domain-identity")) + require.NoError(err) + serviceId, err := strconv.Atoi(httpReq.Header.Get("x-service-identity")) + require.NoError(err) + applicationId, err := strconv.Atoi(httpReq.Header.Get("x-application-identity")) + require.NoError(err) + require.EqualValues(requestId, requestid.FromContext(ctx)) + require.EqualValues(1, systemId) + require.EqualValues(2, domainId) + require.EqualValues(3, serviceId) + require.EqualValues(4, applicationId) + return response{Id: req.Id} //nolint:gosimple + }) + targetUrl, err := url.Parse(targetService.BaseURL()) + require.NoError(err) + rr := lb.NewRoundRobin([]string{targetUrl.Host}) + targetClients := map[string]*lb.RoundRobin{"target": rr} + locator := assembly.NewLocator(test.Logger(), nil, targetClients, routes.NewRoutes(), systemCli) + locations := []conf.Location{{ + SkipAuth: false, + PathPrefix: "/api", + Protocol: "http", + TargetModule: "target", + }} + handler, err := locator.Handler(config, locations, redisCli) + require.NoError(err) + + srv := httptest.NewServer(handler) + cli := resty.NewWithClient(srv.Client()).SetBaseURL(srv.URL) + req := request{Id: uuid.New().String()} + resp := response{} + _, err = cli.R(). + SetHeader("x-application-token", "token"). + SetHeader("x-request-id", requestId). + SetBody(req). + SetResult(&resp). + Post("/api/endpoint") + require.NoError(err) + require.EqualValues(req.Id, resp.Id) +} + +func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, redis.UniversalClient, *client.Client) { + require := test.Assert() + redisCli := NewRedis(test) + ctx := context.Background() + s.T().Cleanup(func() { + _, err := redisCli.Pipelined(ctx, func(p redis.Pipeliner) error { + p.Select(ctx, 0) + p.FlushDB(ctx) + p.Select(ctx, 1) + p.FlushDB(ctx) + p.Select(ctx, 2) + p.FlushDB(ctx) + return nil + }) + require.NoError(err) + }) + config := conf.Remote{ + Redis: &conf.Redis{Address: redisCli.address}, + Secrets: conf.Secrets{AdminTokenSecret: "secret"}, + Http: conf.Http{MaxRequestBodySizeInMb: 1, ProxyTimeoutInSec: 15}, + Logging: conf.Logging{LogLevel: log.DebugLevel, RequestLogEnable: true, BodyLogEnable: true}, + Caching: conf.Caching{AuthorizationDataInSec: 1, AuthenticationDataInSec: 1}, + DailyLimits: []conf.DailyLimit{{ApplicationId: 1, RequestsPerDay: 100}}, + Throttling: []conf.Throttling{{ApplicationId: 1, RequestsPerSeconds: 100}}, + } + systemService, systemCli := grpct.NewMock(test) + systemService.Mock("system/secure/authenticate", func() domain.AuthenticateResponse { + return domain.AuthenticateResponse{ + Authenticated: true, + ErrorReason: "", + AuthData: &domain.AuthData{ + SystemId: 1, + DomainId: 2, + ServiceId: 3, + ApplicationId: 4, + }, + } + }).Mock("system/secure/authorize", func() domain.AuthorizeResponse { + return domain.AuthorizeResponse{Authorized: true} + }) + return config, redisCli, systemCli +} + +func TestHappyPathTestSuite(t *testing.T) { + suite.Run(t, new(HappyPathTestSuite)) +} diff --git a/tests/bench/bench.go b/tests/bench/bench.go new file mode 100644 index 0000000..68063ab --- /dev/null +++ b/tests/bench/bench.go @@ -0,0 +1,131 @@ +package main + +import ( + "context" + "net" + "net/http" + + "github.com/go-redis/redis/v8" + "github.com/integration-system/isp-kit/grpc" + "github.com/integration-system/isp-kit/grpc/client" + endpoint2 "github.com/integration-system/isp-kit/grpc/endpoint" + "github.com/integration-system/isp-kit/grpc/isp" + "github.com/integration-system/isp-kit/log" + "isp-gate-service/assembly" + "isp-gate-service/conf" + "isp-gate-service/domain" + "isp-gate-service/routes" +) + +type request struct { + Id string +} + +type response struct { + Id string +} + +//nolint +func main() { + redisCli := redis.NewClient(&redis.Options{}) + ctx := context.Background() + logger, err := log.New() + if err != nil { + panic(err) + } + defer func() { + _, _ = redisCli.Pipelined(ctx, func(p redis.Pipeliner) error { + p.Select(ctx, 0) + p.FlushDB(ctx) + p.Select(ctx, 1) + p.FlushDB(ctx) + p.Select(ctx, 2) + p.FlushDB(ctx) + return nil + }) + }() + config := conf.Remote{ + Redis: &conf.Redis{Address: "localhost:6379"}, + Secrets: conf.Secrets{AdminTokenSecret: "secret"}, + Http: conf.Http{MaxRequestBodySizeInMb: 1, ProxyTimeoutInSec: 15}, + Logging: conf.Logging{LogLevel: log.DebugLevel, RequestLogEnable: true, BodyLogEnable: true}, + Caching: conf.Caching{AuthorizationDataInSec: 15, AuthenticationDataInSec: 15}, + DailyLimits: []conf.DailyLimit{{ApplicationId: 1, RequestsPerDay: 100000000}}, + Throttling: []conf.Throttling{{ApplicationId: 1, RequestsPerSeconds: 5000}}, + } + systemService, systemCli := NewMock(logger) + systemService.Mock("system/secure/authenticate", func() domain.AuthenticateResponse { + return domain.AuthenticateResponse{ + Authenticated: true, + ErrorReason: "", + AuthData: &domain.AuthData{ + SystemId: 1, + DomainId: 1, + ServiceId: 1, + ApplicationId: 1, + }, + } + }).Mock("system/secure/authorize", func() domain.AuthorizeResponse { + return domain.AuthorizeResponse{Authorized: true} + }) + + targetService, targetCli := NewMock(logger) + targetService.Mock("endpoint", func(req request) response { + return response{Id: req.Id} + }) + targetClients := map[string]*client.Client{"target": targetCli} + logger, _ = log.New(log.WithLevel(log.DebugLevel)) + locator := assembly.NewLocator(logger, targetClients, nil, routes.NewRoutes(), systemCli) + locations := []conf.Location{{ + SkipAuth: false, + PathPrefix: "/api", + Protocol: "grpc", + TargetModule: "target", + }} + handler, _ := locator.Handler(config, locations, redisCli) + + srv := &http.Server{ + Addr: "localhost:8000", + Handler: handler, + } + srv.ListenAndServe() +} + +func TestServer(service isp.BackendServiceServer) (*grpc.Server, *client.Client) { + listener, _ := net.Listen("tcp", "127.0.0.1:") + srv := grpc.NewServer() + cli, _ := client.Default() + srv.Upgrade(service) + go func() { + _ = srv.Serve(listener) + }() + + cli.Upgrade([]string{listener.Addr().String()}) + return srv, cli +} + +type MockServer struct { + srv *grpc.Server + logger log.Logger + mockEndpoints map[string]interface{} +} + +func NewMock(logger log.Logger) (*MockServer, *client.Client) { + srv, cli := TestServer(grpc.NewMux()) + return &MockServer{ + srv: srv, + logger: logger, + mockEndpoints: make(map[string]interface{}), + }, cli +} + +func (m *MockServer) Mock(endpoint string, handler interface{}) *MockServer { + m.mockEndpoints[endpoint] = handler + wrapper := endpoint2.DefaultWrapper(m.logger) + muxer := grpc.NewMux() + for e, handler := range m.mockEndpoints { + muxer.Handle(e, wrapper.Endpoint(handler)) + } + m.srv.Upgrade(muxer) + return m +} diff --git a/tests/bench/body.json b/tests/bench/body.json new file mode 100644 index 0000000..fe45c5c --- /dev/null +++ b/tests/bench/body.json @@ -0,0 +1,3 @@ +{ + "id": "GO4IIZW5uav4cSo2zyR6i41LdalKytNH628yDhC92jXQF07gu4LS75JuzQgc6d3Dly48fwla9iHK6LPTJcvFbOcklXp7Zr9g3b180s0H3dVgaYGcO8BrAFxMVb2KcHyu" +} diff --git a/tests/bench/run.sh b/tests/bench/run.sh new file mode 100644 index 0000000..baec1f7 --- /dev/null +++ b/tests/bench/run.sh @@ -0,0 +1,2 @@ +bombardier -c 128 -t 1s -d 60s --fasthttp -H "x-application-token: token" -m POST -f body.json http://localhost:8000/api/endpoint + diff --git a/tests/redis.go b/tests/redis.go new file mode 100644 index 0000000..3c71b14 --- /dev/null +++ b/tests/redis.go @@ -0,0 +1,25 @@ +package tests + +import ( + "fmt" + + "github.com/go-redis/redis/v8" + "github.com/integration-system/isp-kit/test" +) + +type Redis struct { + address string + redis.UniversalClient +} + +func NewRedis(test *test.Test) Redis { + redisHost := test.Config().Optional().String("REDIS_HOST", "localhost") + redisPort := test.Config().Optional().String("REDIS_PORT", "6379") + addr := fmt.Sprintf("%s:%s", redisHost, redisPort) + cli := redis.NewClient(&redis.Options{Addr: addr}) + return Redis{UniversalClient: cli, address: addr} +} + +func (r Redis) Address() string { + return r.address +} diff --git a/utils/utils.go b/utils/utils.go deleted file mode 100644 index 43066e7..0000000 --- a/utils/utils.go +++ /dev/null @@ -1,29 +0,0 @@ -package utils - -import ( - "encoding/json" - "github.com/integration-system/isp-lib/v2/http" - "github.com/integration-system/isp-lib/v2/structure" - "github.com/valyala/fasthttp" - "google.golang.org/grpc/codes" -) - -var ( - JsonContentType = []byte("application/json; charset=utf-8") -) - -func WriteError(ctx *fasthttp.RequestCtx, message string, code codes.Code, details []interface{}) { - grpcCode := code.String() - - structureError := structure.GrpcError{ - ErrorMessage: message, - ErrorCode: grpcCode, - Details: details, - } - - ctx.SetContentTypeBytes(JsonContentType) - ctx.SetStatusCode(http.CodeToHttpStatus(code)) - msg, _ := json.Marshal(structureError) - ctx.Response.Header.SetContentLength(len(msg)) - _, _ = ctx.Write(msg) -}