Module domain_guard
Expand description
Shared domain/URL validation and allowlist helpers.
The primitives themselves live in zeroclaw_infra::net_guard so the tool
implementations and zeroclaw-channels read one implementation. This
module is the tool-layer facade: it keeps the
crate::helpers::domain_guard::* paths the tools and zeroclaw-channels
already use, and it is where a tool-specific or config-specific wrapper
would go if one were ever needed. Unit coverage for the primitives lives
beside them in zeroclaw-infra.
Structs§
- Nat64
Prefix - Operator-declared, network-specific RFC 6052 NAT64 prefixes, and the parser that turns the configured strings into them.
Functions§
- host_
matches_ allowlist - True when
hostmatches any entry in a normalizedallowedlist. - is_
private_ or_ local_ host - Check whether
hostis a private, loopback, link-local, or otherwise non-globally-routable address (SSRF guard). Handles both IPv4 and IPv6, as well aslocalhostand.localdomains. True whenhostis loopback, private, link-local, a documentation/ benchmark range, or one of thelocalhost/*.localname forms. Accepts bracketed IPv6 ([::1]), ignores DNS root-label dots, and is case-insensitive. - normalize_
allowed_ domains - Normalize a whole allowlist, sorted and deduplicated.
- normalize_
domain - Normalize a single allowlist entry to a canonical bare host.
- parse_
nat64_ prefixes - Operator-declared, network-specific RFC 6052 NAT64 prefixes, and the parser that turns the configured strings into them.