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

Method network_gateway_ip

crates/openshell-driver-podman/src/client.rs:541–555  ·  view source on GitHub ↗

Inspect a network and return the gateway IP of its first subnet. The gateway IP is the host's address on the bridge network, used by sandbox containers to call back to the gateway server.

(&self, name: &str)

Source from the content-addressed store, hash-verified

539 /// The gateway IP is the host's address on the bridge network, used by
540 /// sandbox containers to call back to the gateway server.
541 pub async fn network_gateway_ip(&self, name: &str) -> Result<Option<String>, PodmanApiError> {
542 validate_name(name)?;
543 let encoded = url_encode(name);
544 let path = format!("/libpod/networks/{encoded}/json");
545 let resp: Value = self.request_json(hyper::Method::GET, &path, None).await?;
546 // The response has "subnets": [{"gateway": "10.89.1.1", "subnet": "..."}]
547 let gateway = resp
548 .get("subnets")
549 .and_then(|s| s.as_array())
550 .and_then(|arr| arr.first())
551 .and_then(|sub| sub.get("gateway"))
552 .and_then(|g| g.as_str())
553 .map(String::from);
554 Ok(gateway)
555 }
556
557 // ── Image operations ────────────────────────────────────────────────
558

Callers

nothing calls this directly

Calls 5

validate_nameFunction · 0.85
url_encodeFunction · 0.85
request_jsonMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected