A high-performance reverse proxy with advanced load balancing capabilities
A high-performance reverse proxy implementation in Go with advanced load balancing capabilities and YAML-based configuration.
- Configurable load balancing strategies
- Round-robin (implemented)
- Random selection (planned)
- Least connections (planned)
- Health checks for backend servers
- Connection pooling and timeout management
- Extensive metrics collection
- Comprehensive logging system
- YAML-based configuration
reverse-proxy/
├── main.go # Main proxy implementation
├── config.yml # Configuration file
└── README.md # Documentation
reverse-proxy/
├── cmd/
│ └── proxy/
│ └── main.go # Application entry point
├── internal/
│ ├── config/
│ │ ├── config.go # Configuration structs and loading
│ │ └── validator.go # Configuration validation
│ ├── proxy/
│ │ ├── handler.go # Request handling logic
│ │ ├── metrics.go # Metrics collection
│ │ └── pool.go # Connection pooling
│ ├── balancer/
│ │ ├── round_robin.go # Round-robin implementation
│ │ ├── random.go # Random selection implementation
│ │ └── least_conn.go # Least connections implementation
│ └── health/
│ ├── checker.go # Health check implementation
│ └── monitor.go # Health status monitoring
├── pkg/
│ ├── logger/ # Logging package
│ └── middleware/ # Middleware implementations
├── api/
│ └── admin/ # Admin API endpoints
├── web/
│ └── dashboard/ # Web dashboard files
├── tests/
│ ├── integration/ # Integration tests
│ └── performance/ # Performance benchmarks
├── docs/
│ ├── api.md # API documentation
│ └── deployment.md # Deployment guide
├── deployments/
│ ├── docker/ # Docker configurations
│ └── kubernetes/ # Kubernetes manifests
├── scripts/ # Build and maintenance scripts
├── config.yml # Main configuration file
├── go.mod # Go module file
├── go.sum # Go module checksum
└── README.md # Project documentation
The proxy is configured using config.yml. Example configuration:
servers:
- address: "127.0.0.1:9091"
timeout:
connect: 5s
read: 10s
write: 10s
load_balancer:
strategy: "round-robin"
health_check:
interval: 5s
timeout: 2s
retries: 3- Clone the repository:
git clone https://github.com/Ameriq8/reverse-proxy.git
cd reverse-proxy-
Configure your backend servers in
config.yml -
Run the proxy:
go run main.go- Go 1.16 or higher
- YAML configuration file
- Implement configuration loading from YAML
- Add health check functionality
- Implement connection pooling
- Add metrics collection (Prometheus)
- Add structured logging
- Additional load balancing strategies
- Random selection
- Least connections
- IP hash-based routing
- TLS support
- Request/response middleware
- Rate limiting
- Circuit breaker implementation
- Admin REST API
- Monitoring dashboard
- Service discovery integration
- Caching layer
- WebSocket support
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
We welcome contributions! Please see our Contributing Guidelines for details.
This project follows the Contributor Covenant Code of Conduct.
This project is licensed under the MIT License - see the LICENSE file for details.
- Go standard library for excellent networking primitives
- YAML community for configuration support