pub struct SmoltcpNetwork { /* private fields */ }Expand description
The networking engine. Created from NetworkConfig by the runtime.
Owns the smoltcp poll thread and provides:
take_backend()— theNetBackendforVmBuilder::net()guest_env_vars()—MSB_NET*env vars for the guestca_cert_pem()— CA certificate for TLS interception
Implementations§
Source§impl SmoltcpNetwork
impl SmoltcpNetwork
Sourcepub fn new(config: NetworkConfig, slot: u64) -> Self
pub fn new(config: NetworkConfig, slot: u64) -> Self
Create from user config + sandbox slot (for IP/MAC derivation).
§Panics
Panics if slot exceeds the address pool capacity (65535 for MAC/IPv6,
524287 for IPv4).
Sourcepub fn start(&mut self, tokio_handle: Handle)
pub fn start(&mut self, tokio_handle: Handle)
Start the smoltcp poll thread.
Must be called before VM boot. Requires a tokio runtime handle for spawning proxy tasks, DNS resolution, and published port listeners.
Sourcepub fn take_backend(&mut self) -> Box<dyn NetBackend + Send>
pub fn take_backend(&mut self) -> Box<dyn NetBackend + Send>
Take the NetBackend for VmBuilder::net(). One-shot.
Sourcepub fn guest_env_vars(&self) -> Vec<(String, String)>
pub fn guest_env_vars(&self) -> Vec<(String, String)>
Generate MSB_NET* environment variables for the guest.
The guest init (agentd) reads these to configure the network
interface via ioctls + netlink.
Sourcepub fn ca_cert_pem(&self) -> Option<Vec<u8>>
pub fn ca_cert_pem(&self) -> Option<Vec<u8>>
CA certificate PEM bytes if TLS interception is enabled.
Write to the runtime mount before VM boot so the guest can trust it.
Sourcepub fn termination_handle(&self) -> TerminationHandle
pub fn termination_handle(&self) -> TerminationHandle
Create a handle for wiring runtime termination into the network stack.
Sourcepub fn metrics_handle(&self) -> MetricsHandle
pub fn metrics_handle(&self) -> MetricsHandle
Create a handle for reading aggregate network byte counters.