I implemented a HTTP CONNECT-only proxy server in Go, where the endpoint can be a local executable on the proxy server. W/o the executable it's just a standalone HTTP CONNECT proxy server (which can be useful in itself).

It was my first Go program, and I was pleasantly surprised.

I have a desire to do some dynamic redirections based on the requested hostname/port - these redirections would be best served with a shell script.

My exact use-case is that I'd like to be able to connect to VNC ports of KVM VMs in remote datacenters where the host & VNC port may change. I figure it'd be nice to be able to say, "vncviewer appvm01.domain:0" and have the CONNECT to appvm01.domain:5900 lookup the VM->host+vncport relationship for that VM. I may have to use tsocks for VNC clients that don't support a HTTP proxy. If I can find a good free VNC client with proxy support for Windows (know of any?) then I can give Windows-only support staff the same functionality.

Anyway, the code's at http://github.com/rmt/httpconnectproxy

— by Robert Thomson, created 13th Mar, 2011, last modified 13th Mar, 2011 | Tags: Tech