agent

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolReconnectingPTY = "reconnecting-pty"
	ProtocolSSH             = "ssh"
	ProtocolDial            = "dial"
)

Variables

This section is empty.

Functions

func Bicopy added in v0.5.11

func Bicopy(ctx context.Context, c1, c2 io.ReadWriteCloser)

Bicopy copies all of the data between the two connections and will close them after one or both of them are done writing. If the context is canceled, both of the connections will be closed.

func ExpandRelativeHomePath added in v0.5.11

func ExpandRelativeHomePath(in string) (string, error)

ExpandRelativeHomePath expands the tilde at the beginning of a path to the current user's home directory and returns a full absolute path.

func New

func New(dialer Dialer, options *Options) io.Closer

Types

type Conn

type Conn struct {
	// Negotiator is responsible for exchanging messages.
	Negotiator proto.DRPCPeerBrokerClient

	*peer.Conn
}

Conn wraps a peer connection with helper functions to communicate with the agent.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) DialContext added in v0.5.11

func (c *Conn) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)

DialContext dials an arbitrary protocol+address from inside the workspace and proxies it through the provided net.Conn.

func (*Conn) ReconnectingPTY added in v0.5.2

func (c *Conn) ReconnectingPTY(id string, height, width uint16, command string) (net.Conn, error)

ReconnectingPTY returns a connection serving a TTY that can be reconnected to via ID.

The command is optional and defaults to start a shell.

func (*Conn) SSH

func (c *Conn) SSH() (net.Conn, error)

SSH dials the built-in SSH server.

func (*Conn) SSHClient

func (c *Conn) SSHClient() (*ssh.Client, error)

SSHClient calls SSH to create a client that uses a weak cipher for high throughput.

type Dialer

type Dialer func(ctx context.Context, logger slog.Logger) (Metadata, *peerbroker.Listener, error)

type Metadata added in v0.5.1

type Metadata struct {
	OwnerEmail           string            `json:"owner_email"`
	OwnerUsername        string            `json:"owner_username"`
	EnvironmentVariables map[string]string `json:"environment_variables"`
	StartupScript        string            `json:"startup_script"`
	Directory            string            `json:"directory"`
}

type Options

type Options struct {
	ReconnectingPTYTimeout time.Duration
	EnvironmentVariables   map[string]string
	Logger                 slog.Logger
}

type ReconnectingPTYRequest added in v0.5.2

type ReconnectingPTYRequest struct {
	Data   string `json:"data"`
	Height uint16 `json:"height"`
	Width  uint16 `json:"width"`
}

ReconnectingPTYRequest is sent from the client to the server to pipe data to a PTY.

Directories

Path Synopsis
Package reaper contains logic for reaping subprocesses.
Package reaper contains logic for reaping subprocesses.

Jump to

Keyboard shortcuts

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