ssh

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSSHAddress

func ParseSSHAddress(sshAddr string) (string, string, string, error)

Types

type Client

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

func NewClient

func NewClient(options ...Option) *Client

func (*Client) C

func (s *Client) C() (*Client, error)

C connect

func (*Client) Close

func (s *Client) Close() error

func (*Client) DeleteFiles

func (s *Client) DeleteFiles(path string) error

func (*Client) ExecuteCommand

func (s *Client) ExecuteCommand(command string) (string, error)

func (*Client) ExecuteCommandWithStream

func (s *Client) ExecuteCommandWithStream(command string, stdout, stderr io.Writer) error

func (*Client) MustC

func (s *Client) MustC() *Client

func (*Client) SFTP

func (s *Client) SFTP() *SftpX

type Option

type Option func(*Client)

func WithHost

func WithHost(host string) Option

func WithPassword

func WithPassword(password string) Option

func WithPort

func WithPort(port string) Option

func WithPrivateKeyPath

func WithPrivateKeyPath(privateKeyPath string) Option

func WithUsername

func WithUsername(username string) Option

type SftpX

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

func (*SftpX) Close

func (s *SftpX) Close() error

func (*SftpX) DownloadFile

func (s *SftpX) DownloadFile(remoteFile, localFile string) error

func (*SftpX) Open

func (s *SftpX) Open(path string) (*sftp.File, error)

func (*SftpX) ReadDir

func (s *SftpX) ReadDir(path string) ([]os.FileInfo, error)

func (*SftpX) SFTPClient

func (s *SftpX) SFTPClient() *sftp.Client

Jump to

Keyboard shortcuts

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