How rahul-02825/aegis works
Aegis (PrismX) is a Go reverse proxy/API gateway. At startup, its entry point connects to MongoDB, loads a configuration document into a concurrent in-memory runtime shape, initializes per-upstream consistent-hash balancers, and starts the management API and proxy. Proxy requests select an upstream by the first path segment, choose a backend using the client address, and are forwarded there. The separate management API handles config and user records; config updates reload runtime config. The README describes a standalone rate limiter, but it is not wired into the proxy. Relationships reflect shown source and README documentation; the limiter’s independence is documented.
Main entry points: main.go Application startup · reverse_proxy.go Reverse proxy · controller.go Config handlers · configHandler.go Runtime config
Components 17
Startup and runtime config
- Application startup
main.go - Runtime config
config/configHandler.go
Proxy and load balancing
- Reverse proxy
proxy/reverse_proxy.go - Balancer registry
loadBalancer/start.go - Balancer factory
loadBalancer/balancer.go - Consistent hash ring
loadBalancer/consistent_hasher.go
Management API
- Config handlers
internal/controller/controller.go - User handlers
internal/controller/usercontroller.go - Controller helpers
internal/controller/helper.go
Persistence and support
- API and DB models
internal/models/models.go - Mongo collections
internal/database/db.go - Application logger
logger/logger.go - Standalone rate limiter
security/limiter.go
Other components
- API client
- Proxy client
- Backend services
- MongoDB
Connections 24
- Application startup → Application logger: initializes
main.go - Application startup → Mongo collections: connects
main.go - Application startup → Runtime config: loads config
main.go - Runtime config → Mongo collections: reads config
config/configHandler.go - Mongo collections → MongoDB: connects collections
internal/database/db.go - Application startup → Balancer registry: initializes
main.go - Balancer registry → Runtime config: reads upstreams
loadBalancer/start.go - Balancer registry → Balancer factory: creates balancer
loadBalancer/start.go - Balancer factory → Consistent hash ring: builds
loadBalancer/balancer.go - Application startup → Config handlers: registers routes
main.go - Application startup → User handlers: registers routes
main.go - API client → Config handlers: manages configs
README.md - API client → User handlers: manages users
README.md - Config handlers → Mongo collections: updates configs
internal/controller/controller.go - Config handlers → Runtime config: reloads config
internal/controller/controller.go - User handlers → Mongo collections: reads and writes
internal/controller/usercontroller.go - Config handlers → API and DB models: decodes config
internal/controller/controller.go - User handlers → API and DB models: decodes user
internal/controller/usercontroller.go - Application startup → Reverse proxy: starts proxy
main.go - Proxy client → Reverse proxy: sends requests
README.md - Reverse proxy → Runtime config: checks service
proxy/reverse_proxy.go - Reverse proxy → Balancer registry: gets balancer
proxy/reverse_proxy.go - Reverse proxy → Consistent hash ring: selects backend
README.md - Reverse proxy → Backend services: forwards request
proxy/reverse_proxy.go