easyssh

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Note this easyssh package is a copy of "github.com/hypersleep/easyssh" repository It was copied for being modified to be compatible with gridscale packer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MakeConfig

type MakeConfig struct {
	User     string
	Server   string
	Key      string
	Port     string
	Password string
	// contains filtered or unexported fields
}

Contains main authority information. User field should be a name of user on remote server (ex. john in ssh john@example.com). Server field should be a remote machine address (ex. example.com in ssh john@example.com) Key is a path to private key on your local machine. Port is SSH server port on remote machine. Note: easyssh looking for private key in user's home directory (ex. /home/john + Key). Then ensure your Key begins from '/' (ex. /.ssh/id_rsa)

func (*MakeConfig) Run

func (ssh_conf *MakeConfig) Run(command string, timeout int) (outStr string, errStr string, isTimeout bool, err error)

Runs command on remote machine and returns its stdout as a string

func (*MakeConfig) Scp

func (ssh_conf *MakeConfig) Scp(sourceFile string, etargetFile string) error

Scp uploads sourceFile to remote machine like native scp console app.

func (*MakeConfig) Stream

func (ssh_conf *MakeConfig) Stream(command string, timeout int) (stdout chan string, stderr chan string, done chan bool, err error)

Stream returns one channel that combines the stdout and stderr of the command as it is run on the remote machine, and another that sends true when the command is done. The sessions and channels will then be closed.

Jump to

Keyboard shortcuts

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