ssh

package
v1.0.33 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryableSSHError

func IsRetryableSSHError(err error) bool

func ShellEscape

func ShellEscape(s string) string

Types

type Client

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

func NewClient

func NewClient(host string, port int, user, password string) (*Client, error)

func NewClientWithConfig

func NewClientWithConfig(host string, port int, user, password string, cfg *SSHConfig) (*Client, error)

func NewClientWithRetry

func NewClientWithRetry(ctx context.Context, host string, port int, user, password string, cfg *SSHRetryConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) FileExists

func (c *Client) FileExists(path string) (bool, error)

func (*Client) Healthy added in v0.0.23

func (c *Client) Healthy() bool

func (*Client) MkdirAll

func (c *Client) MkdirAll(path string) error

func (*Client) MkdirAllSudo

func (c *Client) MkdirAllSudo(path string) error

func (*Client) MkdirAllSudoWithPerm

func (c *Client) MkdirAllSudoWithPerm(path, perm string) error

func (*Client) Run

func (c *Client) Run(cmd string) (stdout, stderr string, err error)

func (*Client) RunWithStdin

func (c *Client) RunWithStdin(stdin string, cmd string) (stdout, stderr string, err error)

func (*Client) StreamRun

func (c *Client) StreamRun(ctx context.Context, cmd string, stdoutChan, stderrChan chan string) error

func (*Client) UploadFile

func (c *Client) UploadFile(localPath, remotePath string) error

func (*Client) UploadFileSudo

func (c *Client) UploadFileSudo(localPath, remotePath string) error

func (*Client) UploadFileSudoWithPerm

func (c *Client) UploadFileSudoWithPerm(localPath, remotePath, perm string) error

type SSHConfig

type SSHConfig struct {
	StrictHostKeyChecking bool
	Timeout               time.Duration
}

func DefaultSSHConfig

func DefaultSSHConfig() *SSHConfig

type SSHRetryConfig

type SSHRetryConfig struct {
	MaxAttempts  int
	InitialDelay time.Duration
	MaxDelay     time.Duration
}

func DefaultSSHRetryConfig

func DefaultSSHRetryConfig() *SSHRetryConfig

Jump to

Keyboard shortcuts

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