Skip to main content

Module ip

Module ip 

Source
Expand description

IP address parsing and normalization for the ip field type.

Supports IPv4 and IPv6. IPv4 addresses are stored as i64 column values for range queries. Both are stored as normalized keyword strings for term queries.

Functions§

cidr_to_range
Parse a CIDR notation string into (start_ip, end_ip) as i64 values. Returns None for invalid input or IPv6 CIDRs.
ip_to_i64
Convert an IP address string to i64 for columnar storage. IPv4 maps to its u32 numeric value (fits in i64). IPv6 returns None (range queries not supported for IPv6 yet).
normalize_ip
Normalize an IP address string for keyword indexing. Returns the canonical string form, or empty string if invalid.