types

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MPL-2.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 DialCloser

type DialCloser interface {
	io.Closer

	Dial(network, address string) (net.Conn, error)
}

func NopDialCloser

func NopDialCloser(d proxy.Dialer) DialCloser

type DialCloserFunc

type DialCloserFunc func(network, address string) (net.Conn, error)

func (DialCloserFunc) Close

func (DialCloserFunc) Close() error

func (DialCloserFunc) Dial

func (f DialCloserFunc) Dial(network, addr string) (net.Conn, error)

type DialClosers

type DialClosers []DialCloser

func (DialClosers) Close

func (p DialClosers) Close() (err error)

func (DialClosers) Dial

func (p DialClosers) Dial(network, address string) (net.Conn, error)

type DirectoryReadCloser

type DirectoryReadCloser = interface {
	fs.ReadDirFS
	io.Closer
}

type DirectoryReader

type DirectoryReader = fs.FS

type FileReadCloser

type FileReadCloser = io.ReadCloser

type FileReader

type FileReader = io.Reader

type Host

type Host interface {
	io.Closer
	Sheller
	Transmitter

	// State returns the status of the host.
	State(ctx context.Context) (HostStatus, error)
	// Execute executes the given command on the host.
	Execute(ctx context.Context, cmd string, args ...string) error
	// ExecuteWithOutput executes the given command on the host and returns the output.
	ExecuteWithOutput(ctx context.Context, cmd string, args ...string) ([]byte, error)
}

type HostAddressParsed

type HostAddressParsed struct {
	Scheme string
	Host   string
	Port   int
}

func (HostAddressParsed) HostPort

func (p HostAddressParsed) HostPort(defaultPort int) string

func (HostAddressParsed) HostPortFunc

func (p HostAddressParsed) HostPortFunc(
	defaultPortFunc func(HostAddressParsed) int,
) string

type HostOption

type HostOption struct {
	Address  string
	Authn    HostOptionAuthn
	Insecure bool
}

func (HostOption) ParseAddress

func (o HostOption) ParseAddress() (parsed HostAddressParsed, err error)

type HostOptionAuthn

type HostOptionAuthn struct {
	Type   string
	User   string
	Secret string
	Agent  bool
}

type HostOptions

type HostOptions struct {
	HostOption

	Proxies []HostOption
}

type HostStatus

type HostStatus struct {
	Accessible bool
	OS         string
	Arch       string
	Version    string
}

type Sheller

type Sheller interface {
	// Shell returns a terminal to execute multiple commands on the host.
	Shell(ctx context.Context, cmdArgs ...string) (Terminal, error)
}

type Terminal

type Terminal interface {
	io.ReadWriteCloser

	// Execute executes the given command on the host.
	Execute(cmd string, args ...string) error
	// ExecuteWithOutput executes the given command on the host and returns the output.
	ExecuteWithOutput(cmd string, args ...string) ([]byte, error)
}

type Transmitter

type Transmitter interface {
	// UploadFile uploads the given file to the host.
	UploadFile(ctx context.Context, from FileReader, to string) error
	// UploadDirectory uploads the given directory to the host.
	UploadDirectory(ctx context.Context, from DirectoryReader, to string) error
	// DownloadFile downloads the given file from the host.
	DownloadFile(ctx context.Context, from string) (FileReadCloser, error)
	// DownloadDirectory downloads the given directory from the host.
	DownloadDirectory(ctx context.Context, from string) (DirectoryReadCloser, error)
}

Jump to

Keyboard shortcuts

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