Documentation
¶
Overview ¶
Package protocol contains the interfaces for the protocol implementations
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrValidationFailed is returned when a connection config fails validation. ErrValidationFailed = errors.New("validation failed") // ErrNonRetryable is returned when retrying an operation will not result in a // different outcome. ErrNonRetryable = errors.New("operation cannot be completed") )
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface {
fmt.Stringer
// Protocol returns the protocol family, such as "SSH", "WinRM", or "Local".
// Both the native SSH and OpenSSH implementations return "SSH".
// Custom or test implementations may return other values.
Protocol() string
// ProtocolName returns the specific implementation name, such as "SSH",
// "OpenSSH", "WinRM", or "Local". Use this for logging or diagnostics
// where the distinction between native SSH and OpenSSH matters. Custom
// or test implementations may return other values.
ProtocolName() string
// IsConnected returns true if the connection is currently active.
// Built-in implementations attempt an active liveness probe where
// possible (e.g. SSH keepalive, ssh -O check for OpenSSH multiplexing,
// or a no-op command for WinRM), but some implementations may skip the
// probe or always return true (e.g. Localhost). Callers should be aware
// this may block up to a timeout (typically 10s) and may cause
// side-effects on the remote.
IsConnected() bool
IPAddress() string
ProcessStarter
WindowsChecker
}
Connection is the minimum interface for protocol implementations.
type Disconnector ¶
type Disconnector interface {
Disconnect()
}
Disconnector is a connection that can be closed.
type InteractiveExecer ¶
type InteractiveExecer interface {
ExecInteractive(ctx context.Context, cmd string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error
}
InteractiveExecer is a connection that can start an interactive session.
All implementations guarantee:
- stdin, stdout, and stderr are forwarded to the remote process.
- context cancellation terminates the remote session.
- an empty cmd falls back to a protocol-appropriate default shell.
PTY allocation, terminal sizing, signal forwarding, and raw-mode behaviour are protocol- and OS-specific. See docs/pty-tty-semantics.md for the full per-protocol audit and gap list.
type ProcessStarter ¶
type ProcessStarter interface {
StartProcess(ctx context.Context, cmd string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (Waiter, error)
}
ProcessStarter can start processes.
type Waiter ¶
type Waiter interface {
Wait() error
}
Waiter is a process that can be waited to finish.
type WindowsChecker ¶
type WindowsChecker interface {
IsWindows() bool
}
WindowsChecker is a type that can check if the underlying system is Windows.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package localhost provides a rig protocol implementation to the local host using the os/exec package.
|
Package localhost provides a rig protocol implementation to the local host using the os/exec package. |
|
Package openssh provides a rig protocol implementation that uses the system's openssh client "ssh" to connect to remote hosts.
|
Package openssh provides a rig protocol implementation that uses the system's openssh client "ssh" to connect to remote hosts. |
|
Package ssh provides a rig protocol implementation for SSH connections.
|
Package ssh provides a rig protocol implementation for SSH connections. |
|
agent
Package agent provides a client implementation for the SSH agent.
|
Package agent provides a client implementation for the SSH agent. |
|
hostkey
Package hostkey implements a callback for the ssh.ClientConfig.HostKeyCallback
|
Package hostkey implements a callback for the ssh.ClientConfig.HostKeyCallback |
|
Package winrm provides a rig protocol implementation for WinRM connections
|
Package winrm provides a rig protocol implementation for WinRM connections |
Click to show internal directories.
Click to hide internal directories.