Skip to content

Commit fb09998

Browse files
committed
ws path, and documentation
1 parent ce1606a commit fb09998

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cdn2proxy.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func StartServer(port, destAddr string, logOutput io.Writer) (err error) {
4141

4242
// HTTP server
4343
Logger.Printf("websocket server listening on 127.0.0.1:%s", port)
44-
http.HandleFunc("/ws", serveWS)
44+
http.HandleFunc("/", serveWS)
4545
err = http.ListenAndServe("127.0.0.1:"+port, nil)
4646
if err != nil {
4747
Logger.Fatal(err)
@@ -96,10 +96,13 @@ func serveWS(w http.ResponseWriter, r *http.Request) {
9696
}
9797

9898
// StartProxy on client side, start a socks5 proxy
99-
// url: websocket server
100-
// addr: local proxy address
101-
// proxy: proxy for websocket connection, eg. socks5://127.0.0.1:1080
102-
// doh: DNS over HTTPS server, eg. https://9.9.9.9/dns-query
99+
// url: websocket server. eg: wss://example.com/path/to/ws
100+
// use wss instead of ws since your reverse proxy (nginx, Cloudflare)
101+
// should be using TLS
102+
// addr: local proxy address, used as agent's outgoing proxy
103+
// proxy: proxy for websocket connection, if you cannot directly connect to ws server, use this
104+
// eg. socks5://127.0.0.1:1080
105+
// doh: DNS over HTTPS server, eg. https://9.9.9.9/dns-query, prevent DNS leaks
103106
func StartProxy(addr, wsurl, proxy, doh string) error {
104107
ctx, cancel := context.WithCancel(context.Background())
105108
listener, err := net.Listen("tcp", addr)

0 commit comments

Comments
 (0)