ssh

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultKeyPath is the path to the cluster SSH private key inside containers
	DefaultKeyPath = "/var/run/cluster/cluster.key"

	// DefaultSSHPort is the port-forwarded SSH port for VMs
	DefaultSSHPort = "2222"

	// DefaultSSHUser is the default user for SSH connections
	DefaultSSHUser = "core"

	// DefaultSSHHost is the host for port-forwarded SSH connections
	DefaultSSHHost = "localhost"
)

Variables

This section is empty.

Functions

func EnsureHostKeys

func EnsureHostKeys(keyDir string) error

EnsureHostKeys checks that SSH keys exist on the host

Types

type Client

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

Client provides SSH operations for connecting to VMs via containers

func NewClient

func NewClient(cfg Config) *Client

NewClient creates a new SSH client

func NewClientForNode

func NewClientForNode(clusterName, nodeName string, logger interface{}) *Client

NewClientForNode creates a new SSH client for a given node

func (*Client) CopyTo

func (c *Client) CopyTo(ctx context.Context, localPath, remotePath string) error

CopyTo copies a file to the remote host via SCP

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, command string) (string, error)

Exec executes a command via SSH and returns stdout

func (*Client) ExecWithOutput

func (c *Client) ExecWithOutput(ctx context.Context, command string) error

ExecWithOutput executes a command via SSH, streaming output to stdout/stderr

func (*Client) Interactive

func (c *Client) Interactive(ctx context.Context) error

Interactive starts an interactive SSH session

func (*Client) WaitForSSH

func (c *Client) WaitForSSH(ctx context.Context, maxRetries int) error

WaitForSSH waits for SSH to become available using exponential backoff

type Config

type Config struct {
	ContainerName string // Podman container name
	Host          string // SSH host (usually "localhost" for port-forwarded VMs)
	Port          string // SSH port (usually "2222" for port-forwarded VMs)
	KeyPath       string // Path to SSH private key
	User          string // SSH user (usually "core")
	Logger        *logrus.Logger
	PodmanClient  *podman.Client // Podman client for container operations
}

Config holds SSH client configuration

Jump to

Keyboard shortcuts

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