vsock

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialFirecracker

func DialFirecracker(ctx context.Context, udsPath string, port uint32) (net.Conn, error)

DialFirecracker connects to a Firecracker microVM vsock port using its Unix Domain Socket. Firecracker abstracts vsock devices behind a host-side UDS. To connect to a guest port, the host must dial the UDS and perform a plaintext protocol handshake.

func Execute

func Execute(ctx context.Context, conn net.Conn, payload ExecPayload, stdout io.Writer) error

Execute sends the ExecPayload to the guest vsock server over the given connection, and streams the resulting output strictly to the provided writers. Since standard Go exec.Cmd combines stdout and stderr if we just wire them both to the same net.Conn on the guest, we stream everything from the connection into the stdout writer here (unless the guest agent multiplexes them with headers, which is out of scope for now).

Types

type ExecPayload

type ExecPayload struct {
	Command []string `json:"command"`
	Env     []string `json:"env,omitempty"`
}

ExecPayload defines the JSON structure sent to the guest-agent to trigger a command.

Jump to

Keyboard shortcuts

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