pub fn normalize_domain(domain: &str) -> Result<String>Expand description
Normalizes and validates a domain name.
This function:
- Removes http:// and https:// prefixes
- Removes www. prefix
- Removes trailing slashes and paths
- Converts to lowercase
- Converts internationalized domain names (IDN) to Punycode (ASCII)
- Validates format (must contain dots, only alphanumeric/hyphens/dots)
- Does NOT perform SSRF checks. For network operations, resolve and
validate via
crate::net::resolve_public_host(orvalidate_public_host), which returns the vettedSocketAddrs to connect to — closing the resolve-then-connect (DNS-rebinding) window.