rmt

package
v0.0.0-...-740721f Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentAuths

func AgentAuths() ssh.AuthMethod

AgentAuths is a helper function to get SSH keys from an ssh agent. If any errors occur, an empty PublicKeys ssh.AuthMethod will be returned.

Types

type Remote

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

Remote represents a Remote target, connected to over SSH

func New

func New(addr string, user string, sudopass string, hostkeycallback ssh.HostKeyCallback, auths ...ssh.AuthMethod) (*Remote, error)

New returns a new Remote target from connection details

func (*Remote) ActiveUser

func (r *Remote) ActiveUser() string

ActiveUser returns the currently active user

func (*Remote) As

func (r *Remote) As(user string)

As returns a new Remote that will use the same underlying connections, but all operations will be done as user.

No tests are done in this method. If user does not exist or does not have sudo rights, that will only be evident when trying to use methods on the returned object.

func (*Remote) Close

func (r *Remote) Close() error

Close closes all underlying connections

func (*Remote) Get

func (r *Remote) Get(filename string) ([]byte, error)

Get retrieves the contents of the named

func (*Remote) Put

func (r *Remote) Put(filename string, data []byte, perm os.FileMode) error

Put implements target.Put

func (*Remote) Run

func (r *Remote) Run(cmd string, stdin io.Reader) (sh.Result, error)

Run executes cmd on Remote with the currently active user and returns the response. Reader stdin is used to add stdin.

func (*Remote) String

func (r *Remote) String() string

String implements fmt.Stringer

func (*Remote) User

func (r *Remote) User() string

User returns the connected user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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