Add command line client with SOCKS
Adds a command line client for the outline-ss-server. This should help with easier prototyping of features without having to go through the whole stack.
It starts a SOCKS server, accepts TCP connections and proxies them to the configured outline server. Non-goals for this PR (can be added later):
- UDP
- Automatically setting the system proxy
--
Two decisions I made which are worth discussing:
-
Should it have a separate
mainor should we implement it as part of the same (server) binary and distinguish between running the server and client using a flag (similar to what go-shadowsocks2 does). I prefer separate myself and thats what I went with (though maybe we want to restructure packages a bit), let me know if you think it's better to go with a single binary. -
How should the client take in the server configurations (e.g, host, port, password)
- Using separate flags
go run cmd/client -p port -s server -m cipher -k password - Using configuration file
go run cmd/client -c config.yamlThis will have to be a different config format that the one used for the server since the client can't take multiple keys - Using a single flag to pass in key url
go run cmd/client -k ss://[email protected]:8080This is the one I'm going with right now. I'm not sure if the way I parse the key is fully compilable with SIP002 but I think its compilable enough (?).
- Using separate flags
Thanks for the quick reviews!!
@ha-D I found https://github.com/things-go/go-socks5. It seems it's a lot easier to use that library, and it supports UDP too.
I think all you need to do is call NewServer with https://pkg.go.dev/github.com/things-go/go-socks5#WithDial, taking a wrapped Shadowsocks client as the Dialer.