ssh

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultHeight = 40
	DefaultWidth  = 80
)

Variables

View Source
var ErrExecRejected = errors.New("the server rejected the command")

ErrExecRejected is returned when the server refuses to run a command.

Functions

func MarshalED25519PrivateKey added in v0.0.452

func MarshalED25519PrivateKey(key ed25519.PrivateKey, comment string) []byte

// stolen from `mikesmitty`, thanks, you are a mikesmitty and a scholar

Types

type Client

type Client struct {
	Addr string
	User string

	Dial func(ctx context.Context, network, addr string) (net.Conn, error)

	PrivateKey, Certificate string

	Client *ssh.Client
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

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

func (*Client) SFTP added in v0.4.87

func (c *Client) SFTP(ctx context.Context, target SessionTarget, opts ...sftp.ClientOption) (*sftp.Client, error)

SFTP opens an SFTP client against the session target: a container's filesystem, or the machine's own. The target has to be set on the session carrying the subsystem, and sftp.NewClient opens a session of its own with nothing set on it -- so the session is built here, where the target already gets set for shells.

Closing the returned client closes that session with it.

func (*Client) Shell

func (c *Client) Shell(ctx context.Context, sessIO *SessionIO, cmd string, target SessionTarget) error

type FdReader

type FdReader interface {
	io.Reader
	Fd() uintptr
}

FdReader is an io.Reader with an Fd function

type SessionIO added in v0.0.504

type SessionIO struct {
	Stdin  io.Reader
	Stdout io.WriteCloser
	Stderr io.WriteCloser

	AllocPTY  bool
	TermEnv   string
	OnStarted func()
}

type SessionTarget added in v0.4.83

type SessionTarget struct {
	// Container names the container to run in. When empty, the machine decides
	// where the session lands.
	Container string

	// Machine runs the session in the machine's own namespace instead of in a
	// container. It is mutually exclusive with Container.
	Machine bool
}

SessionTarget selects where a session runs on the remote machine.

Jump to

Keyboard shortcuts

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