Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCmdTimedOut = errors.New("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.
Click to show internal directories.
Click to hide internal directories.