MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / networking_from_proto

Function networking_from_proto

vmm/src/main_service.rs:203–227  ·  view source on GitHub ↗
(proto: &rpc::NetworkingConfig)

Source from the content-addressed store, hash-verified

201}
202
203fn networking_from_proto(proto: &rpc::NetworkingConfig) -> Option<crate::config::Networking> {
204 use crate::config::NetworkingMode;
205 let mode = match proto.mode.as_str() {
206 "bridge" => NetworkingMode::Bridge,
207
208 "user" => NetworkingMode::User,
209 "custom" => NetworkingMode::Custom,
210 "" => return None, // not set, use global default
211 other => {
212 tracing::warn!("unsupported per-VM networking mode '{other}', using global default");
213 return None;
214 }
215 };
216 // Only set mode; other fields will be merged from global config at runtime
217 Some(crate::config::Networking {
218 mode,
219 bridge: String::new(),
220 mac_prefix: String::new(),
221 net: String::new(),
222 dhcp_start: String::new(),
223 restrict: false,
224 netdev: String::new(),
225 forward_service_enabled: false,
226 })
227}
228
229impl RpcHandler {
230 fn resolve_gpus(&self, gpu_cfg: &rpc::GpuConfig) -> Result<GpuConfig> {

Callers

nothing calls this directly

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected