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

Function normalize_endpoint

crates/openshell-policy/src/merge.rs:806–815  ·  view source on GitHub ↗
(endpoint: &mut NetworkEndpoint)

Source from the content-addressed store, hash-verified

804}
805
806fn normalize_endpoint(endpoint: &mut NetworkEndpoint) {
807 let mut ports = canonical_ports(endpoint);
808 ports.sort_unstable();
809 ports.dedup();
810 endpoint.port = ports.first().copied().unwrap_or(0);
811 endpoint.ports = ports;
812 dedup_strings(&mut endpoint.allowed_ips);
813 dedup_l7_rules(&mut endpoint.rules);
814 dedup_deny_rules(&mut endpoint.deny_rules);
815}
816
817fn dedup_strings(values: &mut Vec<String>) {
818 let mut seen = HashSet::new();

Callers 3

merge_rulesFunction · 0.85
merge_endpointFunction · 0.85
normalize_ruleFunction · 0.85

Calls 4

canonical_portsFunction · 0.85
dedup_l7_rulesFunction · 0.85
dedup_deny_rulesFunction · 0.85
dedup_stringsFunction · 0.70

Tested by

no test coverage detected