agent

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Code generated by ./hack/generate-agent-binaries.py DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRunningRemoteCommand   = errors.New("error running remote command")
	ErrInstallingAgent        = errors.New("error installing agent")
	ErrConnectingToAgent      = errors.New("error connecting to agent")
	ErrAgentShutDown          = errors.New("agent shut down")
	ErrDisconnectingFromAgent = errors.New("error disconnecting from agent")
	ErrCallingRPCSystem       = errors.New("error calling RPC system")
	ErrStagingFile            = errors.New("error staging file")
)
View Source
var AgentBinary_linux_amd64_ []byte
View Source
var AgentBinary_linux_arm64_ []byte
View Source
var Tracer = otel.Tracer("mid/agent")

Functions

func Call

func Call[I any, O any](ctx context.Context, agent *Agent, call rpc.RPCCall[I]) (rpc.RPCResult[O], error)

func Connect

func Connect(ctx context.Context, agent *Agent) error

func GetAgentBinary

func GetAgentBinary(goos string, goarch string) ([]byte, error)

func InstallAgent

func InstallAgent(ctx context.Context, agent *Agent) error

func RunRemoteCommand

func RunRemoteCommand(ctx context.Context, agent *Agent, cmd string) ([]byte, error)

func StageFile added in v0.0.7

func StageFile(ctx context.Context, agent *Agent, f io.Reader) (string, error)

Types

type Agent

type Agent struct {
	RemotePid    atomic.Int64
	InstanceUUID string
	ConnectMutex sync.Mutex
	EncoderMutex sync.Mutex
	Client       *ssh.Client
	Session      *ssh.Session
	Encoder      *json.Encoder
	Decoder      *json.Decoder
	Running      atomic.Bool
	WaitGroup    sync.WaitGroup
	InFlight     syncmap.Map[string, chan rpc.RPCResult[any]]
}

func (*Agent) Disconnect

func (agent *Agent) Disconnect(ctx context.Context, wait bool) error

func (*Agent) EnsureUUID added in v0.0.8

func (agent *Agent) EnsureUUID() (string, error)

func (*Agent) GetLogger added in v0.0.7

func (agent *Agent) GetLogger(ctx context.Context) *slog.Logger

func (*Agent) Heartbeat added in v0.0.8

func (agent *Agent) Heartbeat(timeout time.Duration) (time.Duration, bool)

func (*Agent) Ping added in v0.0.8

func (agent *Agent) Ping(ctx context.Context) (rpc.AgentPingResult, error)

func (*Agent) RunHeartbeat added in v0.0.8

func (agent *Agent) RunHeartbeat()

func (*Agent) RunLocal added in v0.0.7

func (agent *Agent) RunLocal()

Directories

Path Synopsis
Code generated by ./hack/generate-ansible-types.py DO NOT EDIT
Code generated by ./hack/generate-ansible-types.py DO NOT EDIT
cmd
mid-agent command
rpc

Jump to

Keyboard shortcuts

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