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

Function uses_host_gateway_alias

crates/openshell-driver-docker/src/lib.rs:2505–2535  ·  view source on GitHub ↗

Detect Docker Desktop and behaviourally compatible runtimes - Colima, Lima, Rancher Desktop, and `OrbStack` - that share Docker Desktop's routing constraint: the bridge gateway IP is reachable from inside containers but not from the `OpenShell` server process running on the host, so callbacks must traverse `host-gateway`. Each runtime is detected via the daemon's reported OS string or hostname, s

(info: &SystemInfo)

Source from the content-addressed store, hash-verified

2503/// Each runtime is detected via the daemon's reported OS string or hostname,
2504/// supplemented by labels where the runtime publishes them.
2505fn uses_host_gateway_alias(info: &SystemInfo) -> bool {
2506 let operating_system = info
2507 .operating_system
2508 .as_deref()
2509 .unwrap_or_default()
2510 .to_ascii_lowercase();
2511 if operating_system.contains("docker desktop") {
2512 return true;
2513 }
2514
2515 let name = info
2516 .name
2517 .as_deref()
2518 .unwrap_or_default()
2519 .to_ascii_lowercase();
2520 if name.starts_with("colima")
2521 || name.starts_with("lima-")
2522 || name.starts_with("rancher-desktop")
2523 || name.starts_with("orbstack")
2524 {
2525 return true;
2526 }
2527
2528 info.labels.as_ref().is_some_and(|labels| {
2529 labels.iter().any(|label| {
2530 label.starts_with("com.docker.desktop.")
2531 || label.starts_with("dev.rancherdesktop.")
2532 || label.starts_with("dev.orbstack.")
2533 })
2534 })
2535}
2536
2537fn docker_extra_hosts(route: &DockerGatewayRoute) -> Vec<String> {
2538 match route {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected