(
network_name: &str,
network: &bollard::models::NetworkInspect,
)
| 2607 | } |
| 2608 | |
| 2609 | fn docker_bridge_gateway_ip( |
| 2610 | network_name: &str, |
| 2611 | network: &bollard::models::NetworkInspect, |
| 2612 | ) -> CoreResult<IpAddr> { |
| 2613 | let Some(configs) = network.ipam.as_ref().and_then(|ipam| ipam.config.as_ref()) else { |
| 2614 | return Err(Error::config(format!( |
| 2615 | "Docker bridge network '{network_name}' does not expose IPAM gateway configuration" |
| 2616 | ))); |
| 2617 | }; |
| 2618 | |
| 2619 | for config in configs { |
| 2620 | let Some(gateway) = config.gateway.as_deref() else { |
| 2621 | continue; |
| 2622 | }; |
| 2623 | let ip = gateway.parse::<IpAddr>().map_err(|err| { |
| 2624 | Error::config(format!( |
| 2625 | "Docker bridge network '{network_name}' has invalid gateway '{gateway}': {err}" |
| 2626 | )) |
| 2627 | })?; |
| 2628 | if matches!(ip, IpAddr::V4(_)) { |
| 2629 | return Ok(ip); |
| 2630 | } |
| 2631 | } |
| 2632 | |
| 2633 | Err(Error::config(format!( |
| 2634 | "Docker bridge network '{network_name}' does not have an IPv4 IPAM gateway" |
| 2635 | ))) |
| 2636 | } |
| 2637 | |
| 2638 | fn docker_resource_limits( |
| 2639 | template: &DriverSandboxTemplate, |
no test coverage detected