transport

package
v0.0.0-...-eabb6db Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSH

type SSH struct {
	Address  string
	Username string
	Port     int32
	Password string
	// contains filtered or unexported fields
}

func (*SSH) Close

func (s *SSH) Close()

func (*SSH) Connect

func (*SSH) Connect(target *types.Target, cred *types.Credential) (Transport, error)

Connect is "static," in that it does not reference the receive it's called on; so it can be called on a nil pointer to SSH. This is good, because it's a sort of constructor to create a live SSH connection. Thus, it returns an SSH connection to the given target authenticated with the given credential; or an error, if something went wrong.

func (*SSH) Do

func (s *SSH) Do(cmd []string) (stdout []byte, stderr []byte, result int, err error)

func (*SSH) DoInput

func (s *SSH) DoInput(cmd []string, stdin []byte) (stdout []byte, stderr []byte, result int, err error)

func (*SSH) DoReader

func (s *SSH) DoReader(cmd []string, stdin io.Reader) (stdout []byte, stderr []byte, result int, err error)

type Transport

type Transport interface {
	// Do performs a command via the configured transport, probably on a target host. The first element in cmd
	// should be the binary; the rest will be individual arguments, properly escaped...
	Do(cmd []string) (stdout []byte, stderr []byte, result int, err error)
	DoInput(cmd []string, stdin []byte) (stdout []byte, stderr []byte, result int, err error)
	DoReader(cmd []string, stdin io.Reader) (stdout []byte, stderr []byte, result int, err error)
	Connect(target *types.Target, credential *types.Credential) (Transport, error)
	Close()
}

type TransportConnect

type TransportConnect func(*types.Target, *types.Credential) (Transport, error)

Jump to

Keyboard shortcuts

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