@@ -15,6 +15,7 @@ import (
15
15
"net/http/httputil"
16
16
17
17
"strings"
18
+ "time"
18
19
19
20
"github.com/stmcginnis/gofish/common"
20
21
"github.com/stmcginnis/gofish/redfish"
@@ -56,6 +57,9 @@ type ClientConfig struct {
56
57
// Insecure controls whether to enforce SSL certificate validity.
57
58
Insecure bool
58
59
60
+ // Controls TLS handshake timeout
61
+ TLSHandshakeTimeout int
62
+
59
63
// HTTPClient is the optional client to connect with.
60
64
HTTPClient * http.Client
61
65
@@ -76,6 +80,10 @@ func Connect(config ClientConfig) (c *APIClient, err error) {
76
80
dumpWriter : config .DumpWriter ,
77
81
}
78
82
83
+ if config .TLSHandshakeTimeout == 0 {
84
+ config .TLSHandshakeTimeout = 10
85
+ }
86
+
79
87
if config .HTTPClient == nil {
80
88
defaultTransport := http .DefaultTransport .(* http.Transport )
81
89
transport := & http.Transport {
@@ -84,7 +92,7 @@ func Connect(config ClientConfig) (c *APIClient, err error) {
84
92
MaxIdleConns : defaultTransport .MaxIdleConns ,
85
93
IdleConnTimeout : defaultTransport .IdleConnTimeout ,
86
94
ExpectContinueTimeout : defaultTransport .ExpectContinueTimeout ,
87
- TLSHandshakeTimeout : defaultTransport . TLSHandshakeTimeout ,
95
+ TLSHandshakeTimeout : time . Duration ( config . TLSHandshakeTimeout ) * time . Second ,
88
96
TLSClientConfig : & tls.Config {
89
97
InsecureSkipVerify : config .Insecure ,
90
98
},
0 commit comments