mirror of
https://github.com/hashicorp/packer.git
synced 2026-10-13 01:32:02 -04:00
update winrm to use keepalives
This commit is contained in:
+7
@@ -3,7 +3,9 @@ package winrm
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/masterzen/azure-sdk-for-go/core/http"
|
||||
"github.com/masterzen/azure-sdk-for-go/core/tls"
|
||||
@@ -22,10 +24,15 @@ func (c *ClientAuthRequest) Transport(endpoint *Endpoint) error {
|
||||
}
|
||||
|
||||
transport := &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: endpoint.Insecure,
|
||||
Certificates: []tls.Certificate{cert},
|
||||
},
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
ResponseHeaderTimeout: endpoint.Timeout,
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -18,6 +18,8 @@ type Endpoint struct {
|
||||
HTTPS bool
|
||||
// set the flag true for skipping ssl verifications
|
||||
Insecure bool
|
||||
// if set, used to verify the hostname on the returned certificate
|
||||
TLSServerName string
|
||||
// pointer pem certs, and key
|
||||
CACert []byte // cert auth to intdetify the server cert
|
||||
Key []byte // public key for client auth connections
|
||||
|
||||
+7
@@ -4,8 +4,10 @@ import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/masterzen/winrm/soap"
|
||||
)
|
||||
@@ -44,7 +46,12 @@ func (c *clientRequest) Transport(endpoint *Endpoint) error {
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: endpoint.Insecure,
|
||||
ServerName: endpoint.TLSServerName,
|
||||
},
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
ResponseHeaderTimeout: endpoint.Timeout,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user