This is a pretty special-case utility, but I happened to have a use for it, so maybe someone else will too. It’s released under GPL v2.

Basically, it’s a lightweight, non-caching, transparent HTTP proxy which relays through an upstream SOCKS4a server. It’s designed for Linux, but is fairly generic so should probably work on other UNIX OSes too.

It uses 1 thread per connection, and select() internally to do relaying in both directions. This also means it supports HTTP 1.1 features like chunked encoding, keep-alive, and pipelining.

Known limitation: It can’t currently handle HTTP connections to ports other than 80.

Download: transockproxy.c

To compile:
gcc -O2 -o transockproxy transockproxy.c -lpthread

To use:
./transockproxy <listen port> <socks server> <socks port>

For example, to listen on port 1888 and relay via a SOCKS4a server on
./transockproxy 1888 1080

You may also wish to redirect HTTP requests to it via iptables, via something like:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to 1888

This entry was posted on Tuesday, May 8th, 2012 at 4:57 AM and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

Comments are closed.