Skip to content

Ameriq8/reverse-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸš€ Go Load Balancing Reverse Proxy

A high-performance reverse proxy with advanced load balancing capabilities

Go Report Card GoDoc License Build Status Coverage


Go Load Balancing Reverse Proxy

A high-performance reverse proxy implementation in Go with advanced load balancing capabilities and YAML-based configuration.

Features

  • 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

Project Structure

Current Structure

reverse-proxy/
β”œβ”€β”€ main.go          # Main proxy implementation
β”œβ”€β”€ config.yml       # Configuration file
└── README.md        # Documentation

Future Structure

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

Configuration

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

Getting Started

  1. Clone the repository:
git clone https://github.com/Ameriq8/reverse-proxy.git
cd reverse-proxy
  1. Configure your backend servers in config.yml

  2. Run the proxy:

go run main.go

Requirements

  • Go 1.16 or higher
  • YAML configuration file

TODO List

High Priority

  • Implement configuration loading from YAML
  • Add health check functionality
  • Implement connection pooling
  • Add metrics collection (Prometheus)
  • Add structured logging

Medium Priority

  • Additional load balancing strategies
    • Random selection
    • Least connections
    • IP hash-based routing
  • TLS support
  • Request/response middleware
  • Rate limiting
  • Circuit breaker implementation

Low Priority

  • Admin REST API
  • Monitoring dashboard
  • Service discovery integration
  • Caching layer
  • WebSocket support

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

πŸ“œ Code of Conduct

This project follows the Contributor Covenant Code of Conduct.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Go standard library for excellent networking primitives
  • YAML community for configuration support

About

[WIP] Simple Reverse Proxy

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages