NFSSVC-16 Sign health-check requests

This commit is contained in:
Evgeniy Kulikov 2020-07-02 11:34:54 +03:00
parent 6b3344bd41
commit bbb2a057c7
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
2 changed files with 22 additions and 59 deletions

25
app.go
View file

@ -7,14 +7,10 @@ import (
"time"
"github.com/fasthttp/router"
"google.golang.org/grpc/grpclog"
"github.com/nspcc-dev/neofs-api-go/service"
"github.com/nspcc-dev/neofs-api-go/state"
"github.com/spf13/viper"
"github.com/valyala/fasthttp"
"go.uber.org/zap"
"google.golang.org/grpc/grpclog"
)
type (
@ -34,9 +30,6 @@ type (
nodes []string
reqHealth *state.HealthRequest
reqNetmap *state.NetmapRequest
conTimeout time.Duration
reqTimeout time.Duration
}
@ -105,21 +98,7 @@ func newApp(opt ...Option) App {
a.web.NoDefaultContentType = true
// -- -- -- -- -- -- -- -- -- --
a.reqHealth = new(state.HealthRequest)
a.reqHealth.SetTTL(service.NonForwardingTTL)
if err := service.SignDataWithSessionToken(a.key, a.reqHealth); err != nil {
a.log.Fatal("could not sign `HealthRequest`", zap.Error(err))
}
a.reqNetmap = new(state.NetmapRequest)
a.reqNetmap.SetTTL(service.SingleForwardingTTL)
if err := service.SignDataWithSessionToken(a.key, a.reqNetmap); err != nil {
a.log.Fatal("could not sign `NetmapRequest`", zap.Error(err))
}
a.pool = newPool(a.log, a.cfg)
a.pool = newPool(a.log, a.cfg, a.key)
return a
}