ssh

package
v2018.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(host string, client *ssh.Client, cmd string) error

func PublicKeyFile

func PublicKeyFile(file string) ssh.AuthMethod

func Run

func Run(host string, client *ssh.Client, cmd string) (string, error)

func SSHAgent

func SSHAgent() ssh.AuthMethod

func SSHResultToString

func SSHResultToString(result string) string

Types

type Conn

type Conn struct {
	net.Conn
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Conn wraps a net.Conn, and sets a deadline for every read and write operation.

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type Manager

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

the SSH Connection Manager for multiple connections

func NewManager

func NewManager(file string, timeout time.Duration) *Manager

create a new SSH Connection Manager by ssh file

func (*Manager) ConnectTo

func (m *Manager) ConnectTo(addr net.TCPAddr) (*ssh.Client, error)

func (*Manager) ExecuteOn

func (m *Manager) ExecuteOn(addr net.TCPAddr, cmd string) error

func (*Manager) RunOn

func (m *Manager) RunOn(addr net.TCPAddr, cmd string) (string, error)

type SSHResultHandler

type SSHResultHandler func(string, string, error)

func SSHResultToStringHandler

func SSHResultToStringHandler(handler SSHResultHandler) SSHResultHandler

Jump to

Keyboard shortcuts

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