From 93f77d4211cd3a1ca618b82aa220ac169f82d31d Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Sun, 31 Oct 2021 21:52:58 +0700 Subject: [PATCH] add net.Dialer with dialTimeout for nsmgr Signed-off-by: Denis Tingaikin --- internal/manager/manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/manager/manager.go b/internal/manager/manager.go index a8fced3b..c79a2699 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -116,6 +116,10 @@ func RunNsmgr(ctx context.Context, configuration *config.Config) error { credentials.NewTLS(tlsconfig.MTLSClientConfig(m.source, m.source, tlsconfig.AuthorizeAny())), ), ), + grpc.WithDialer(func(s string, _ time.Duration) (net.Conn, error) { + network, addr := grpcutils.TargetToNetAddr(s) + return (&net.Dialer{Timeout: configuration.DialTimeout}).DialContext(ctx, network, addr) + }), grpc.WithDefaultCallOptions( grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(m.source, configuration.MaxTokenLifetime))), ),