Skip to main content

Module net

Module net 

Source
Expand description

Network address helpers.

The module centralizes small network parsing rules shared by Aster services: loopback host detection, trusted proxy CIDR parsing, and real-client-IP selection from X-Forwarded-For. Header-framework adapters stay in application crates; this module accepts plain strings and standard address types so it remains independent of Actix, Axum, or Hyper.

Functionsยง

is_loopback_host
Returns whether host is localhost or a loopback IP address.
is_trusted_proxy
Returns whether ip is covered by the trusted proxy list.
parse_trusted_proxies
Parses trusted proxy entries as CIDR networks or single IP addresses.
real_ip_from_forwarded_for
Returns the first client IP from X-Forwarded-For only when peer is trusted.