ssh

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: LGPL-2.1 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUser = "root"
	DefaultPort = 22
)

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(cfg Config) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Execute

func (c *Client) Execute(ctx context.Context, shell string, opts ...client.ExecOption) (client.ICmd, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, src, dst string, opts ...client.GetOption) error

func (*Client) Name

func (c *Client) Name() string

func (*Client) Put

func (c *Client) Put(ctx context.Context, src, dst string, opts ...client.PutOption) error

func (*Client) ReadFile added in v0.2.0

func (c *Client) ReadFile(ctx context.Context, name string) ([]byte, error)

func (*Client) Stat

func (c *Client) Stat(ctx context.Context, name string) (*client.Stat, error)

type Cmd

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

func (*Cmd) Close

func (c *Cmd) Close() error

func (*Cmd) CombinedOutput

func (c *Cmd) CombinedOutput() ([]byte, error)

func (*Cmd) Run

func (c *Cmd) Run() error

func (*Cmd) Session

func (c *Cmd) Session() *ssh.Session

func (*Cmd) Start

func (c *Cmd) Start() error

func (*Cmd) StderrPipe

func (c *Cmd) StderrPipe() (io.Reader, error)

func (*Cmd) StdinPipe

func (c *Cmd) StdinPipe() (io.WriteCloser, error)

func (*Cmd) StdoutPipe

func (c *Cmd) StdoutPipe() (io.Reader, error)

func (*Cmd) Wait

func (c *Cmd) Wait() error

type Config

type Config struct {
	Network string
	Addr    string

	ClientConfig *ssh.ClientConfig
	Logger       *zap.Logger
}

func NewAuthConfig

func NewAuthConfig(lg *zap.Logger, host, user, password string) *Config

func (*Config) Validate

func (cfg *Config) Validate() error

Jump to

Keyboard shortcuts

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