Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Dial returns an Connection to a given address (host:port pair) with // a timeout for connection. Dial(ctx context.Context, address string, connectTimeout time.Duration) (Connection, error) }
Client defines a simple interface to an abstract SSH client. Usually this would be DirectClient, but tests can use this interface to dependency-inject fake SSH connections.
type Connection ¶
type Connection interface { // Execute a given command on a remote host synchronously, passing in stdin as // input, and returning a captured stdout/stderr. The returned data might be // valid even when err != nil, which might happen if the remote side returned a // non-zero exit code. Execute(ctx context.Context, command string, stdin []byte) (stdout []byte, stderr []byte, err error) // Upload a given blob to a targetPath on the system and make executable. Upload(ctx context.Context, targetPath string, src io.Reader) error // Close this connection. Close() error }
type DirectClient ¶
type DirectClient struct { AuthMethod ssh.AuthMethod Username string }
DirectClient implements Client (and Connection) using golang.org/x/crypto/ssh.
func (*DirectClient) Dial ¶
func (p *DirectClient) Dial(ctx context.Context, address string, connectTimeout time.Duration) (Connection, error)
Click to show internal directories.
Click to hide internal directories.