Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Round Robin proxy/balancer for the stud TLS terminator
JavaScript
tree: caee5f7830

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tests
README.mkd
index.js
package.json
pemfile
stud.conf

README.mkd

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)
Something went wrong with that request. Please try again.