Code Monkey home page Code Monkey logo

shuttle's Introduction

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

shuttle's People

Contributors

joeshaw avatar jwilder avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.