ssh

package
v0.4.91 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHeight = 40
	DefaultWidth  = 80
)

Variables

This section is empty.

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
}

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