MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validate_openshell_endpoint

Function validate_openshell_endpoint

crates/openshell-driver-vm/src/driver.rs:350–370  ·  view source on GitHub ↗
(endpoint: &str)

Source from the content-addressed store, hash-verified

348}
349
350fn validate_openshell_endpoint(endpoint: &str) -> Result<(), String> {
351 let url = Url::parse(endpoint)
352 .map_err(|err| format!("invalid openshell endpoint '{endpoint}': {err}"))?;
353 let Some(host) = url.host() else {
354 return Err(format!("openshell endpoint '{endpoint}' is missing a host"));
355 };
356
357 let invalid_from_vm = match host {
358 Host::Domain(_) => false,
359 Host::Ipv4(ip) => ip.is_unspecified(),
360 Host::Ipv6(ip) => ip.is_unspecified(),
361 };
362
363 if invalid_from_vm {
364 return Err(format!(
365 "openshell endpoint '{endpoint}' is not reachable from sandbox VMs; use a concrete host such as 127.0.0.1, {OPENSHELL_HOST_GATEWAY_ALIAS}, or another routable address"
366 ));
367 }
368
369 Ok(())
370}
371
372#[derive(Debug)]
373struct VmProcess {

Calls

no outgoing calls