From 4558f305754a230fb81d79f6e72eed56f024f06d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 30 Jul 2022 10:24:16 +0300 Subject: [PATCH] [#1644] services/tree: Do not use deprecated gRPC options Get rid of `grpc.WithInsecure`. Signed-off-by: Evgenii Stratonikov --- pkg/services/tree/cache.go | 3 ++- pkg/services/tree/sync.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/services/tree/cache.go b/pkg/services/tree/cache.go index 54a1f9f9f..e5d940aea 100644 --- a/pkg/services/tree/cache.go +++ b/pkg/services/tree/cache.go @@ -11,6 +11,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/network" "google.golang.org/grpc" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" ) type clientCache struct { @@ -85,7 +86,7 @@ func dialTreeService(ctx context.Context, netmapAddr string) (*grpc.ClientConn, // FIXME(@fyrchik): ugly hack #1322 if !strings.HasPrefix(netAddr.URIAddr(), "grpcs:") { - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } ctx, cancel := context.WithTimeout(ctx, defaultClientConnectTimeout) diff --git a/pkg/services/tree/sync.go b/pkg/services/tree/sync.go index e9a7d1899..c05c2b1f4 100644 --- a/pkg/services/tree/sync.go +++ b/pkg/services/tree/sync.go @@ -11,6 +11,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/network" cid "github.com/nspcc-dev/neofs-sdk-go/container/id" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) // Synchronize tries to synchronize log starting from the last stored height. @@ -33,7 +34,7 @@ func (s *Service) Synchronize(ctx context.Context, cid cid.ID, treeID string) er return false } - cc, err := grpc.DialContext(ctx, a.URIAddr(), grpc.WithInsecure()) + cc, err := grpc.DialContext(ctx, a.URIAddr(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { // Failed to connect, try the next address. return false