ssh

package
v2.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort = "22"
)

Variables

View Source
var (
	ErrUserNotSpecified = errors.New("user not specified")
	ErrHostNotSpecified = errors.New("host not specified")
)

Functions

func NewRunner

func NewRunner(config Config) (runner.Runner, error)

NewRunner creates ssh runner object. It requires two io.Writer to send output of ssh session and config for ssh client. TODO: Does it safe to pass Config as a pointer?

Types

type Config

type Config struct {
	Host    string `json:"host"`
	Port    string `json:"port"`
	User    string `json:"user"`
	Timeout int    `json:"timeout"`
	Key     []byte `json:"key"`
}

Config is a set of params needed to create valid ssh.ClientConfig

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner is implementation of runner interface for ssh

func (*Runner) Run

func (r *Runner) Run(cmd *runner.Command) (err error)

TODO(stgleb): Add more context like env variables? Run executes a single command on ssh session.

The returned error is nil if the command runs, has no problems copying stdin, stdout, and stderr, and exits with a zero exit status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL