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)
| 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 |
nothing calls this directly
no test coverage detected