Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 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

Code of conduct

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages