Skip to content

soylent/eventmachine-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

minimal HTTPS (CONNECT) proxy server

Topics

Resources

Stars

Watchers

Forks

Languages