silkdtest

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package silkdtest fakes a silkd daemon for host-side tests: deterministic frame semantics over any listener, plus the hybrid-vsock muxer handshake for tests that dial a UDS the way sandboxd does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenHybrid

func ListenHybrid(sockPath string, port int) (io.Closer, error)

ListenHybrid serves the muxer handshake on a UDS: each connection must open with "CONNECT <port>", is answered "OK <port>", then speaks the Serve protocol. The returned closer stops the listener.

func Serve

func Serve(l net.Listener)

Serve accepts connections until l closes, speaking one RPC per connection and closing it after the terminal frame, like silkd. Semantics: info → InfoResp; exec echo → stdout of the args; exec cat → echoes stdin frames until stdin_close; exec false → exit 1; exec sleep → started, then blocks until the client disconnects; anything else → an error frame.

func ServeConn

func ServeConn(conn net.Conn)

ServeConn speaks one RPC on an already-open connection and closes it — for tests that produce the conn themselves (e.g. after an HTTP hijack).

Types

type Fake

type Fake struct {
	Root string
	// contains filtered or unexported fields
}

Fake is a stateful silkd fake backing the fs verbs with a real directory and tracking sessions, so an SDK write-then-read round-trips through it. exec/info reuse the stateless handlers. It exists for host-side unit tests; the authoritative fs/session behavior is silkd's own Rust test suite.

func NewFake

func NewFake(root string) *Fake

NewFake returns a Fake serving files under root.

func (*Fake) ServeConn

func (f *Fake) ServeConn(conn net.Conn)

ServeConn speaks one RPC on an already-open connection (e.g. after an HTTP hijack) and closes it.

Jump to

Keyboard shortcuts

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