/usr/share/gocode/src/github.com/masterzen/winrm/endpoint.go is in golang-github-masterzen-winrm-dev 0.0~git20170601.0.1ca0ba6-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | package winrm
import (
"fmt"
"time"
)
// Endpoint struct holds configurations
// for the server endpoint
type Endpoint struct {
// host name or ip address
Host string
// port to determine if it's http or https default
// winrm ports (http:5985, https:5986).Versions
// of winrm can be customized to listen on other ports
Port int
// set the flag true for https connections
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
Cert []byte // cert for client auth connections
// duration timeout for the underling tcp conn(http/https base protocol)
// if the time exceeds the connection is cloded/timeouts
Timeout time.Duration
}
func (ep *Endpoint) url() string {
var scheme string
if ep.HTTPS {
scheme = "https"
} else {
scheme = "http"
}
return fmt.Sprintf("%s://%s:%d/wsman", scheme, ep.Host, ep.Port)
}
// NewEndpoint returns new pointer to struct Endpoint, with a default 60s response header timeout
func NewEndpoint(host string, port int, https bool, insecure bool, Cacert, cert, key []byte, timeout time.Duration) *Endpoint {
endpoint := &Endpoint{
Host: host,
Port: port,
HTTPS: https,
Insecure: insecure,
CACert: Cacert,
Key: key,
Cert: cert,
}
// if the timeout was set
if timeout != 0 {
endpoint.Timeout = timeout
} else {
// assign default 60sec timeout
endpoint.Timeout = 60 * time.Second
}
return endpoint
}
|