Skip to content
☁️ Modern & minimalistic load balancer for the Сloud era
Go Makefile Shell Dockerfile
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
config Set logging format to text by default in config Jan 22, 2020
dist This is where it all begins... Jun 7, 2016
share Basic udp protocol implementation #41 Nov 9, 2016
snap Added snapcraft strict confinement May 6, 2019
src Updated golang.org/x/crypto dependency, in order to support recent le… Feb 25, 2020
test Added weight/priority balancer tests #204 Jun 14, 2019
vendor This is where it all begins... Jun 7, 2016
.gitignore Added initial snapcraft for creating a snap for gobetween #219. May 3, 2019
.travis.yml Added stable golang to travis build Jan 22, 2020
AUTHORS Preparing release 0.7.0 Apr 11, 2019
CHANGELOG.md Preparing release 0.7.0 Apr 11, 2019
CONTRIBUTING.md Added CONTRIBUTING.md Mar 26, 2019
Dockerfile Fixed Dockerfile May 30, 2019
LICENSE Added Illarion Apr 16, 2019
MAINTAINERS Updated changelog, readmy and maintainers list Aug 12, 2018
Makefile Added initial snapcraft for creating a snap for gobetween #219. May 3, 2019
README.md typo (#259) Jan 22, 2020
VERSION Bumped next development version v0.8.0 Apr 11, 2019
go.mod
go.sum Updated golang.org/x/crypto dependency, in order to support recent le… Feb 25, 2020
logo.png This is where it all begins... Jun 7, 2016
main.go fix startup race condition Jan 23, 2020

README.md

gobetween

Tag Build Status Go Report Card Docs Docker Snap Status Telegram License

gobetween - modern & minimalistic load balancer and reverse-proxy for the ☁️ Cloud era.

Current status: Under active development. Currently in use in several highly loaded production environments.

Features

  • Fast L4 Load Balancing

  • Clear & Flexible Configuration with TOML or JSON

    • File - read configuration from the file
    • URL - query URL by HTTP and get configuration from the response body
    • Consul - query Consul key-value storage API for configuration
  • Management REST API

    • System Information - general server info
    • Configuration - dump current config
    • Servers - list, create & delete
    • Stats & Metrics - for servers and backends including rx/tx, status, active connections & etc.
  • Discovery

    • Static - hardcode backends list in config file
    • Docker - query backends from Docker / Swarm API filtered by label
    • Exec - execute arbitrary program and get backends from its stdout
    • JSON - query arbitrary http url and pick backends from response json (of any structure)
    • Plaintext - query arbitrary http and parse backends from response text with customized regexp
    • SRV - query DNS server and get backends from SRV records
    • Consul - query Consul Services API for backends
    • LXD - query backends from LXD
  • Healthchecks

    • Ping - simple TCP ping healthcheck
    • Exec - execute arbitrary program passing host & port as options, and read healthcheck status from the stdout
    • Probe - send specific bytes to backend (udp, tcp or tls) and expect correct answer (bytes or regexp)
  • Balancing Strategies (with SNI support)

    • Weight - select backend from pool based relative weights of backends
    • Roundrobin - simple elect backend from pool in circular order
    • Iphash - route client to the same backend based on client ip hash
    • Iphash1 - same as iphash but backend removal consistent (clients remain connecting to the same backend, even if some other backends down)
    • Leastconn - select backend with least active connections
    • Leastbandwidth - backends with least bandwidth
  • Integrates seamlessly with Docker and with any custom system (thanks to Exec discovery and healthchecks)

  • Single binary distribution

Architecture

gobetween

Usage

Hacking

  • Install Go 1.12+ https://golang.org/
  • $ git clone git@github.com:yyyar/gobetween.git
  • $ make
  • $ make run

Debug and Test

Run several web servers for tests in different terminals:

  • $ python -m SimpleHTTPServer 8000
  • $ python -m SimpleHTTPServer 8001

Instead of Python's internal HTTP module, you can also use a single binary (Go based) webserver like: https://github.com/udhos/gowebhello

gowebhello has support for SSL sertificates as well (HTTPS mode), in case you want to do quick demos of the TLS+SNI capabilities of gobetween.

Put localhost:8000 and localhost:8001 to static_list of static discovery in config file, then try it:

  • $ gobetween -c gobetween.toml

  • $ curl http://localhost:3000

Enable profiler and debug issues you encounter

[profiler]
enabled = true     # false | true
bind    = ":6060"  # "host:port"

Performance

It's Fast! See Performance Testing

The Name

It's a play on words: gobetween ("go between").

Also, it's written in Go, and it's a proxy so it's something that stays between 2 parties 😄

License

MIT. See LICENSE file for more details.

Authors & Maintainers

All Contributors

Community

  • Join gobetween Telegram group here.

Logo

Logo by Max Demchenko

You can’t perform that action at this time.