Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

ESousa97/goproxyreverso

goproxyreverso

High-performance, load-balanced reverse proxy built in Go with native Prometheus observability.

goproxyreverso Banner

CI Go Report Card Go Reference License: MIT Go Version Last Commit


goproxyreverso is a high-performance reverse proxy solution designed for scalability and reliability. It acts as an intelligent gateway, leveraging Go's concurrency primitives to distribute traffic efficiently across multiple backends while providing real-time health monitoring and protection through rate limiting.

Demonstration

Forwarding and Header Injection

# Request to Proxy
curl -i http://localhost:8080/api/resource

# Backend Response (Headers injected by goproxyreverso)
HTTP/1.1 200 OK
X-Real-IP: 192.168.1.15
X-Forwarded-For: 192.168.1.15
...

Metrics Endpoint

# Accessing real-time Prometheus metrics
curl http://localhost:8080/metrics

Tech Stack

Technology Role
Go 1.24 Core language and concurrent execution
httputil Low-level reverse proxy implementation
Prometheus Metrics collection and observability
Viper Scalable configuration management (YAML)
x/time/rate Token Bucket implementation for rate limiting

Prerequisites

  • Go >= 1.24 (defined in go.mod)
  • golangci-lint (for development)
  • Network tools (curl)

Installation and Usage

As a Binary

go install github.com/ESousa97/goproxyreverso/cmd/proxy@latest

From Source

git clone https://github.com/ESousa97/goproxyreverso.git
cd goproxyreverso
# make build
make run

Makefile Targets

Target Description
make build Compiles the project binary to dist/
make run Runs the proxy directly via go run
make test Runs all unit tests in the project
make lint Runs the linter (golangci-lint or go vet)
make clean Removes build artifacts and the dist/ folder
make help Displays all available make targets

Architecture

The project adopts a modular architecture focused on separation of concerns:

  • cmd/proxy: Entry point and application bootstrapping.
  • internal/proxy: Core logic containing load balancing strategies.
  • Least Connections: Dynamic traffic distribution based on active requests.
  • Health Checks: Asynchronous background pinger for server rotation.
  • Rate Limiter: Per-IP protection using the Token Bucket algorithm.

API Reference

Detailed documentation of the internal packages and structures can be found at pkg.go.dev.

Configuration

The application uses proxy.yaml for configuration.

Variable Description Type Default
listen_addr Port and address the proxy listens on string :8080
health_check_interval Interval between backend health pings duration 5s
backends List of upstream server URLs []string []
rate_limit.rps Limit of requests per second per IP float 10.0
rate_limit.burst Maximum burst allowed for rate limiting int 10

Roadmap

  • Phase 1: Core Forwarding Engine
  • Phase 2: Atomic Round-Robin Load Balancing
  • Phase 3: Active Health Check System
  • Phase 4: Least Connections Algorithm & Rate Limiting
  • Phase 5: Prometheus Metrics & YAML Configuration

Contributing

Contributions are welcome! See the full guide at CONTRIBUTING.md.

License

Distributed under the MIT license. See LICENSE for more details.

Author

Enoque Sousa

LinkedIn GitHub Portfolio

⬆ Back to top

Made with ❤️ by Enoque Sousa

Project Status: Archived — Study Project

About

59 - Reverse proxy de alta performance em Go com balanceamento Least Connections, rate limiting e observabilidade nativa.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors