transport

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package transport opens the guest↔host channel weft-init uses to stream pod status, container events, log chunks, and to receive control requests (stop, exec, restart) from weft-agent on the hypervisor host.

The transport is AF_VSOCK on Linux KVM and on Apple VZ guests (VZVirtioSocketDevice on the host side). Both expose the same kernel-level interface to the guest, so this code is the same for both backends.

Pure stdlib: we open AF_VSOCK via syscall.Socket and speak the raw socket. The weft-proto gRPC service runs over this socket; integration with grpc-go is done in cmd/weft-init wiring (a custom Dialer), not here.

Index

Constants

View Source
const (
	VsockCIDAny        = 0xffffffff // -1
	VsockCIDHypervisor = 0
	VsockCIDLocal      = 1
	VsockCIDHost       = 2
)

VsockCID values reserved by the kernel.

Variables

This section is empty.

Functions

func Dial

func Dial(cid, port uint32) (net.Conn, error)

Dial opens an AF_VSOCK connection to (cid, port) and wraps it in a *net.UnixConn-like net.Conn for use with grpc.WithDialer.

Typical use: Dial(VsockCIDHost, 5555) inside the guest to reach weft-agent on the hypervisor host.

func DialWithRetry

func DialWithRetry(cid, port uint32, attempts int, delay time.Duration) (net.Conn, error)

DialWithRetry retries Dial up to attempts times with the given per-attempt delay. The host side of vsock isn't always ready the instant the guest finishes booting ; a few hundred ms of retry covers the gap without baking in arbitrary sleeps.

Types

This section is empty.

Jump to

Keyboard shortcuts

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