broker

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamStdin  = "stdin"
	StreamStdout = "stdout"
	StreamStderr = "stderr"
	StreamExit   = "exit"
	StreamSignal = "signal"

	// StreamFDPrefix is used for extra file descriptor streams.
	// The full stream name is "fd:N" where N is the fd number.
	StreamFDPrefix = "fd:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads CBOR-encoded values from an io.Reader.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a Decoder that reads CBOR frames/requests from r.

func (*Decoder) Decode

func (d *Decoder) Decode(v any) error

Decode reads the next CBOR-encoded value into v.

type Deps

type Deps struct {
	Remote    remoteexec.Runner
	EnvFilter func(env []string) []string // nil means pass through unfiltered
	// PathMapper translates container-local paths to remote-side paths.
	// Used to rewrite Cwd and Path when ContainerPath != RemotePath.
	PathMapper func(string) string // nil means no translation
	Log        *slog.Logger
}

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder writes CBOR-encoded values to an io.Writer. Safe for concurrent use.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns an Encoder that writes CBOR frames/requests to w.

func (*Encoder) Encode

func (e *Encoder) Encode(v any) error

Encode writes a single CBOR-encoded value.

type ExecRequest

type ExecRequest = remoteexec.Request

type Frame

type Frame struct {
	Stream string `cbor:"stream"`
	Data   []byte `cbor:"data,omitempty"`
	Code   int    `cbor:"code,omitempty"`
	Error  string `cbor:"error,omitempty"`
	Signal int    `cbor:"signal,omitempty"`
}

Frame is a single CBOR-encoded message exchanged between the shim and the broker over the Unix socket.

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(deps Deps) *Server

func (*Server) Start

func (s *Server) Start(ctx context.Context, socketPath string) error

Jump to

Keyboard shortcuts

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