Skip to main content

normalize_domain

Function normalize_domain 

pub fn normalize_domain(raw: &str) -> Option<String>
Expand description

Normalize a single allowlist entry to a canonical bare host.

Accepts bare hosts, bare IPv4/IPv6 literals (bracketed or not), and full URLs (a missing scheme is treated as https://). Returns None for empty input, input containing whitespace, unmatched brackets, entries carrying userinfo, or anything that does not parse to a host.