| 533 | } |
| 534 | |
| 535 | fn format_endpoint_summary(endpoint: &NetworkEndpoint) -> String { |
| 536 | let host_port = if endpoint.port > 0 { |
| 537 | format!("{}:{}", endpoint.host, endpoint.port) |
| 538 | } else { |
| 539 | endpoint.host.clone() |
| 540 | }; |
| 541 | |
| 542 | let mut tags = vec![endpoint_layer_label(endpoint).to_string()]; |
| 543 | if !endpoint.access.is_empty() { |
| 544 | tags.push(format!("access={}", endpoint.access)); |
| 545 | } |
| 546 | for rule in &endpoint.rules { |
| 547 | if let Some(allow) = &rule.allow { |
| 548 | tags.push(format!("allow {}", format_allow_rule(allow))); |
| 549 | } |
| 550 | } |
| 551 | for deny in &endpoint.deny_rules { |
| 552 | tags.push(format!("deny {}", format_deny_rule(deny))); |
| 553 | } |
| 554 | |
| 555 | format!("{host_port} [{}]", tags.join(", ")) |
| 556 | } |
| 557 | |
| 558 | fn format_endpoint_details(endpoint: &NetworkEndpoint) -> Vec<String> { |
| 559 | let mut details = Vec::new(); |