Add websocket tunneling support
Three main things here:
-
websocket/websocket.go: Takes thewebsocket.Connfrom the gorilla/websocket package and wraps it in a struct that implements theonet.DuplexConninterface. With this, we can treat a websocket connection as a normal streaming protocol similar to TCP. -
websocket.go: ImplementsRunWebsocketServerwhich starts a websocket server on 443. The websocket server expects to see a port number in the URL path of connections, and it uses that to multiplex the connection to their respectiveTCPServices. -
client/websocket.go: Implementsclient.NewWebsocketClientwhich is similar toclient.NewClientexcept that instead of a plain TCP connection, it sends the Shadowsocks content over a websocket connection.
--
This is only TCP for now, however a similar thing can be done for UDP in a separate PR.