dssh

package module
v0.0.0-...-41f0e46 Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 10 Imported by: 0

README

dssh

Inspired by/Taken from:

Installation

Run (golang v1.8+ required):

$ go get -u github.com/stefankoop/dssh
Testkeys

id_rsa_test_passphrase : password

Documentation

Overview

Package dssh 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

type MakeConfig struct {
	User     string
	Server   string
	Key      string
	Port     string
	Password string
}

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) RunSimple

func (ssh_conf *MakeConfig) RunSimple(command string) (*SSHOut, error)

func (*MakeConfig) Scp

func (ssh_conf *MakeConfig) Scp(source string, target 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.

type SSHOut

type SSHOut struct {
	Command    string
	StdOut     string
	StdErr     string
	ExitStatus string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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