remoteexec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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) Run

func (r *AgentRunner) Run(ctx context.Context, req Request, stdin io.Reader, stdout io.Writer, stderr io.Writer) (int, error)

func (*AgentRunner) RunWithControl

func (r *AgentRunner) RunWithControl(ctx context.Context, req Request, ctrl *Control) (int, error)

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 Request

type Request struct {
	Path     string   `cbor:"path"`
	Argv     []string `cbor:"argv"`
	Env      []string `cbor:"env"`
	Cwd      string   `cbor:"cwd"`
	ExtraFDs []uint32 `cbor:"extra_fds,omitempty"`
}

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 RunnerFunc func(ctx context.Context, req Request, stdin io.Reader, stdout io.Writer, stderr io.Writer) (int, error)

func (RunnerFunc) Run

func (f RunnerFunc) Run(ctx context.Context, req Request, stdin io.Reader, stdout io.Writer, stderr io.Writer) (int, error)

type SSHRunner

type SSHRunner struct {
	Provider SessionProvider
}

func (*SSHRunner) Run

func (r *SSHRunner) Run(ctx context.Context, req Request, stdin io.Reader, stdout io.Writer, stderr io.Writer) (int, error)

type SessionProvider

type SessionProvider interface {
	NewSession(ctx context.Context) (sshconn.Session, error)
}

SessionProvider creates SSH sessions. Typically satisfied by *sshconn.Manager.

type SignalableRunner

type SignalableRunner interface {
	Runner
	RunWithControl(ctx context.Context, req Request, ctrl *Control) (int, error)
}

SignalableRunner extends Runner with signal and extra fd support.

Jump to

Keyboard shortcuts

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