smolvm_protocol/guest_env.rs
1//! Shared environment-variable contract between the host launcher and guest agent.
2//!
3//! These names form the protocol boundary between:
4//! - the host-side launcher, which decides what features to enable
5//! - the guest agent, which reads these vars on startup and acts accordingly
6//!
7//! They should be treated as stable protocol constants rather than ad hoc
8//! launcher strings.
9
10/// Standard "enabled" value for boolean `SMOLVM_*` sentinel env vars.
11///
12/// The host writes this when a feature is enabled; the guest agent
13/// compares against it. A single canonical value prevents `true` / `yes` /
14/// `1` mismatches between the two sides.
15pub const VALUE_ON: &str = "1";
16
17/// Env var the host sets on guest init to signal GPU acceleration was requested.
18///
19/// Present means "host asked for GPU"; the guest agent reads this and emits a
20/// post-boot sanity log confirming whether `/dev/dri/*` nodes actually appeared.
21/// Absent means no GPU was requested.
22///
23/// This is a boolean sentinel — the value is [`VALUE_ON`] when set.
24pub const GPU: &str = "SMOLVM_GPU";
25
26/// Selects whether the guest should configure a real virtio NIC.
27pub const BACKEND: &str = "SMOLVM_NETWORK_BACKEND";
28/// Canonical backend value meaning "configure guest virtio-net".
29pub const BACKEND_VIRTIO_NET: &str = "virtio-net";
30/// Guest IPv4 address.
31pub const GUEST_IP: &str = "SMOLVM_NETWORK_GUEST_IP";
32/// Guest-visible default gateway IPv4 address.
33pub const GATEWAY: &str = "SMOLVM_NETWORK_GATEWAY";
34/// Guest subnet prefix length.
35pub const PREFIX_LEN: &str = "SMOLVM_NETWORK_PREFIX_LEN";
36/// Guest MAC address in colon-separated string form.
37pub const GUEST_MAC: &str = "SMOLVM_NETWORK_GUEST_MAC";
38/// Guest-visible DNS server IPv4 address.
39pub const DNS: &str = "SMOLVM_NETWORK_DNS";
40/// Enables the guest-side DNS filtering proxy.
41pub const DNS_FILTER: &str = "SMOLVM_DNS_FILTER";