ssh

package
v0.0.0-...-1298597 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSHClient

type SSHClient struct {
	// contains filtered or unexported fields
}

func NewSSHClient

func NewSSHClient(remoteAddr string, username string, sshKeyFile string) (*SSHClient, error)

func (*SSHClient) AuthorizedKey

func (s *SSHClient) AuthorizedKey() string

AuthorizedKey returns the public key in authorized_keys format

func (*SSHClient) Exec

func (s *SSHClient) Exec(ctx context.Context, cmd string) (string, error)

Exec executes a command and returns stdout or not nil error

func (*SSHClient) ExecVerbose

func (s *SSHClient) ExecVerbose(_ context.Context, cmd string) (stdout string, stderr string, exitCode int, err error)

ExecVerbose executes a command and returns stdout, stderr, exitCode or not nil error

func (*SSHClient) RemoveAddr

func (s *SSHClient) RemoveAddr() string

func (*SSHClient) Run

func (s *SSHClient) Run(ctx context.Context, cmds ...string) error

Run runs commands in sequence, if any command fails, it will return error

func (*SSHClient) WriteFile

func (s *SSHClient) WriteFile(content io.Reader, dstFilePath string) error

Jump to

Keyboard shortcuts

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