Skip to main content

resolve_and_validate_address

Function resolve_and_validate_address 

Source
pub async fn resolve_and_validate_address(
    host: &str,
    port: u16,
) -> Result<SocketAddr, CimdError>
Expand description

Resolve host:port via DNS (bounded by DNS_TIMEOUT) and return the first resolved address, rejecting the entire result set if any resolved address is private/loopback/etc — a hostname resolving to a mix of public and private addresses is treated as untrusted outright rather than cherry-picking a public one, since DNS load-balancing could non-deterministically prefer the private one on a subsequent lookup even though this specific call pins one address.

§Errors

Returns CimdError::DnsResolutionFailed on timeout/lookup failure or an empty result set, and CimdError::DnsBlocked if any resolved address is private.