Documentation
¶
Overview ¶
Package remoteexec executes broker requests on a remote backend. It receives command, environment, stream, signal, and extra-fd requests from broker, and feeds remote sessions or mproxy-agent over agentproto while returning stdout, stderr, and exit status to the broker.
Index ¶
- type AgentRunner
- func (r *AgentRunner) EnumeratePaths(ctx context.Context, paths []string) ([]agentproto.PathInfoEntry, error)
- func (r *AgentRunner) Run(ctx context.Context, req Request, stdin io.Reader, stdout io.Writer, ...) (int, error)
- func (r *AgentRunner) RunWithControl(ctx context.Context, req Request, ctrl *Control) (int, error)
- type Control
- type ExitCoder
- type Request
- type Runner
- type RunnerFunc
- type SSHRunner
- type SessionProvider
- type SignalableRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentRunner ¶
type AgentRunner struct {
Provider SessionProvider
Transferer *agenttransfer.Transferer
Recorder *agentproto.Recorder // nil disables recording
AgentConfig *agentproto.AgentConfig // sent to agent before exec; nil skips
Log *slog.Logger
}
AgentRunner executes remote commands by launching the mproxy-agent binary on the remote host and communicating over CBOR mux.
func (*AgentRunner) EnumeratePaths ¶ added in v1.1.0
func (r *AgentRunner) EnumeratePaths(ctx context.Context, paths []string) ([]agentproto.PathInfoEntry, error)
EnumeratePaths asks the remote agent to enumerate executables reachable through the given PATH-style directories. An empty paths slice tells the agent to use its own $PATH. The session is short- lived: the agent sends one FramePathInfo and exits.
func (*AgentRunner) RunWithControl ¶
RunWithControl extends Run with signal forwarding and extra fd bridging.
type Control ¶
type Control struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Signals <-chan int
ExtraFDs map[uint32]io.ReadWriteCloser
}
Control provides additional channels for signal delivery and extra file descriptor bridging beyond basic stdin/stdout/stderr.
type ExitCoder ¶ added in v1.2.0
type ExitCoder interface {
ExitStatus() int
}
ExitCoder is satisfied by errors that carry a remote process exit code. Backend session adapters wrap their native error type (e.g. *ssh.ExitError) so the runner doesn't need backend-specific imports.
type Runner ¶
type Runner interface {
Run(ctx context.Context, req Request, stdin io.Reader, stdout io.Writer, stderr io.Writer) (int, error)
}
Runner executes a request and writes command output to stdout/stderr. It returns the process exit code and an error if the request could not be started.
type RunnerFunc ¶
type SSHRunner ¶
type SSHRunner struct {
Provider SessionProvider
}
type SessionProvider ¶
SessionProvider creates remote command sessions. Satisfied by any remote.Backend.