remote

package
v0.0.0-...-900fa13 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCmdTimedOut = fmt.Errorf("ssh command timed out")
)

Functions

This section is empty.

Types

type SFTPGateway

type SFTPGateway struct {

	// the sftp client that the gateway is managing
	Client *sftp.Client

	// the remote host
	Host string
	// the user we'll access the file as on the remote machine
	User string

	// the file containing the private key we'll use to connect
	Keyfile string
}

SFTPGateway wraps an SFTP client.

func (*SFTPGateway) Close

func (gateway *SFTPGateway) Close() error

Close frees any necessary resources.

func (*SFTPGateway) Init

func (gateway *SFTPGateway) Init() error

Connect to the other side, and initialize the SFTP client.

type SSHCommand

type SSHCommand struct {
	// the command to be run on the remote machine
	Command string

	// the remote host to connect to
	Host string

	// the user to connect with
	User string

	// the location of the private key file (PEM-encoded) to be used
	Keyfile string

	// stdin for the remote command
	Stdin io.Reader

	// the threshold at which the command is considered to time out, and will be killed
	Timeout time.Duration
}

SSHCommand abstracts a single command to be run via ssh, on a remote machine.

func (*SSHCommand) Run

func (cmd *SSHCommand) Run() ([]byte, error)

Run the command via ssh. Returns the combined stdout and stderr, as well as any error that occurs.

Jump to

Keyboard shortcuts

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