Documentation
¶
Index ¶
- func EscapeArg(arg string) string
- func EscapeArgs(args []string) []string
- type Config
- type Connector
- func (c *Connector) BuildSCPArgs() []string
- func (c *Connector) BuildSSHArgs() []string
- func (c *Connector) CopyFile(ctx context.Context, localPath, remotePath string) error
- func (c *Connector) CopyFileFromRemote(ctx context.Context, remotePath, localPath string) error
- func (c *Connector) ExecuteCommand(ctx context.Context, command string) (string, error)
- func (c *Connector) ExecuteCommandWithExitCode(ctx context.Context, command string) (string, int, error)
- func (c *Connector) FileExists(ctx context.Context, remotePath string) (bool, error)
- func (c *Connector) GetTarget() string
- func (c *Connector) MakeExecutable(ctx context.Context, remotePath string) error
- func (c *Connector) RemoveFile(ctx context.Context, remotePath string) error
- func (c *Connector) TestConnection(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeArg ¶
EscapeArg escapes a single argument for shell execution. This prevents shell injection by properly escaping special characters.
func EscapeArgs ¶
EscapeArgs escapes multiple arguments for shell execution.
Types ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector provides SSH connectivity functionality.
func (*Connector) BuildSCPArgs ¶
BuildSCPArgs builds SCP arguments for file transfer.
func (*Connector) BuildSSHArgs ¶
BuildSSHArgs builds common SSH arguments.
func (*Connector) CopyFileFromRemote ¶
CopyFileFromRemote copies a file from the remote host to local.
func (*Connector) ExecuteCommand ¶
ExecuteCommand executes a command on the remote host.
func (*Connector) ExecuteCommandWithExitCode ¶
func (c *Connector) ExecuteCommandWithExitCode(ctx context.Context, command string) (string, int, error)
ExecuteCommandWithExitCode executes a command and returns output with exit code.
func (*Connector) FileExists ¶
FileExists checks if a file exists on the remote host.
func (*Connector) MakeExecutable ¶
MakeExecutable makes a file executable on the remote host.
func (*Connector) RemoveFile ¶
RemoveFile removes a file on the remote host.