remotehost

package
v0.1.1-0...-f02a436 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunCMD = func(hostname, cmd string) (string, error) {
	session, err := NewSSHSession(hostname)
	if err != nil {
		return "", err
	}

	output, err := session.Output(cmd)
	if err != nil {
		return "", err
	}

	return string(output), nil
}

RunCMD execute cmd on remote host

Functions

func CreateConnection

func CreateConnection(source string) (*ssh.Client, error)

CreateConnection create ssh connection

func NewSSHSession

func NewSSHSession(source string) (*ssh.Session, error)

NewSSHSession Start new ssh session

Types

type Client

type Client struct {
	*sftp.Client
}

Client Wrapper around sftp.Client

Jump to

Keyboard shortcuts

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