MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / host_is_under

Function host_is_under

atomic-remote/src/auth/mod.rs:235–239  ·  view source on GitHub ↗

Whether `remote_host` is the server host itself or a subdomain of it, matching only on dot boundaries (so `notatomic.storage` does NOT match `atomic.storage`). Comparison is case-insensitive (DNS is).

(remote_host: &str, server_host: &str)

Source from the content-addressed store, hash-verified

233/// matching only on dot boundaries (so `notatomic.storage` does NOT match
234/// `atomic.storage`). Comparison is case-insensitive (DNS is).
235fn host_is_under(remote_host: &str, server_host: &str) -> bool {
236 let remote = remote_host.to_ascii_lowercase();
237 let server = server_host.to_ascii_lowercase();
238 remote == server || remote.ends_with(&format!(".{server}"))
239}
240
241/// Load a local identity by name, falling back to a case-insensitive match.
242///

Callers 1

match_server_identityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected