SkillAgentSearch skills...

Goproxy

GoProxy is a ReverseProxy / LoadBalancer helper for Golang

Install / Use

/learn @creack/Goproxy
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

goproxy

GoProxy is a ReverseProxy / LoadBalancer helper for Golang

Example

package main

import (
	"fmt"
	"log"
	"net/http"

	"github.com/creack/goproxy"
	"github.com/creack/goproxy/registry"
)

// ServiceRegistry is a local registry of services/versions
var ServiceRegistry = registry.DefaultRegistry{
	"service1": {
		"v1": {
			"localhost:9091",
			"localhost:9092",
		},
	},
}

func main() {
	http.HandleFunc("/", goproxy.NewMultipleHostReverseProxy(ServiceRegistry))
	http.HandleFunc("/health", func(w http.ResponseWriter, req *http.Request) {
		fmt.Fprintf(w, "%v\n", ServiceRegistry)
	})
	println("ready")
	log.Fatal(http.ListenAndServe(":9090", nil))
}

Limitations

Because we control only the connection, we can't have different http routes accross the same service. For the same reason, we can't have both HTTP and HTTPS for the same service. For now, this load balancer only supports HTTP.

View on GitHub
GitHub Stars175
CategoryDevelopment
Updated1mo ago
Forks28

Languages

Go

Security Score

95/100

Audited on Feb 27, 2026

No findings