Documentation ¶
Overview ¶
Package ssh implements various SSH commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Logger *zap.Logger KeyPath string PublicIP string PublicDNSName string // UserName is the user name to use for log-in. // "ec2-user" for Amazon Linux 2 // "ubuntu" for ubuntu UserName string Envs map[string]string }
Config defines SSH configuration.
type Op ¶
type Op struct {
// contains filtered or unexported fields
}
Op represents a SSH operation.
type OpOption ¶
type OpOption func(*Op)
OpOption configures archiver operations.
func WithEnv ¶
WithEnv adds an environment variable that will be applied to any command executed by Shell or Run. It overwrites the ones set by "*ssh.Session.Setenv".
func WithRetry ¶
WithRetry automatically retries the command on closed TCP connection error. (e.g. retry immutable operation). WithRetry(-1) to retry forever until success.
func WithTimeout ¶
WithTimeout configures timeout for command run.
func WithVerbose ¶
WithVerbose configures verbose level in SSH operations.
type SSH ¶
type SSH interface { // Connect connects to a remote server creating a new client session. // "Close" must be called after use. Connect() error // Close closes the session and connection to a remote server. Close() // Run runs the command and returns the output. Run(cmd string, opts ...OpOption) (out []byte, err error) // Send sends a file to the remote host using SCP protocol. Send(localPath, remotePath string, opts ...OpOption) (out []byte, err error) // Download downloads a file from the remote host using SCP protocol. Download(remotePath, localPath string, opts ...OpOption) (out []byte, err error) }
SSH defines SSH operations.
Click to show internal directories.
Click to hide internal directories.