Documentation
¶
Overview ¶
Package winrm is komando's own WinRM client: it runs one command on a Windows server through WS-Management (the Windows Remote Shell protocol, MS-WSMV), over HTTPS or HTTP, with NTLM or Basic login. It is what Ansible's winrm connection speaks. It only runs commands: WinRM has no file transfer or tunnels (komando sends files through the command's input and output, see docs/design/windows.md).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAuth = errors.New("the WinRM server refused the login (HTTP 401): check the user and password, and that the server allows this login method")
ErrAuth is a refused login (HTTP 401).
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client runs commands on one server. It is safe for one command at a time.
func (*Client) Run ¶
func (c *Client) Run(ctx context.Context, command string, stdin io.Reader, stdout, stderr io.Writer) (int, error)
Run runs command (as cmd.exe would read it) with stdin as its input and copies its output to stdout and stderr. It returns the exit code. When ctx ends, the command is stopped and the shell is closed.
type Config ¶
type Config struct {
// Endpoint is the server's WS-Management URL, e.g.
// https://10.0.0.9:5986/wsman.
Endpoint string
User, Password string
// Basic logs in with HTTP Basic (local accounts only, and only
// over HTTPS); otherwise NTLM, which never sends the password.
Basic bool
// TLS checks the server's certificate for an https Endpoint.
TLS *tls.Config
// Dial opens the TCP connection: directly, through a VPN or through
// an SSH bastion. nil: net.Dialer.
Dial func(ctx context.Context, network, addr string) (net.Conn, error)
// OperationTimeout is how long the server waits for output before
// it answers a Receive with nothing (komando then asks again).
OperationTimeout time.Duration
}
Config says where the server is and how to log in.