agent

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnHandler

type ConnHandler func(params json.RawMessage, conn io.ReadWriter) (interface{}, error)

ConnHandler handles a request that needs the connection for binary I/O.

type Dispatcher

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

Dispatcher routes JSON-RPC methods to handlers.

func NewDispatcher

func NewDispatcher() *Dispatcher

NewDispatcher creates a dispatcher wired to all handlers.

func (*Dispatcher) CryptoSession

func (d *Dispatcher) CryptoSession() *crypto.Session

CryptoSession returns the negotiated crypto session, or nil if E2E is not active.

func (*Dispatcher) Handle

func (d *Dispatcher) Handle(req *proto.Request, rw io.ReadWriter)

Handle dispatches a JSON-RPC request and writes the response.

func (*Dispatcher) PtyManager

func (d *Dispatcher) PtyManager() *process.PtyManager

PtyManager returns the PTY manager for binary frame routing.

type Server

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

Server is the TCP server for the guest agent.

func NewServer

func NewServer(addr string) *Server

NewServer creates a new agent server. If SANDBOX_AUTH_TOKEN is set, clients must authenticate before sending commands.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts a TCP listener on the configured address and serves connections.

func (*Server) Serve

func (s *Server) Serve(ln net.Listener) error

Serve accepts connections on the given listener. This enables the agent to serve over any transport (TCP, vsock, Unix socket) by passing the appropriate listener.

type SimpleHandler

type SimpleHandler func(params json.RawMessage) (interface{}, error)

SimpleHandler handles a request that only needs params and returns a result.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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