Documentation ¶
Index ¶
- Constants
- func LoadSSHHostKey(path string) *ssh.HostKeyCallback
- type Command
- type Credentials
- type Host
- type Options
- type RunError
- type SSHCommander
- func (sshCommander *SSHCommander) Connect() (err error)
- func (sshCommander *SSHCommander) Disconnect() (err error)
- func (sshCommander *SSHCommander) DownloadFile(remotePath, localPath string) error
- func (sshCommander *SSHCommander) PowerOff() error
- func (sshCommander *SSHCommander) Reboot(retries int) error
- func (sshCommander *SSHCommander) Reconnect() error
- func (sshCommander *SSHCommander) Run(sshCommand *Command) (output string, err error)
- func (sshCommander *SSHCommander) RunCmd(command string, args ...interface{}) (string, error)
- func (sshCommander *SSHCommander) RunEnv(command string, args ...interface{}) func([]string) (string, error)
- func (sshCommander *SSHCommander) SetOptions(options *Options) error
- func (sshCommander *SSHCommander) UploadFile(localPath, remotePath string) error
- func (sshCommander *SSHCommander) UploadFileInMemory(size int64, mode os.FileMode, fileName string, contents string, ...) error
Constants ¶
const ( //ErrKeysNotFound | The keys not found on paths ErrKeysNotFound = "No keys found in past paths" //ErrMakeConnection | Failed create an connection ErrMakeConnection = "Failed to make an connection. %s" //ErrMakeSession | Failed create an session ErrMakeSession = "Failed to make an session. %s" //ErrPipeStdIn | Failed to pipe Standard In ErrPipeStdIn = "Failed to pipe Standard In. %s" //ErrRequestPseudoTerminal | Failed request pseudo terminal ErrRequestPseudoTerminal = "Request for pseudo terminal failed. %s" //ErrRequestShell | Request for shell failed ErrRequestShell = "Request for shell failed. %s" )
Variables ¶
This section is empty.
Functions ¶
func LoadSSHHostKey ¶
func LoadSSHHostKey(path string) *ssh.HostKeyCallback
LoadSSHHostKey | Load an Host Key and return HostKeyCallBack (Generally is in /etc/ssh/ssh_host_dsa_key)
Types ¶
type Command ¶
Command | The command for run
func NewSSHCommand ¶
NewSSHCommand | Make an new instance of SSHCommand
type Credentials ¶
Credentials | Has an informations of credentials
type Options ¶
type Options struct { Host *Host Credentials *Credentials HostKeyCallBack *ssh.HostKeyCallback Output bool }
Options | Has an informations of options to SSHCommander
type RunError ¶
type RunError struct {
// contains filtered or unexported fields
}
RunError stores the information about an exited remote command as reported by Wait.
func (RunError) ExitStatus ¶
ExitStatus returns the exit status of the remote command.
type SSHCommander ¶
type SSHCommander struct {
// contains filtered or unexported fields
}
SSHCommander | SSHCommander
func NewSSHCommander ¶
func NewSSHCommander(options *Options) (*SSHCommander, error)
NewSSHCommander | Make an new instance of SSHCommander
func (*SSHCommander) Connect ¶
func (sshCommander *SSHCommander) Connect() (err error)
Connect make connection from SSH
func (*SSHCommander) Disconnect ¶
func (sshCommander *SSHCommander) Disconnect() (err error)
Disconnect | Close the SSH connection
func (*SSHCommander) DownloadFile ¶
func (sshCommander *SSHCommander) DownloadFile(remotePath, localPath string) error
DownloadFile | Copy remote file to local machine
func (*SSHCommander) PowerOff ¶
func (sshCommander *SSHCommander) PowerOff() error
PowerOff | PowerOff remote machine
func (*SSHCommander) Reboot ¶
func (sshCommander *SSHCommander) Reboot(retries int) error
Reboot | Restart remote machine and return if connection is ok If retries is 0 retries is infinity.
func (*SSHCommander) Reconnect ¶
func (sshCommander *SSHCommander) Reconnect() error
Reconnect | Close the SSH connection and reopen
func (*SSHCommander) Run ¶
func (sshCommander *SSHCommander) Run(sshCommand *Command) (output string, err error)
Run | Run an command
func (*SSHCommander) RunCmd ¶
func (sshCommander *SSHCommander) RunCmd(command string, args ...interface{}) (string, error)
RunCmd | Alis for Run
func (*SSHCommander) RunEnv ¶
func (sshCommander *SSHCommander) RunEnv(command string, args ...interface{}) func([]string) (string, error)
RunEnv | Alis for Run
func (*SSHCommander) SetOptions ¶
func (sshCommander *SSHCommander) SetOptions(options *Options) error
SetOptions | Change SSHCommander options and reset connection with remote host
func (*SSHCommander) UploadFile ¶
func (sshCommander *SSHCommander) UploadFile(localPath, remotePath string) error
UploadFile | Copy local file to remote machine
func (*SSHCommander) UploadFileInMemory ¶
func (sshCommander *SSHCommander) UploadFileInMemory(size int64, mode os.FileMode, fileName string, contents string, destinationPath string) error
UploadFileInMemory | Copy local memory file to remote machine