The project is in a healthy, maintained state
minimal CONNECT proxy
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

eventmachine-proxy

Minimal CONNECT proxy server.

Features

  • Tiny.
  • Efficient. It uses EM-native proxying methods.
  • Backpressure handling. To keep memory usage low and bounded, connections are paused if the receiver is slower than the sender.
  • Secure. Only global unicast addresses are allowed by default.

Installation

$ gem install eventmachine-proxy

Usage

require "eventmachine-proxy"

EventMachine.run do
  EventMachine.start_server("127.0.0.1", 3128, EventMachine::Protocols::CONNECT)
end

The code above starts an HTTPS proxy server on port 3128. To test it:

$ curl -px 127.0.0.1:3128 https://example.org

Options

The following options can be passed as the last argument.

Option Description Default
connect_timeout Timeout to establish proxy connection 20.0 s
connection_inactivity_timeout Auto-close connection after this inactivity timeout 0
connection_buffer_size Proxy buffer size, one way 8 MiB
request_buffer_size CONNECT request buffer size 1 KiB
allow_all Allow addresses other than global unicast false

Development

Pull requests are welcome.

To run tests:

$ ruby -Ilib test/test_*

To run the benchmark:

$ ruby -Ilib benchmark.rb