boxlite_shared/constants.rs
1//! Shared constants between host and guest
2//!
3//! These constants must be identical on both sides of the host-guest boundary.
4
5/// Container runtime constants
6pub mod container {
7 /// Default container hostname
8 pub const DEFAULT_HOSTNAME: &str = "boxlite";
9
10 /// Default RLIMIT_NOFILE soft limit
11 pub const RLIMIT_NOFILE_SOFT: u64 = 1024;
12
13 /// Default RLIMIT_NOFILE hard limit
14 pub const RLIMIT_NOFILE_HARD: u64 = 1024;
15}
16
17/// Network constants
18pub mod network {
19 /// Default vsock port for guest agent gRPC server
20 /// Port 2695 = "BOXL" on phone keypad
21 pub const GUEST_AGENT_PORT: u32 = 2695;
22
23 /// Vsock port for guest ready notification
24 /// Guest connects to this port to signal it's ready to serve
25 /// Port 2696 = "BOXM" on phone keypad
26 pub const GUEST_READY_PORT: u32 = 2696;
27}
28
29/// Executor environment variable
30///
31/// Used to specify which executor to use for command execution.
32pub mod executor {
33 /// Environment variable name for executor selection
34 pub const ENV_VAR: &str = "BOXLITE_EXECUTOR";
35
36 /// Value for guest executor (run directly on guest)
37 pub const GUEST: &str = "guest";
38
39 /// Key for container executor (format: "container")
40 pub const CONTAINER_KEY: &str = "container";
41}
42
43/// Virtiofs mount tags
44///
45/// These tags identify shared filesystems mounted via virtiofs.
46/// They must match between host (when creating shares) and guest (when mounting).
47pub mod mount_tags {
48 /// Tag for prepared rootfs virtiofs share (merged mode)
49 pub const ROOTFS: &str = "BoxLiteContainer0Rootfs";
50
51 /// Tag for image layers directory (mounted at container's diff dir)
52 pub const LAYERS: &str = "BoxLiteContainer0Layers";
53
54 /// Tag for shared container directory (contains overlayfs/ and rootfs/)
55 pub const SHARED: &str = "BoxLiteShared";
56}