ssh

package
v0.0.0-...-cce2ad7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	RunCommand(ctx context.Context, command string) (string, error)
	Close() error
}

Connection represents a connection to a target system

func NewLocalConnection

func NewLocalConnection() Connection

NewLocalConnection creates a new local connection

func NewSSHConnection

func NewSSHConnection(ctx context.Context, config SSHConnectionConfig) (Connection, error)

NewSSHConnection creates a new SSH connection

type LocalConnection

type LocalConnection struct{}

LocalConnection represents a connection to the local system

func (*LocalConnection) Close

func (c *LocalConnection) Close() error

Close is a no-op for local connections

func (*LocalConnection) RunCommand

func (c *LocalConnection) RunCommand(ctx context.Context, command string) (string, error)

RunCommand runs a command on the local system

type SSHConnection

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

SSHConnection represents an SSH connection to a target system

func (*SSHConnection) Close

func (c *SSHConnection) Close() error

Close closes the SSH connection

func (*SSHConnection) RunCommand

func (c *SSHConnection) RunCommand(ctx context.Context, command string) (string, error)

RunCommand runs a command on the target system

type SSHConnectionConfig

type SSHConnectionConfig struct {
	Host     string
	Port     int
	User     string
	KeyFile  string
	Password string
}

SSHConnectionConfig represents the configuration for an SSH connection

Jump to

Keyboard shortcuts

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