Documentation
¶
Overview ¶
Package easyssh provides a simple implementation of some SSH protocol features in Go. You can simply run a command on a remote server or get a file even simpler than native console SSH client. You don't need to think about Dials, sessions, defers, or public keys... Let easyssh think about it!
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MakeConfig ¶
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) (outStr string, err error)
Runs command on remote machine and returns its stdout as a string
func (*MakeConfig) Scp ¶
func (ssh_conf *MakeConfig) Scp(sourceFile string) error
Scp uploads sourceFile to remote machine like native scp console app.
func (*MakeConfig) Stream ¶
func (ssh_conf *MakeConfig) Stream(command string) (output 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.