clowwindy/shadowsocks-go — pull request #1 by cyfdecyf (2012-12-07 05:19:17+00:00)
Title: Export shadowsocks with a net.Conn interface

I created a `shadowsocks.Conn` type which exposes the `net.Conn` interface. `shadowsocks.Conn`'s read and write function will take care of encrypting and decrypting, so it can be used as a normal `net.Conn` after creation.

I used this `shadowsocks.Conn` to rewrite both the server and client (just a few lines of chage) and it works fine. Tested with both shadowsocks-go and shadowsocks-nodejs server.

With `shadowsocks.Conn`, it's very easy for third party application to directly support shadowsocks-go. I've successfully implemented this feature in my own HTTP proxy COW. ([This file](https://github.com/cyfdecyf/cow/blob/develop/shadowsocks.go) shows how I added support for shadowsocks in COW.)