From 5a4f8cb0dd44fea78dee41d27e3b717a23c72f51 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Fri, 16 Apr 2021 10:41:24 +0200 Subject: [PATCH] added WithDialTimeout --- pkg/netrasp/netrasp.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/netrasp/netrasp.go b/pkg/netrasp/netrasp.go index 1d8b778..8ca6b35 100644 --- a/pkg/netrasp/netrasp.go +++ b/pkg/netrasp/netrasp.go @@ -7,6 +7,7 @@ package netrasp import ( "errors" "fmt" + "time" "golang.org/x/crypto/ssh" ) @@ -135,3 +136,10 @@ func WithSSHKeyExchange(name string) ConfigOpt { c.SSHConfig.KeyExchanges = append(c.SSHConfig.KeyExchanges, name) }) } + +// WithDialTimeout allows you to configure timeout for dialing SSH server +func WithDialTimeout(t time.Duration) ConfigOpt { + return newFuncConfigOpt(func(c *config) { + c.SSHConfig.Timeout = t + }) +}