remote

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SshClient

func SshClient(host, user, private, passphrase string) (*ssh.Client, error)

Types

type Cmd

type Cmd struct {
	Executor

	Name           string
	Args           []string
	Stdin          io.Reader
	Stdout, Stderr io.Writer
}

func Command

func Command(exec Executor, name string, args ...string) *Cmd

func (*Cmd) CombinedOutput

func (c *Cmd) CombinedOutput() (string, error)

func (*Cmd) Output

func (c *Cmd) Output() (string, error)

func (*Cmd) Run

func (c *Cmd) Run() error

func (*Cmd) Start

func (c *Cmd) Start() error

func (*Cmd) String

func (c *Cmd) String() string

type Executor

type Executor interface {
	// Start runs cmd on the remote host.
	Start(cmd string, in io.Reader, out, stderr io.Writer) error
	// Wait waits for the command to finish if it has already been started, and returns the result.
	Wait() error
	// Close closes the connection.
	Close() error
	// Addr of remote machine.
	Addr() net.Addr
}

func SshExecutor

func SshExecutor(client *ssh.Client) Executor

type ExitError

type ExitError struct {
	Content string
	Status  int
}

func (ExitError) Error

func (e ExitError) Error() string

Jump to

Keyboard shortcuts

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