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)])
| 116 | /// beats a broader one (`atomic.storage`) for hosts under both — e.g. |
| 117 | /// `x.staging.atomic.storage` resolves to the staging identity, not prod. |
| 118 | fn match_server_identity(remote_host: &str, servers: &[(String, String)]) -> Option<String> { |
| 119 | servers |
| 120 | .iter() |
| 121 | .filter(|(server_host, _)| host_is_under(remote_host, server_host)) |
| 122 | .max_by_key(|(server_host, _)| server_host.len()) |
| 123 | .map(|(_, identity)| identity.clone()) |
| 124 | } |
| 125 | |
| 126 | /// Whether `remote_host` is the server host itself or a subdomain of it, |
| 127 | /// matching only on dot boundaries (so `notatomic.storage` does NOT match |
no test coverage detected