• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GoProxy is a ReverseProxy / LoadBalancer helper for Golang

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.

More Repositories

1

pty

PTY interface for Go
Go
1,679
star
2

docker-firefox

Firefox over Docker via VNC
72
star
3

termios

Multi Platform Golang terminal management: Raw mode, TTY size.
Go
38
star
4

httpreq

The package provides an easy way to "unmarshal" query string data into a struct. Without reflect.
Go
36
star
5

goselect

select(2) implementation in Go
Go
31
star
6

dotfiles

Dev environment
Emacs Lisp
23
star
7

ehttp

Golang http wrapper handling errors.
Go
20
star
8

gosplice

Splice implementation in Go
Go
10
star
9

multio

Multiple I/O operation for Golang
Go
8
star
10

assumerole

Assume AWS role and auto refresh tokens.
Go
7
star
11

go-redis-server

Redis server implementation in Go.
Go
6
star
12

logicsim

Simple web-based logic gate simulator
TypeScript
5
star
13

docker_devmapper

Docker statically linked with libdevmapper
Shell
5
star
14

plantuml-hot-loader

Plantuml server with hot reload
JavaScript
5
star
15

goray

Raytracer in pure Go.
Go
5
star
16

ibweb

An Interactive Broker web viewer in python
Python
5
star
17

utc

Tiny util to convert utc to local date.
Go
2
star
18

go-base-template

Base template for a Golang project.
2
star
19

aef

Configuration variables management
Go
2
star
20

sink

Small utils that consumes tcp/udp connection without replying.
Go
2
star
21

gofour

Terminal Connect Four
Go
2
star
22

yaml2json

small util that converts yaml from stdin to json on stdout
Makefile
2
star
23

goshell

Partial recover of first go shell
Go
2
star
24

docker-grpc

Dockerfile with protobuf, grpc and protoc-gen-go installed.
Dockerfile
2
star
25

butterfly

Dockerfile for butterfly in-browser terminal
Shell
2
star
26

go-sqlite-static

Sqlite binding for Golang statically linked (Docker)
Go
2
star
27

weechat-docker

Perl
2
star
28

ml

Go
2
star
29

go-auth-hello

Support code for the North Austin Golang Meetup of April 21th, 2016
Go
2
star
30

dev

Docker image for golang/docker dev environment emacs/zsh/tmux
2
star
31

golang-web

Basic load-balanced web app in Go with bootstrap and tutum and datadog.
Smarty
1
star
32

hcler

Encode arbitrary Go types to Hashicorp's HCL format.
Go
1
star
33

gomeetup

Go
1
star
34

filewatcher

File system watcher using polling to work within docker mount bind.
Go
1
star
35

spider

Go
1
star
36

rtv0

Playing with basic ray tracing
C
1
star
37

golisten

Privilege de-escalation listen in Go.
Go
1
star
38

adventofcode

Go
1
star
39

fdf

Wireframe (fil de fer) visualizer
Go
1
star
40

elixir

Elixir Dockerfile
1
star
41

lm

Logging message library for Golang
Go
1
star
42

bug

Braille Unicode Graphics
Go
1
star
43

waitgroup

Waitgroup re-implementattion using chans
Go
1
star
44

gogrid

Interactive grid in the terminal
Go
1
star
45

ledcube

LED cube controlled by Golang using gobot.io
C++
1
star
46

partypher

Parts/Inventory management in Go.
Go
1
star
47

docker-jenkins

Jenkins in Docker with Git plugin and Docker installed
1
star
48

tcplb

TCP Load balancer in Go
Go
1
star
49

gogrok

Ngrok in Go
Go
1
star
50

auth

1
star