Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ cmd/client/main.go `客户端主启动程`
Input server listen address, for example: 16.158.6.16:18181
-type string #设置流量混淆类型
Input traffic obfuscation type (simple/random, not secure encryption): (default "random")
-recv string #设置上游协议模式
Upstream protocol mode: http or socks5 (default http)
```

## TODO
Expand Down
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func handleProxyRequest(localClient *net.TCPConn, serverAddr *net.TCPAddr, auth
}()

wg.Wait()
} else {
} else if recvHTTPProto == "socks5" {
// 本地的内容copy到远程端
go func() {
defer wg.Done()
Expand All @@ -148,6 +148,8 @@ func handleProxyRequest(localClient *net.TCPConn, serverAddr *net.TCPAddr, auth
SecureCopy(dstServer, localClient, auth.Decrypt)
}()
wg.Wait()
} else {
return errors.New("recv 参数仅支持 http 或 socks5")
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func main() {
serverAddr := flag.String("server", "", "Input server listen address:")
passwd := flag.String("passwd", "", "Input server proxy password:")
encrytype := flag.String("type", "random", "Input traffic obfuscation type (simple/random, not secure encryption):")
recvHTTPProto := flag.String("recv", "http", "use http or sock5 protocol(default http):")
recvHTTPProto := flag.String("recv", "http", "Upstream protocol mode: http or socks5 (default http):")
flag.Parse()
if *serverAddr == "" {
log.Fatal("请输入正确的远程地址")
Expand All @@ -21,7 +21,7 @@ func main() {
log.Fatal("请通过 -passwd 设置一个强密码(不能为空)")
}
log.Println("客户端正在启动...")
log.Println(&recvHTTPProto)
log.Println("recv proto:", *recvHTTPProto)
if err := socks5proxy.Client(*listenAddr, *serverAddr, *encrytype, *passwd, *recvHTTPProto); err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

func TestConncet(t *testing.T) {
go Server("127.0.0.1:18189", "random", "abcedfg")
go Client("127.0.0.1:18190", "127.0.0.1:18189", "random", "abcedfg", "sock5")
go Client("127.0.0.1:18190", "127.0.0.1:18189", "random", "abcedfg", "socks5")

time.Sleep(1 * time.Second)

Expand Down
Loading