finds.dev← search

// the find

mojombo/proxymachine

★ 591 · Ruby · MIT · updated May 2022

A simple TCP routing proxy built on EventMachine that lets you configure the routing logic in Ruby.

ProxyMachine is a layer-7 TCP proxy where routing logic is defined in a Ruby block that inspects the raw stream buffer and returns a target backend. Built on EventMachine, it was created by Tom Preston-Werner for GitHub's federated git routing — the git.rb example in the repo is essentially the real production use case.

The core abstraction is clean: a single block that returns a hash, with well-defined return values covering the common cases (route, noop, close, reply-then-route). The SOCKS4 proxy example in 7 lines is a genuine demonstration of power, not a toy. Connect and inactivity timeout callbacks are first-class, which matters for production TCP proxying. EventMachine's non-blocking I/O means you can hold thousands of connections while waiting for enough buffer to make a routing decision.

EventMachine is effectively dead — the project hasn't had a meaningful release in over a decade and the reactor model it's built on has been superseded by async/fiber approaches. Last push was 2022 (just a dependency bump), and 591 stars accumulated mostly between 2009-2013. If you're building anything new, you'd reach for Nginx stream module, HAProxy's Lua scripting, or a Go-based proxy before this. The single-process EventMachine reactor also means one blocking call in your routing block stalls everything.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →