A TCP proxy implementing a simple fallback mechanism.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This is a TCP proxy implementing a simple fallback mechanism.

All the requests will be forwarded to the first working backend on a list. When a backend connection fails, the client connection is closed and the backend is marked as non-working to be probed in the background. Once the backend connectivity is restored, the backend is marked back to be used by the proxy.

Because the proxy works at TCP level, it can be used with any TCP based service using one single port.


Go 1.0 or later is required: http://golang.org/

Fetch and build with:

go get github.com/memset/tcp_fallback

and this will build the binary in $GOPATH/bin. You can then modify the source and submit patches.

Or checkout the source in the traditional way, change to the directory and type:

go build

Test the build with:

go test


tcp_fallback [flags] <local-address:port> [<remote-address:port>]+


-cpuprofile="": Write cpu profile to file if set
-debug=false: Enable verbose logging
-logfile="": Log into provided file
-maxthreads=4: Maximum number of OS threads to use
-probe-delay=30s: Interval to delay probes after backend error
-quiet=false: Doesn't log anything
-stats=15m0s: Interval to log stats
-syslog=false: Use Syslog for logging
-timeout=5s: Timeout for backend connection


$ tcp_fallback -syslog

The proxy will listen for connections on all interfaces on port 3306 (MySQL) and will forward the requests to (first backend), using and as fallback.


This is free software under the terms of MIT license.

Contact and support

The project website is at:


There you can file bug reports, ask for help or contribute patches.