ssh

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dst, host, user, key string) error

Copy copies files from source to destination using SFTP

func Rsync

func Rsync(src, dst, host, user, key string) error

Rsync copies files from source to destination using rsync

func Run

func Run(cmd, host, key, user, password string, stream bool, timeout int) (string, error)

Run executes a command on a remote host

Types

type CopyConfig

type CopyConfig struct {
	Source      string
	Destination string
	Host        string
	User        string
	KeyPath     string
	Port        int
}

CopyConfig holds configuration for file copy operations

func NewCopyConfig

func NewCopyConfig(src, dst, host, user, key string) *CopyConfig

NewCopyConfig creates a new copy configuration with defaults

func (*CopyConfig) Execute

func (c *CopyConfig) Execute() error

Execute performs the file copy operation

type RunConfig

type RunConfig struct {
	Command  string
	Host     string
	KeyPath  string
	User     string
	Password string
	Stream   bool
	Timeout  time.Duration
	Port     int
}

RunConfig holds configuration for SSH command execution

func NewRunConfig

func NewRunConfig(cmd, host, key, user, password string, stream bool, timeout int) *RunConfig

NewRunConfig creates a new run configuration with defaults

func (*RunConfig) Execute

func (r *RunConfig) Execute() (string, error)

Execute performs the command execution

Jump to

Keyboard shortcuts

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