README.md in proxymachine-1.0.0 vs README.md in proxymachine-1.1.0

- old
+ new

@@ -24,11 +24,13 @@ backend is made, the buffer is replayed to the backend, and the client and backend connections are hooked up to form a transparent proxy. This bidirectional proxy continues to exist until either the client or backend close the connection. -ProxyMachine was developed for GitHub's federated architecture and is successfully used in production to proxy millions of requests every day. The performance and memory profile have both proven to be excellent. +ProxyMachine was developed for GitHub's federated architecture and is +successfully used in production to proxy millions of requests every day. The +performance and memory profile have both proven to be excellent. Installation ------------ @@ -84,15 +86,30 @@ { :noop => true } end end +Example SOCKS4 Proxy in 7 Lines +------------------------------- + + proxy do |data| + return if data.size < 9 + v, c, port, o1, o2, o3, o4, user = data.unpack("CCnC4a*") + return { :close => "\0\x5b\0\0\0\0\0\0" } if v != 4 or c != 1 + return if ! idx = user.index("\0") + { :remote => "#{[o1,o2,o3,o4]*'.'}:#{port}", + :reply => "\0\x5a\0\0\0\0\0\0", + :data => data[idx+9..-1] } + end + + Valid return values ------------------- `{ :remote => String }` - String is the host:port of the backend server that will be proxied. `{ :remote => String, :data => String }` - Same as above, but send the given data instead. +`{ :remote => String, :data => String, :reply => String}` - Same as above, but reply with given data back to the client `{ :noop => true }` - Do nothing. `{ :close => true }` - Close the connection. `{ :close => String }` - Close the connection after sending the String. @@ -118,6 +135,6 @@ Copyright --------- -Copyright (c) 2009 Tom Preston-Werner. See LICENSE for details. \ No newline at end of file +Copyright (c) 2009 Tom Preston-Werner. See LICENSE for details.