Round Robin proxy/balancer for the stud TLS terminator
JavaScript
Latest commit 1e7a9cd Jan 30, 2015 @mikeal Merge pull request #2 from Srirangan/patch-1
Rename README.mkd to README.md
Permalink
Failed to load latest commit information.
tests
README.md Rename README.mkd to README.md Jan 30, 2015
index.js Sticky sessions using an LRU cache. Sep 10, 2012
package.json
pemfile Sticky sessions using an LRU cache. Sep 10, 2012
stud.conf Initial commit. Mar 2, 2012

README.md

stud-proxy

Round Robin proxy/balancer for the stud TLS terminator

Getting Started

Get stud. Run with --write-ip, THIS IS NOT OPTIONAL.

var s = studproxy()
s.listen(8000, function () {
  request('https://localhost:8443/', function (e, resp, body) {
    // Will return a response from a round robin host.
  })
})
s.robin([['98.139.127.62', 80]])

If you need to get your list of round robin hosts from a remote server stud-proxy will queue all the incoming requests and buffering the data in to memory until you set the round robin hosts.

var s = studproxy()
s.listen(8000, function () {
  request('https://localhost:8443/', function (e, resp, body) {
    // Will return a response from a round robin host.
  })
})
setTimeout(function () {
  s.robin([['98.139.127.62', 80]])
}, 1000)

You can reset the round robin hosts at any time by calling .robin().

If you don't want to do a simple round robin you can pass a custom handler.

var s = studproxy(function (socket, ip, chunk) {
  console.error('New connection from '+ip)
  socket.pipe(net.connect(80)).pipe(socket)
  if (chunk) socket.write(chunk)
})

Keep in mind that this customization doesn't not include the connection queues and buffering available when using round robin.

TODO

  • Support IPv6
  • Benchmarks (this is a pure TCP proxy so they'll be fairly impressive)