runtime

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyLocal

func CopyLocal(src, dst string) error

func CopyRemote

func CopyRemote(sftpClient *SftpClient, src, dst string) error

CopyRemote copies a file or directory recursively on the remote host using a pooled SFTP client

func ReadLocalFileBytes

func ReadLocalFileBytes(filename string) ([]byte, error)

func ReadRemoteFileBytes

func ReadRemoteFileBytes(sftpClient *SftpClient, remotePath string) ([]byte, error)

ReadRemoteFileBytes reads the content of a remote file as raw bytes using a pooled SFTP client

func RunLocalCommandWithShell added in v1.0.0

func RunLocalCommandWithShell(command, username string, useShell bool, cfg *config.Config) (int, string, string, error)

func RunRemoteCommandWithShell added in v1.0.0

func RunRemoteCommandWithShell(pool *desopssshpool.Pool, host, command, username string, cfg *config.Config, useShell bool) (int, string, string, error)

func SetLocalFileMode

func SetLocalFileMode(path, modeStr string) error

func SetRemoteFileMode

func SetRemoteFileMode(sftpClient *SftpClient, path, modeStr string) error

SetRemoteFileMode sets the mode of a remote file using a pooled SFTP client

func StatLocal

func StatLocal(path string, follow bool) (os.FileInfo, error)

StatLocal retrieves local file information. If follow is true, it follows symlinks (os.Stat). If follow is false, it stats the link itself (os.Lstat).

func StatRemote

func StatRemote(sftpClient *SftpClient, path string) (os.FileInfo, error)

StatRemote retrieves remote file information using a pooled SFTP client

func WriteLocalFile

func WriteLocalFile(filename string, data string) error

func WriteRemoteFile

func WriteRemoteFile(sftpClient *SftpClient, remotePath, data string) error

WriteRemoteFile writes data to a remote file using a pooled SFTP client

Types

type CommandOptions added in v1.0.0

type CommandOptions struct {
	Username        string
	UseShell        bool
	Interactive     bool
	UseSudo         bool
	SudoUser        string
	InteractiveSudo bool
	BecomeFlags     string
}

CommandOptions holds configuration for command execution

func NewCommandOptions added in v1.0.0

func NewCommandOptions(cfg *config.Config) *CommandOptions

NewCommandOptions creates a new CommandOptions with sensible defaults

func (*CommandOptions) WithInteractive added in v1.0.0

func (co *CommandOptions) WithInteractive() *CommandOptions

WithInteractive enables interactive execution

func (*CommandOptions) WithInteractiveSudo added in v1.0.0

func (co *CommandOptions) WithInteractiveSudo() *CommandOptions

WithInteractiveSudo enables interactive sudo

func (*CommandOptions) WithShell added in v1.0.0

func (co *CommandOptions) WithShell() *CommandOptions

WithShell enables shell execution

func (*CommandOptions) WithUsername added in v1.0.0

func (co *CommandOptions) WithUsername(username string) *CommandOptions

WithUsername sets the username for the command

type CommandResult added in v1.0.0

type CommandResult struct {
	Command  string
	ExitCode int
	Stdout   string
	Stderr   string
	Error    error
}

CommandResult represents the result of a command execution

type SftpClient added in v1.0.0

type SftpClient struct {
	*sftp.Client
	// contains filtered or unexported fields
}

SftpClient wraps an SFTP client with SSH client information

func (*SftpClient) Close added in v1.0.0

func (s *SftpClient) Close() error

Close closes the SFTP client

Jump to

Keyboard shortcuts

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