Movatterモバイル変換


[0]ホーム

URL:


agent

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:60Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
const (ProtocolReconnectingPTY = "reconnecting-pty"ProtocolSSH             = "ssh"ProtocolDial            = "dial")
View Source
const (EnvProcPrioMgmt = "CODER_PROC_PRIO_MGMT"EnvProcOOMScore = "CODER_PROC_OOM_SCORE")

EnvProcPrioMgmt determines whether we attempt to manageprocess CPU and OOM Killer priority.

View Source
const EnvAgentSubsystem = "CODER_AGENT_SUBSYSTEM"

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

Variables

View Source
var WindowsDriveRegex =regexp.MustCompile(`^[a-zA-Z]:\\$`)

Functions

funcPrometheusMetricsHandleradded inv2.10.0

func PrometheusMetricsHandler(prometheusRegistry *prometheus.Registry, loggerslog.Logger)http.Handler

funcSSHKeySeedadded inv2.22.0

func SSHKeySeed(userName, workspaceName, agentNamestring) (int64,error)

SSHKeySeed converts an owner userName, workspaceName and agentName to an int64 hash.This uses the FNV-1a hash algorithm which provides decent distribution and collisionresistance for string inputs.

Why owner username, workspace name, and agent name? These are the components that are used in hostnames for theworkspace over SSH, and so we want the workspace to have a stable key with respect to these. We don't use therespective UUIDs. The workspace UUID would be different if you delete and recreate a workspace with the same name.The agent UUID is regenerated on each build. Since Coder's Tailnet networking is handling the authentication, weshould not be showing users warnings about host SSH keys.

Types

typeAgent

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

funcNew

func New(optionsOptions)Agent

typeClient

type Client interface {ConnectRPC25(ctxcontext.Context) (proto.DRPCAgentClient25,tailnetproto.DRPCTailnetClient25,error,)RewriteDERPMap(derpMap *tailcfg.DERPMap)}

typeLSFileadded inv2.21.0

type LSFile struct {Namestring `json:"name"`// e.g. "C:\\Users\\coder\\hello.txt"//      "/home/coder/hello.txt"AbsolutePathStringstring `json:"absolute_path_string"`IsDirbool   `json:"is_dir"`}

typeLSRelativityadded inv2.21.0

type LSRelativitystring
const (LSRelativityRootLSRelativity = "root"LSRelativityHomeLSRelativity = "home")

typeLSRequestadded inv2.21.0

type LSRequest struct {// e.g. [], ["repos", "coder"],Path []string `json:"path"`// Whether the supplied path is relative to the user's home directory,// or the root directory.RelativityLSRelativity `json:"relativity"`}

typeLSResponseadded inv2.21.0

type LSResponse struct {AbsolutePath []string `json:"absolute_path"`// Returned so clients can display the full path to the user, and// copy it to configure file sync// e.g. Windows: "C:\\Users\\coder"//      Linux: "/home/coder"AbsolutePathStringstring   `json:"absolute_path_string"`Contents           []LSFile `json:"contents"`}

typeOptions

type Options struct {Filesystemafero.FsLogDirstringTempDirstringScriptDataDirstringExchangeToken                func(ctxcontext.Context) (string,error)ClientClientReconnectingPTYTimeouttime.DurationEnvironmentVariables         map[string]stringLoggerslog.LoggerIgnorePorts                  map[int]stringPortCacheDurationtime.DurationSSHMaxTimeouttime.DurationTailnetListenPortuint16Subsystems                   []codersdk.AgentSubsystemPrometheusRegistry           *prometheus.RegistryReportMetadataIntervaltime.DurationServiceBannerRefreshIntervaltime.DurationBlockFileTransferboolExeceragentexec.ExecerExperimentalDevcontainersEnabledboolContainerAPIOptions              []agentcontainers.Option// Enable ExperimentalDevcontainersEnabled for these to be effective.}

typePostWorkspaceAgentAppHealth

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

PostWorkspaceAgentAppHealth updates the workspace app health.

typeWorkspaceAppHealthReporter

type WorkspaceAppHealthReporter func(ctxcontext.Context)

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

funcNewAppHealthReporterWithClockadded inv2.13.0

func NewAppHealthReporterWithClock(loggerslog.Logger,apps []codersdk.WorkspaceApp,postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth,clkquartz.Clock,)WorkspaceAppHealthReporter

NewAppHealthReporterWithClock is only called directly by test code. Product code should callNewAppHealthReporter.

funcNewWorkspaceAppHealthReporter

func NewWorkspaceAppHealthReporter(loggerslog.Logger, apps []codersdk.WorkspaceApp, postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth)WorkspaceAppHealthReporter

NewWorkspaceAppHealthReporter creates a WorkspaceAppHealthReporter that reports app health to coderd.

Source Files

View all Source files

Directories

PathSynopsis
acmock
Package acmock is a generated GoMock package.
Package acmock is a generated GoMock package.
dcspec
Package dcspec contains an automatically generated Devcontainer specification.
Package dcspec contains an automatically generated Devcontainer specification.
watcher
Package watcher provides file system watching capabilities for the agent.
Package watcher provides file system watching capabilities for the agent.
Package reaper contains logic for reaping subprocesses.
Package reaper contains logic for reaping subprocesses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp