agent

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

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

	// MagicSessionErrorCode indicates that something went wrong with the session, rather than the
	// command just returning a nonzero exit code, and is chosen as an arbitrary, high number
	// unlikely to shadow other exit codes, which are typically 1, 2, 3, etc.
	MagicSessionErrorCode = 229
)

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 New

func New(options Options) io.Closer

Types

type Client added in v0.11.0

type Client interface {
	WorkspaceAgentMetadata(ctx context.Context) (codersdk.WorkspaceAgentMetadata, error)
	ListenWorkspaceAgent(ctx context.Context) (net.Conn, error)
	AgentReportStats(ctx context.Context, log slog.Logger, stats func() *codersdk.AgentStats) (io.Closer, error)
	PostWorkspaceAgentAppHealth(ctx context.Context, req codersdk.PostWorkspaceAppHealthsRequest) error
	PostWorkspaceAgentVersion(ctx context.Context, version string) error
}

type Options

type Options struct {
	Filesystem             afero.Fs
	TempDir                string
	ExchangeToken          func(ctx context.Context) (string, error)
	Client                 Client
	ReconnectingPTYTimeout time.Duration
	EnvironmentVariables   map[string]string
	Logger                 slog.Logger
}

type PostWorkspaceAgentAppHealth added in v0.9.0

type PostWorkspaceAgentAppHealth func(context.Context, codersdk.PostWorkspaceAppHealthsRequest) error

PostWorkspaceAgentAppHealth updates the workspace app health.

type WorkspaceAgentApps added in v0.9.0

type WorkspaceAgentApps func(context.Context) ([]codersdk.WorkspaceApp, error)

WorkspaceAgentApps fetches the workspace apps.

type WorkspaceAppHealthReporter added in v0.9.0

type WorkspaceAppHealthReporter func(ctx context.Context)

WorkspaceAppHealthReporter is a function that checks and reports the health of the workspace apps until the passed context is canceled.

func NewWorkspaceAppHealthReporter added in v0.9.0

func NewWorkspaceAppHealthReporter(logger slog.Logger, apps []codersdk.WorkspaceApp, postWorkspaceAgentAppHealth PostWorkspaceAgentAppHealth) WorkspaceAppHealthReporter

NewWorkspaceAppHealthReporter creates a WorkspaceAppHealthReporter that reports app health to coderd.

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