transport

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExitError

type ExitError struct {
	ExitCode int
}

ExitError is returned by Process.Wait when the controlled process exited with a non-zero exit code (depending on transport)

func (*ExitError) Error

func (e *ExitError) Error() string

type LocalTransport

type LocalTransport struct{}

func (*LocalTransport) NewProcess

func (lt *LocalTransport) NewProcess(ctx xcontext.Context, bin string, args []string) (Process, error)

type Process

type Process interface {
	Start(ctx xcontext.Context) error
	Wait(ctx xcontext.Context) error

	StdoutPipe() (io.Reader, error)
	StderrPipe() (io.Reader, error)

	String() string
}

type SSHTransport

type SSHTransport struct {
	SSHTransportConfig
}

func (*SSHTransport) NewProcess

func (st *SSHTransport) NewProcess(ctx xcontext.Context, bin string, args []string) (Process, error)

type SSHTransportConfig

type SSHTransportConfig struct {
	Host string `json:"host,omitempty"`
	Port int    `json:"port,omitempty"`

	User         string `json:"user,omitempty"`
	Password     string `json:"password,omitempty"`
	IdentityFile string `json:"identity_file,omitempty"`

	Timeout    xjson.Duration `json:"timeout,omitempty"`
	SendBinary bool           `json:"send_binary,omitempty"`

	Async *struct {
		Agent     string         `json:"agent,omitempty"`
		TimeQuota xjson.Duration `json:"time_quota,omitempty"`
	} `json:"async,omitempty"`
}

func DefaultSSHTransportConfig

func DefaultSSHTransportConfig() SSHTransportConfig

type Transport

type Transport interface {
	NewProcess(ctx xcontext.Context, bin string, args []string) (Process, error)
}

func NewLocalTransport

func NewLocalTransport() Transport

func NewSSHTransport

func NewSSHTransport(config SSHTransportConfig) Transport

func NewTransport

func NewTransport(proto string, configSource json.RawMessage, expander *test.ParamExpander) (Transport, error)

Jump to

Keyboard shortcuts

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