How samualtnorman/internet-address works
Main Components
a. Core Modules:
• IPv4 Module
• IPv6 Module
• CIDR Module
• Process Module
• Subnet Match Module
b. Utility Layers:
• Parser Layer
• Conversion Layer
• Validation Layer
• Address Range Operations
┌─ Public API Layer ─────────────────────┐
• IPv4 | IPv6 | CIDR | Process | Subnet │
• ┬─────────────────────────┘
┌─ Core Operations Layer ─────────────────┐
• ┌─────────┐ ┌──────────┐ ┌──────────┐ │
• Parsing │ │Validation│ │Conversion│ │
• ┘ └──────────┘ └──────────┘ │
• ┬─────────────────────────┘
┌─ Implementation Layer ──────────────────┐
• ┌─────────┐ ┌──────────┐ ┌──────────┐ │
• IPv4 │ │ IPv6 │ │ CIDR │ │
• Functions│ │ Functions │ │Operations│ │
• ┘ └──────────┘ └──────────┘ │
• ┘
Key Relationships to Highlight
a. IPv4 Operations:
• Parse → Validate → Convert/Process
• CIDR calculations
• Subnet operations
b. IPv6 Operations:
• Similar flow to IPv4 but with hextet handling
• IPv4 to IPv6 conversion
• IPv6-specific CIDR operations
Implementation Details
a. Data Types:
• Uint8Array for IPv4
• Uint16Array for IPv6
• Native JavaScript type usage
b. Function Groups:
• Address parsing
• CIDR operations
• Range calculations
• Validation functions
• Conversion utilities
Additional Notes
• Lightweight and browser-friendly architecture
• Clear separation between IPv4 and IPv6 operations
• Shared utilities between modules
• Minimal abstraction
• Direct use of JavaScript built-ins
• Clear separation of concerns
• Independent module structure