Udpated winrmcp dep

This commit is contained in:
Chris Bednarski 2016-03-10 15:05:34 -08:00
parent 2970038204
commit ab36418729
1 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"net/http"
"os" "os"
"path/filepath" "path/filepath"
"time" "time"
@ -24,6 +25,7 @@ type Config struct {
CACertBytes []byte CACertBytes []byte
OperationTimeout time.Duration OperationTimeout time.Duration
MaxOperationsPerShell int MaxOperationsPerShell int
TransportDecorator func(*http.Transport) http.RoundTripper
} }
type Auth struct { type Auth struct {
@ -41,6 +43,10 @@ func New(addr string, config *Config) (*Winrmcp, error) {
} }
params := winrm.DefaultParameters() params := winrm.DefaultParameters()
if config.TransportDecorator != nil {
params.TransportDecorator = config.TransportDecorator
}
if config.OperationTimeout.Seconds() > 0 { if config.OperationTimeout.Seconds() > 0 {
params.Timeout = iso8601.FormatDuration(config.OperationTimeout) params.Timeout = iso8601.FormatDuration(config.OperationTimeout)
} }