Pick the identity bound to the configured server whose host is the longest dot-boundary suffix of `remote_host`. Longest-suffix wins so a more specific server (`staging.atomic.storage`) beats a broader one (`atomic.storage`) for hosts under both — e.g. `x.staging.atomic.storage` resolves to the staging identity, not prod.
(remote_host: &str, servers: &[(String, String)])
| 123 | /// beats a broader one (`atomic.storage`) for hosts under both — e.g. |
| 124 | /// `x.staging.atomic.storage` resolves to the staging identity, not prod. |
| 125 | fn match_server_identity(remote_host: &str, servers: &[(String, String)]) -> Option<String> { |
| 126 | servers |
| 127 | .iter() |
| 128 | .filter(|(server_host, _)| host_is_under(remote_host, server_host)) |
| 129 | .max_by_key(|(server_host, _)| server_host.len()) |
| 130 | .map(|(_, identity)| identity.clone()) |
| 131 | } |
| 132 | |
| 133 | /// Whether `remote_host` is the server host itself or a subdomain of it, |
| 134 | /// matching only on dot boundaries (so `notatomic.storage` does NOT match |
no test coverage detected