Advice on a TCP passthru daemon for HTTP proxy rotation

Robin Haswell rob at digital-crocus.com
Thu Aug 10 05:59:06 EDT 2006


Hey there

Soon we will have many squid proxies on many seperate connections for use
by our services. I want to make them available to users via a single HTTP
proxy - however, I want fine-grained control over how the squid proxies
are selected for each connection. This is so I can collect statistics,
control usage on each proxy, monitor what's going on - etc. However I
don't want to implement the HTTP proxy protocol in Python, and would
much rather let my daemon run as a man-in-the-middle for TCP, similar to
this netcat command:

rob at aranea:~$ mknod backpipe p
rob at aranea:~$ nc -l -p 8080 < backpipe | nc ganesh 8080 > backpipe

Basically when my daemon received a connection (call it "c1"), it makes a
connection to one of my squid proxies ("c2"), then all data which gets
read from c1 is written to c2 - all data read from c2 is written to c1.
I'm pretty sure there's an elegant way to do this but I was wondering if
anyone had any input? I've tried GIYF'ing this but it's difficult to
search for :P

Thanks guys

-Rob



More information about the Python-list mailing list