Skip to main content

Module net

Module net 

Source
Expand description

Network utilities shared across crates.

Enums§

ResolveError
Error returned by resolve_and_validate when a hostname cannot be safely resolved.

Functions§

is_loopback_host
Returns true if host is a loopback target: an IP literal in the loopback range (127.0.0.0/8, ::1) or the well-known hostname localhost (case-insensitive).
is_private_ip
Returns true if addr is a non-routable or private IP address that should be blocked for outbound connections (SSRF defense).
resolve_and_validate
Resolves host:port via DNS and rejects the result if any resolved address is private, loopback, link-local, or otherwise non-routable per is_private_ip.