network

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package network implements the explicitly prepared shared network runtime. Selection never creates or starts a runtime. References fence every request against replacement of the selected service.

Index

Constants

View Source
const ReferenceEnvironment = "AGENT_WORKFLOW_NETWORK_REFERENCE"

ReferenceEnvironment carries the nonsecret reference admitted before provider launch.

View Source
const Registry = "/var/lib/agent-workflow/runtimes"
View Source
const RunRoot = "/run/agent-workflow-runtimes"
View Source
const SocketEnforcement = "bpf-lsm-unix-v1"

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, ref Reference) error

func CheckRetained

func CheckRetained(ctx context.Context, ref Reference) error

CheckRetained fences owned recovery against replacement without admitting new work.

func Completed

func Completed(ctx context.Context, ref Reference, id string) error

func Endpoint

func Endpoint(name, identity string) string

func Environment

func Environment(env []string, ref Reference) []string

Environment replaces inherited container selectors with the admitted endpoint.

func Prepare

func Prepare(name string, uid uint32) error

func PrepareProtected

func PrepareProtected(name string, uid uint32, enable bool, authentication []string) error

func Release

func Release(ctx context.Context, ref Reference, id string) error

func Reserve

func Reserve(ctx context.Context, ref Reference, id string) error

Reserve fences container creation against busy stop. Recovery releases this durable reservation only after exact container ownership/absence is proved.

func Start

func Start(name string) error

func ValidateName

func ValidateName(name string) error

func Wrap

func Wrap(cmd *exec.Cmd, ref Reference, id string) (func(), error)

Wrap rewrites an unstarted command to the shared launch client. Its streams, environment, directory and context remain owned by exec.Cmd. The service uses SO_PEERCRED, never caller-supplied user IDs. Run the returned cleanup after Wait/Run, including when Start fails.

Types

type Forward

type Forward struct {
	HostPort  int    `json:"host_port"`
	GuestPort int    `json:"guest_port"`
	UID       uint32 `json:"uid"`
	ID        int    `json:"id"`
}

type Membership

type Membership struct {
	ID       string `json:"id"`
	UID      uint32 `json:"uid"`
	State    string `json:"state"`
	ExitCode int    `json:"exit_code"`
}

type Reference

type Reference struct {
	Name       string `json:"name"`
	Identity   string `json:"identity"`
	Generation uint64 `json:"generation"`
	Endpoint   string `json:"endpoint"`
}

func Resolve

func Resolve(ctx context.Context, name string) (Reference, error)

func (Reference) Validate

func (r Reference) Validate() error

type Request

type Request struct {
	Operation string    `json:"operation"`
	Reference Reference `json:"reference"`
	ID        string    `json:"id,omitempty"`
	Path      string    `json:"path,omitempty"`
	Args      []string  `json:"args,omitempty"`
	Env       []string  `json:"env,omitempty"`
	Dir       string    `json:"dir,omitempty"`
	Forward   Forward   `json:"forward,omitempty"`
	Umask     int       `json:"umask,omitempty"`
	Terminal  bool      `json:"terminal,omitempty"`
}

func (Request) MarshalJSON

func (r Request) MarshalJSON() ([]byte, error)

MarshalJSON preserves native strings as bytes, including invalid UTF-8. A value receiver covers Request values nested inside launch metadata as well.

func (*Request) UnmarshalJSON

func (r *Request) UnmarshalJSON(data []byte) error

type Response

type Response struct {
	Status Status     `json:"status"`
	Member Membership `json:"member"`
	Error  string     `json:"error,omitempty"`
}

func Call

func Call(ctx context.Context, name string, req Request) (Response, error)

type Status

type Status struct {
	Reference         Reference             `json:"reference"`
	Healthy           bool                  `json:"healthy"`
	SocketEnforcement string                `json:"socket_enforcement"`
	NetworkNamespace  string                `json:"network_namespace"`
	Members           map[string]Membership `json:"members"`
	Forwards          []Forward             `json:"forwards"`
	MemberCount       int                   `json:"member_count"`
	ForwardCount      int                   `json:"forward_count"`
	MembersTruncated  bool                  `json:"members_truncated"`
	ForwardsTruncated bool                  `json:"forwards_truncated"`
}

Jump to

Keyboard shortcuts

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