Documentation
¶
Index ¶
- func LoadPrivateKeyFile(file string) (ssh.AuthMethod, error)
- func SSHAgent() (ssh.AuthMethod, error)
- type SshApi
- func (sshApi *SshApi) Close() (err error)
- func (sshApi *SshApi) Connect() (*ssh.Client, error)
- func (sshApi *SshApi) ConnectAndSession() (err error)
- func (sshApi *SshApi) CopyFromRemote(source string, dest string) (err error)
- func (sshApi *SshApi) CopyToRemote(source string, dest string) (err error)
- func (sshApi *SshApi) DefaultSshPasswordSetup() error
- func (sshApi *SshApi) GetStdErr() string
- func (sshApi *SshApi) GetStdOut() string
- func (sshApi *SshApi) Run(cmd string) (stdout string, stderr string, err error)
- func (sshApi *SshApi) SessionDefault() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadPrivateKeyFile ¶
func LoadPrivateKeyFile(file string) (ssh.AuthMethod, error)
func SSHAgent ¶
func SSHAgent() (ssh.AuthMethod, error)
Types ¶
type SshApi ¶
type SshApi struct { SshConfig *ssh.ClientConfig Client *ssh.Client Session *ssh.Session User string Key string Password string Host string Port int Timeout time.Duration StdOut bytes.Buffer StdErr bytes.Buffer }
func DefaultSshApiSetup ¶
func (*SshApi) Connect ¶
connect the ssh client - use ConnectAndSession if you have no reason to create the session manually why ever we do support proper timeouts here, thats why it looks a little more complicated then the usual ssh connect
func (*SshApi) ConnectAndSession ¶
connect the ssh client and create a session, ready to go with commands ro scp
func (*SshApi) CopyFromRemote ¶
scp a file from a remote host
func (*SshApi) CopyToRemote ¶
scp a local file to a remote host
func (*SshApi) DefaultSshPasswordSetup ¶
func (*SshApi) Run ¶
run a ssh command. Auto-creates session if you did yet not connect just wrapping ssh.Session.Run with connect / run and then disconnect
func (*SshApi) SessionDefault ¶
creates a default session with usual parameters
Click to show internal directories.
Click to hide internal directories.