Categorygithub.com/litl/shuttle
modulepackage
0.2.2
Repository: https://github.com/litl/shuttle.git
Documentation: pkg.go.dev

# README

shuttle - Dynamic HTTP(S)/TCP/UDP Service Proxy

latest v0.1.0 Build Status License MIT GoDoc

Shuttle is a proxy and load balancer, which can be updated live via an HTTP interface. It can Proxy TCP, UDP, and HTTP(S) via virtual hosts.

Features

  • TCP/UDP/HTTP/HTTPS (SNI) Proxying
  • Round robin/Least Connection/Weighted Load Balancing
  • Backend Health Checks
  • HTTP API for dynamic updating and querying
  • Stats API
  • HTTP(S) Virtual Host Routing
  • Configuration HTTP Error Pages
  • Optional proxy config state saving
  • Optional file config

Install

$ wget https://github.com/litl/shuttle/releases/download/v0.1.0/shuttle-linux-amd64-v0.1.0.tar.gz
$ tar xvzv shuttle-linux-amd64-v0.1.0.tar.gz

Usage

Shuttle can be started with a default configuration, as well as its last configuration state. The -state configuration is updated on changes to the internal config. If the state config file doesn't exist, the default is loaded. The default config is never written to by shuttle.

Shuttle can serve multiple HTTPS hosts via SNI. Certs are loaded by providing a directory containing pairs of certificates and keys with the naming convention, vhost.name.pem vhost.name.key.

Basic TCP proxy:

$ ./shuttle -admin 127.0.0.1:9090 -config default_config.json -state state_config.json

Proxy with a virtualhost HTTP proxy on port 8080:

$ ./shuttle -admin 127.0.0.1:9090 -http :8080 -config default_config.json -state state_config.json

The current config can be queried via the /_config endpoint. This returns a json list of Services and their Backends, which can be saved directly as a config file. The configuration itself is defined by Config in github.com/litl/shuttle/client. The running config cam be updated by issuing a PUT or POST with a valid json config to /_config.

A GET request to / or /_stats returns the live stats from all Services. Individual services can be queried by their name, /service_name, returning just the json stats for that service. Backend stats can be queried directly as well via the path service_name/backend_name.

Issuing a PUT with a json config to the service's endpoint will create, or replace that service. Any changes to the running service require shutting down the listener, and starting a new service, which will create a very small period where connection may be rejected.

Issuing a PUT with a json config to the backend's endpoint will create or replace that backend. Existing connections relying on the old config will continue to run until the connection is closed.

TODO

  • Documentation!
  • Configure individual hosts to require HTTPS
  • Connection limits (per service and/or per backend)
  • Rate limits
  • Mark backend down after non-check connection failures (still requires checks to bring it back up)
  • Health check via http, or tcp call/resp pattern
  • Protocol bridging? e.g. TCP<->unix, UDP->TCP?!
  • Better logging
  • Remove all dependency on galaxy (galaxy/log?)

License

MIT

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
Create a new ReverseProxy This will still need to have a Director and Transport assigned.
Create a Service from a config struct.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
List of headers we want to cache for ErrorPages.
No description provided by the author

# Structs

No description provided by the author
The json stats we return for the backend.
A Dialer can return an error wrapped in DialError to notify the ReverseProxy that an error occured during the initial TCP connection, and it's safe to try again.
No description provided by the author
ErrorResponse provides a ReverProxy callback to process a response and insert custom error pages for a virtual host.
This works along with the ServiceRegistry, and the individual Services to route http requests based on the Host header.
Proxy Request stores a client request, backend response, error, and any stats needed to complete a round trip.
ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.
No description provided by the author
TODO: notify or prevent vhost name conflicts between services.
Stats returned about a service.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author