remote

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyUsername = errors.New("empty username")
	ErrEmptyPassword = errors.New("empty password")
	ErrEmptyAddress  = errors.New("empty hostname")
	ErrInvalidPort   = errors.New("invalid port")
)

Functions

func HostsFromFile added in v0.0.9

func HostsFromFile(filename string) (map[string][]Host, error)

func ToUnixPath added in v0.0.9

func ToUnixPath(pathStr string) string

Types

type Host added in v0.0.9

type Host struct {
	User     string
	Password string
	Address  string
	Port     int
}

func HostFromLine added in v0.0.9

func HostFromLine(line string) (Host, error)

type HostPool added in v0.0.9

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

func NewHostPool added in v0.0.9

func NewHostPool(logger zerolog.Logger) *HostPool

func (*HostPool) GetRemote added in v0.0.9

func (p *HostPool) GetRemote(host Host) (*Remote, error)

type Remote

type Remote struct {
	Hostname string
	Port     int
	Username string
	Password string
	Logger   zerolog.Logger
	// contains filtered or unexported fields
}

Remote represents a SSH/SFTP client for remote server operations

func New

func New(h Host, logger zerolog.Logger) (*Remote, error)

New creates a new Remote instance and establishes connections

func (*Remote) Close

func (r *Remote) Close() error

Close closes the SSH and SFTP connections

func (*Remote) ExecuteCommand

func (r *Remote) ExecuteCommand(cmd string) (int, string, string, error)

ExecuteCommand executes a command on remote host and returns the output

func (*Remote) UploadDirectory

func (r *Remote) UploadDirectory(localDir, remoteDir string) error

UploadDirectory uploads a local directory recursively to remote path with better error handling

func (*Remote) UploadFile

func (r *Remote) UploadFile(localPath, remotePath string) error

UploadFile uploads a local file to remote path with buffer optimization

Jump to

Keyboard shortcuts

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