ssh

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client manages an SSH connection to a specific remote host.

func New

func New(logger zerolog.Logger, host string, opts ...SSHOption) (*Client, error)

New creates a new SSH client and establishes a multiplexed connection to the host.

func (*Client) Close

func (c *Client) Close()

Close closes the SSH connection and cleans up the control socket.

func (*Client) ControlPath

func (c *Client) ControlPath() string

ControlPath returns the SSH control socket path.

func (*Client) CopyBinaryToRemote

func (c *Client) CopyBinaryToRemote(localPath, remoteBaseDir string) (string, error)

CopyBinaryToRemote copies a local binary to the remote host and makes it executable.

func (*Client) DetectSystem

func (c *Client) DetectSystem() (string, string, error)

DetectSystem detects the OS and architecture of the remote system.

func (*Client) GetRemoteRepositoryDir

func (c *Client) GetRemoteRepositoryDir() (string, error)

GetRemoteRepositoryDir determines the remote directory path for the current repository.

func (*Client) Host

func (c *Client) Host() string

Host returns the remote host this client is connected to.

func (*Client) Run

func (c *Client) Run(command string, optFuncs ...RunOption) error

RunCommand executes a command on the remote host and returns the output.

func (*Client) RunCommand

func (c *Client) RunCommand(command string, optFuncs ...RunOption) (string, string, error)

RunCommand executes a command on the remote host and returns the output.

func (*Client) SyncDirectoryToRemote

func (c *Client) SyncDirectoryToRemote(remoteBaseDir string) (string, error)

SyncDirectoryToRemote syncs the current git working tree to the remote host.

type RunOption

type RunOption func(*runOptions)

func WithStdErr

func WithStdErr(w io.Writer) RunOption

func WithStdIn

func WithStdIn(r io.Reader) RunOption

func WithStdOut

func WithStdOut(w io.Writer) RunOption

func WithTTY

func WithTTY(tty bool) RunOption

type SSHOption

type SSHOption func(*Client)

SSHOption is a function that configures an SSH client.

func WithExtraOptions

func WithExtraOptions(options ...string) SSHOption

WithExtraOptions adds extra SSH options to the connection.

func WithIdentityFile

func WithIdentityFile(path string) SSHOption

WithIdentityFile sets the identity file (private key) to use for authentication.

func WithKnownHostsFile

func WithKnownHostsFile(path string) SSHOption

WithKnownHostsFile sets the known hosts file to use for host verification.

func WithProxyCommand

func WithProxyCommand(command string) SSHOption

WithProxyCommand sets a proxy command for the SSH connection.

Jump to

Keyboard shortcuts

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