Skip to main content

parse_entry

Function parse_entry 

Source
pub fn parse_entry(input: &str, spf: bool) -> Result<Range, ParseError>
Expand description

Parse one input entry into an address range.

Accepted forms, for both IPv4 and IPv6:

  • addr — a single host
  • addr/len — a prefix; host bits are masked off (10.1.2.3/8 is 10.0.0.0/8)
  • start-end — an inclusive range, split into CIDRs on output

With spf, a leading ip4: or ip6: (any case) is stripped and must match the address family.

Rejected: IPv4 octets with leading zeros (ambiguous octal), IPv6 zone IDs (fe80::1%eth0, meaningless in a route), and prefix lengths with a sign or leading zeros (/032).