How komuw/ong works
Main Components
a) Core HTTP Server Layer:
• TLS/ACME handler (from server/tls_conf.go)
• Auto-configuration (GOMEMLIMIT, GOMAXPROCS)
• Graceful shutdown handler
• pprof endpoints
b) Middleware Chain:
• Rate Limiter
• Load Shedder
• CORS Handler
• CSRF Protection
• Session Manager
• Recovery Handler
• Logging Middleware
• Client IP Detection
• Security Headers
c) Router/Multiplexer:
• "Mux" component with:
• Route Registry
• Path Parameter Handler
• Route Conflict Detection
d) Supporting Services:
• Crypto Services (cry package)
• Session Management (sess package)
• Logging System (log package with circular buffer)
• ID Generation (id package)
• Error Handling (errors package)
Component Relationships
• External Request → TLS Termination → Middleware Chain → Router → Handler
Specific Implementation Details
• Security components (red)
• Performance components (blue)
• Core routing components (green)
• Supporting utilities (gray)
Specific elements
┌─────────────────────────────────────────────┐
• HTTP Server │
• ┌─────────────┐ ┌──────────┐ ┌──────────┐ │
• TLS/ACME │ │ AutoMax │ │ Graceful │ │
• Management │ │ Config │ │ Shutdown │ │
• ┘ └──────────┘ └──────────┘ │
• ┘
• ▼
┌─────────────────────────────────────────────┐
• Middleware Chain │
• ┌─────────┐ ┌────────┐ ┌────────────────┐ │
• Security│ │ Perf │ │ Observability │ │
• CSRF │ │ Rate │ │ Logging │ │
• CORS │ │ Limit │ │ Tracing │ │
• ┘ └────────┘ └────────────────┘ │
• ┘
• ▼
┌─────────────────────────────────────────────┐
• Router (Mux) │
• ┌─────────────┐ ┌──────────────────────┐ │
• Route │ │ Path Parameter │ │
• Registry │ │ Handling │ │
• ┘ └──────────────────────┘ │
• ┘
Implementation Notes
• Notes about auto-configuration features