agent

package
v2.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

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

EnvAgentSubsystem is the environment variable used to denote the specialized environment in which the agent is running (e.g. envbox, envbuilder).

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	HTTPDebug() http.Handler
	// TailnetConn may be nil.
	TailnetConn() *tailnet.Conn
	io.Closer
}

func New

func New(options Options) Agent

type Client

type Client interface {
	Manifest(ctx context.Context) (agentsdk.Manifest, error)
	Listen(ctx context.Context) (net.Conn, error)
	DERPMapUpdates(ctx context.Context) (<-chan agentsdk.DERPMapUpdate, io.Closer, error)
	ReportStats(ctx context.Context, log slog.Logger, statsChan <-chan *agentsdk.Stats, setInterval func(time.Duration)) (io.Closer, error)
	PostLifecycle(ctx context.Context, state agentsdk.PostLifecycleRequest) error
	PostAppHealth(ctx context.Context, req agentsdk.PostAppHealthsRequest) error
	PostStartup(ctx context.Context, req agentsdk.PostStartupRequest) error
	PostMetadata(ctx context.Context, key string, req agentsdk.PostMetadataRequest) error
	PatchLogs(ctx context.Context, req agentsdk.PatchLogs) error
	GetServiceBanner(ctx context.Context) (codersdk.ServiceBannerConfig, error)
}

type Options

type Options struct {
	Filesystem                   afero.Fs
	LogDir                       string
	TempDir                      string
	ExchangeToken                func(ctx context.Context) (string, error)
	Client                       Client
	ReconnectingPTYTimeout       time.Duration
	EnvironmentVariables         map[string]string
	Logger                       slog.Logger
	IgnorePorts                  map[int]string
	SSHMaxTimeout                time.Duration
	TailnetListenPort            uint16
	Subsystems                   []codersdk.AgentSubsystem
	Addresses                    []netip.Prefix
	PrometheusRegistry           *prometheus.Registry
	ReportMetadataInterval       time.Duration
	ServiceBannerRefreshInterval time.Duration
}

type PostWorkspaceAgentAppHealth

type PostWorkspaceAgentAppHealth func(context.Context, agentsdk.PostAppHealthsRequest) error

PostWorkspaceAgentAppHealth updates the workspace app health.

type WorkspaceAgentApps

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

WorkspaceAgentApps fetches the workspace apps.

type WorkspaceAppHealthReporter

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

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