Versions in this module Expand all Collapse all v1 v1.2.5 Sep 23, 2024 Changes in this version + func CopyFile(client ssh.Client, src, dst string) error + func CreateDir(ctx context.Context, client ssh.Client, dir string, ow OverwriteDir, sudo Sudo) error + func DeleteDir(ctx context.Context, client ssh.Client, dir string, sudo Sudo) error + func DeleteFile(client ssh.Client, file string, sudo Sudo) error + func ReadFile(ctx context.Context, client ssh.Client, filename string, sudo Sudo) (string, error) + func Run(client ssh.Client, cmd string) error + func RunSafeOutput(client ssh.Client, cmd string, args []string) (string, error) + func RunSafeShell(client ssh.Client, sin io.Reader, sout, serr io.Writer, cmd string, ...) error + func WriteFile(client ssh.Client, file string, contents string, kind string, sudo Sudo) error + type DummyClient struct + Err error + Out string + func (s *DummyClient) AddHop(host string, port int) (ssh.Client, error) + func (s *DummyClient) Output(command string) (string, error) + func (s *DummyClient) OutputWithTimeout(command string, timeout time.Duration) (string, error) + func (s *DummyClient) Shell(sin io.Reader, sout, serr io.Writer, args ...string) error + func (s *DummyClient) Start(command string) (io.ReadCloser, io.ReadCloser, io.WriteCloser, error) + func (s *DummyClient) StartPersistentConn(timeout time.Duration) error + func (s *DummyClient) StopPersistentConn() + func (s *DummyClient) Wait() error + type LocalClient struct + WorkingDir string + func (nc *LocalClient) StartPersistentConn(timeout time.Duration) error + func (nc *LocalClient) StopPersistentConn() + func (s *LocalClient) AddHop(host string, port int) (ssh.Client, error) + func (s *LocalClient) Output(command string) (string, error) + func (s *LocalClient) OutputWithTimeout(command string, timeout time.Duration) (string, error) + func (s *LocalClient) Shell(sin io.Reader, sout, serr io.Writer, args ...string) error + func (s *LocalClient) Start(command string) (io.ReadCloser, io.ReadCloser, io.WriteCloser, error) + func (s *LocalClient) Wait() error + type NopReadCloser struct + func (NopReadCloser) Close() error + type NopWriteCloser struct + func (NopWriteCloser) Close() error + type NullWriter struct + func (NullWriter) Write(p []byte) (int, error) + type OverwriteDir bool + var NoOverwrite OverwriteDir = false + var Overwrite OverwriteDir = true + type SSHClientOp func(sshp *SSHOptions) + func WithCachedIp(cached bool) SSHClientOp + func WithTimeout(timeout time.Duration) SSHClientOp + func WithUser(user string) SSHClientOp + type SSHOptions struct + CachedIP bool + Timeout time.Duration + User string + func (o *SSHOptions) Apply(ops []SSHClientOp) + type Sudo bool + var NoSudo Sudo = false + var SudoOn Sudo = true + type TestClient struct + Cmds []string + OutputResponder func(cmd string) (string, error) + func (s *TestClient) AddHop(host string, port int) (ssh.Client, error) + func (s *TestClient) Output(command string) (string, error) + func (s *TestClient) OutputWithTimeout(command string, Timeout time.Duration) (string, error) + func (s *TestClient) Shell(sin io.Reader, sout, serr io.Writer, args ...string) error + func (s *TestClient) Start(command string) (io.ReadCloser, io.ReadCloser, io.WriteCloser, error) + func (s *TestClient) StartPersistentConn(timeout time.Duration) error + func (s *TestClient) StopPersistentConn() + func (s *TestClient) Wait() error