pub fn host_is_local(host: &str) -> boolExpand description
Whether a host string denotes this machine.
Literal addresses are parsed rather than string-matched, because
::ffff:127.0.0.1 is loopback wearing a different hat — the same bypass
tools::fetch_guard::is_blocked_address documents on the SSRF side.
localhost is accepted by name. It is the one name a resolver is required
to map to loopback, and refusing it would reject the most common local
configuration for no gain.
Any other name is refused without resolving it. Resolution is a network call whose answer can change between the check and the connection, so a name that resolves to loopback today is not a guarantee — and a guard that makes a DNS request to decide whether to avoid the network has already lost.