ssh

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(opts Options, logger *zap.SugaredLogger) (client *Client, err error)

func (*Client) GetByHost

func (c *Client) GetByHost(host string) (*HostExecutor, error)

GetByHost returns a shell command executor on a remote host. Attempts to only create SSH connections once, keeping them in a `sync.Map`.

type HostExecutor

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

HostExecutor implements a shell command executor on a remote machine over SSH

func (*HostExecutor) Execute

func (h *HostExecutor) Execute(ctx context.Context, cmd *exec.Cmd) ([]byte, error)

func (*HostExecutor) ReadFile

func (h *HostExecutor) ReadFile(ctx context.Context, path string) ([]byte, error)

func (*HostExecutor) Run

func (h *HostExecutor) Run(ctx context.Context, cmd *exec.Cmd) error

func (*HostExecutor) WriteFile

func (h *HostExecutor) WriteFile(ctx context.Context, path string, data []byte) error

type Options

type Options struct {
	Port        uint
	Username    string
	Password    string
	KeyFile     string `yaml:"keyFile"`
	KeyPassword string `yaml:"keyPassword"`
	Debug       bool
}

Jump to

Keyboard shortcuts

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