Module: net.address

Source: ./net/address.reef


Overview

net.address - IP address parsing and utilities

Provides IPv4 and IPv6 address validation, parsing, and classification (loopback, private, broadcast, etc.).


Functions

fn is_ipv4(addr: string): bool

Check if string is IPv4 address

fn is_ipv6(addr: string): bool

Check if string is IPv6 address

fn digit_value(c: char): int

Helper: convert digit char to int (0-9) Uses char arithmetic: 'c' - '0' gives the digit value

fn ipv4_is_valid(addr: string): bool

Validate IPv4 address format

fn ipv4_is_loopback(addr: string): bool

Check if IPv4 is loopback (127.x.x.x)

fn ipv4_is_private(addr: string): bool

Check if IPv4 is private (RFC 1918)

fn ipv4_is_broadcast(addr: string): bool

Check if IPv4 is broadcast (255.255.255.255)

fn is_hex_digit(c: char): bool

Helper: check if char is a valid hex digit

fn hex_value(c: char): int

Helper: convert hex char to value (0-15)

fn ipv6_is_valid(addr: string): bool

Validate IPv6 address (basic check)

fn ipv6_is_loopback(addr: string): bool

Check if IPv6 is loopback (::1)

fn addr_normalize(addr: string): string

Normalize address (placeholder - returns as-is for now)


Generated by reefc doc