ssh

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (transport.Transport, error)

New creates a new SSH Transport and connects to the remote host.

Types

type Config

type Config struct {
	Host string
	Port int
	User string

	Password string

	PrivateKey     []byte
	PrivateKeyPath string
	Passphrase     []byte

	KnownHostsPath        string
	InsecureIgnoreHostKey bool

	Timeout time.Duration
}

Config holds the configuration for connecting to an SSH server.

func (Config) String

func (c Config) String() string

String returns a safe representation of the config with secrets removed.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the config for required fields and defaults.

type Transport

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

Transport is an SSH-based transport that executes commands on a remote host and transfers files via SFTP.

func (*Transport) Close

func (t *Transport) Close(ctx context.Context) error

Close closes the underlying SSH client connection. It is safe to call multiple times; subsequent calls are no-ops.

func (*Transport) Download

Download copies a remote file to the local host via SFTP.

func (*Transport) Exec

Exec runs a command on the remote host via SSH.

func (*Transport) Upload

Upload copies a local file to the remote host via SFTP.

Jump to

Keyboard shortcuts

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