Skip to content

Commit

Permalink
use withblock instead of custom dialer
Browse files Browse the repository at this point in the history
Signed-off-by: denis-tingaikin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin committed Nov 2, 2021
1 parent eede06b commit b3d22f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ type Config struct {
RegistryURL url.URL `default:"tcp://localhost:5001" desc:"A NSE registry url to use" split_words:"true"`
MaxTokenLifetime time.Duration `default:"10m" desc:"maximum lifetime of tokens" split_words:"true"`
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
DialTimeout time.Duration `default:"1s" desc:"Timeout for the dial the next endpoint" split_words:"true"`
DialTimeout time.Duration `default:"10ms" desc:"Timeout for the dial the next endpoint" split_words:"true"`
}
5 changes: 1 addition & 4 deletions internal/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ func RunNsmgr(ctx context.Context, configuration *config.Config) error {
credentials.NewTLS(tlsconfig.MTLSClientConfig(m.source, m.source, tlsconfig.AuthorizeAny())),
),
),
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
network, addr := grpcutils.TargetToNetAddr(s)
return (&net.Dialer{Timeout: configuration.DialTimeout}).DialContext(ctx, network, addr)
}),
grpc.WithBlock(),
grpc.WithDefaultCallOptions(
grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(m.source, configuration.MaxTokenLifetime))),
),
Expand Down

0 comments on commit b3d22f6

Please sign in to comment.