diff --git a/.github/workflows/build_release.yaml b/.github/workflows/build_release.yaml new file mode 100644 index 0000000..262de18 --- /dev/null +++ b/.github/workflows/build_release.yaml @@ -0,0 +1,60 @@ +name: Build Groxy and Release Binaries + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +permissions: + contents: write + +jobs: + + build_and_push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + + - name: Build Groxy in Linux x64 + run: go build -v -o ./groxy_linux_x64 ./groxy.go + + - name: Build Groxy in Windows x64 + run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v -o ./groxy_windows_x64.exe ./groxy.go + + - name: Build Groxy in Darwin x64 + run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -v -o ./groxy_darwin_x64 ./groxy.go + + - name: Build simple_serv in Linux x64 + run: go build -v -o ./simple_serv_linux_x64 ./testSuites/simple_serv.go + + - name: Build Groxy in Windows x64 + run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v -o ./simple_serv_windows_x64.exe ./testSuites/simple_serv.go + + - name: Build Groxy in Darwin x64 + run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -v -o ./simple_serv_darwin_x64 ./testSuites/simple_serv.go + + - name: Generate release tag + id: tag + run: | + echo "::set-output name=release_tag::Groxy_Build_$(date +"%Y.%m.%d_%H-%M")" + + - name: Release + uses: softprops/action-gh-release@v1 + with: # 将下述可执行文件 release 上 去 + tag_name: ${{ steps.tag.outputs.release_tag }} + files: | + groxy_linux_x64 + groxy_windows_x64.exe + groxy_darwin_x64 + simple_serv_linux_x64 + simple_serv_windows_x64.exe + simple_serv_darwin_x64 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index fb9a10f..5e33153 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ groxy 是一个简单的使用 TLS 加密的 TCP 代理, 它会在服务器端 - [x] 导出 TLSKEYLOG 供流量分析 - [x] 支持标准的代理协议 - [x] 支持 SOCKS5 代理 - - [x] 支持 HTTP 代理 ~~(很可能不会实现)~~ + - [x] 支持 HTTP 代理 - [ ] 捕获客户端所有 TCP 流量 - 可能使用 TUN 配合路由表劫持 - [x] 性能测试 @@ -25,7 +25,7 @@ groxy 是一个简单的使用 TLS 加密的 TCP 代理, 它会在服务器端 ### 客户端 ```shell -./groxy_client --help +./groxy -c --help Usage of groxy_client: -insecureCert Is insecure cert (self-signed cert) allowed on serverside (default true) @@ -44,7 +44,7 @@ Usage of groxy_client: ### 服务器端 ```shell -./groxy_server --help +./groxy -s --help Usage of groxy_server: -cert string Certificate file that TLS requires, in PEM format (default "server.pem") @@ -59,7 +59,6 @@ Usage of groxy_server: Address that remote application exists (default "127.0.0.1") -remotePort int Port that remote application exists (default 55590) - -v Enable verbose output (default true) ``` 注意证书需要是 pem 格式 @@ -89,46 +88,8 @@ go build ./groxy_server.go ./common_def.go go build ./groxy_client.go ./common_def.go ``` +预构建的二进制文件在 `./build/` 下 + ## 压力测试 -### gin + https - -```plain -Server Software: -Server Hostname: 127.0.0.1 -Server Port: 55590 -SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128 -Server Temp Key: X25519 253 bits - -Document Path: /test -Document Length: 20 bytes - -Concurrency Level: 1000 -Time taken for tests: 12.128 seconds -Complete requests: 10000 -Failed requests: 0 -Total transferred: 1370000 bytes -HTML transferred: 200000 bytes -Requests per second: 824.52 [#/sec] (mean) -Time per request: 1212.832 [ms] (mean) -Time per request: 1.213 [ms] (mean, across all concurrent requests) -Transfer rate: 110.31 [Kbytes/sec] received - -Connection Times (ms) - min mean[+/-sd] median max -Connect: 4 813 274.6 701 1257 -Processing: 110 356 192.3 324 941 -Waiting: 0 171 84.2 141 849 -Total: 594 1169 293.9 1307 1918 - -Percentage of the requests served within a certain time (ms) - 50% 1307 - 66% 1395 - 75% 1402 - 80% 1405 - 90% 1477 - 95% 1490 - 98% 1909 - 99% 1911 - 100% 1918 (longest request) -``` +To be finished. diff --git a/README_en.md b/README_en.md index 4f0d52b..9c26522 100644 --- a/README_en.md +++ b/README_en.md @@ -8,7 +8,7 @@ The server side and client side groxy will each expose one port for applications - [x] Implement TCP tunnel - [x] Support SOCKS5 proxy -- [x] Support HTTP proxy (not likely to be implemented) +- [x] Support HTTP proxy - [ ] Capture and forward all TCP traffic on client side - possibly implemented by using TUN device and route table hooking - [x] Use a connection pool to optimize performance @@ -53,7 +53,6 @@ Usage of groxy_server: Address that remote application exists (default "127.0.0.1") -remotePort int Port that remote application exists (default 55590) - -v Enable verbose output (default true) ``` To be noticed that the certificate should be in `pem` format. @@ -82,3 +81,5 @@ go build ./groxy_server.go ./common_def.go #Client side go build ./groxy_client.go ./common_def.go ``` + +Pre-built executable binaries for Linux and Windows available in `./build/`. diff --git a/client/groxy_client.go b/client/groxy_client.go index b9f4ffb..8cb2e93 100644 --- a/client/groxy_client.go +++ b/client/groxy_client.go @@ -660,10 +660,10 @@ func ClientMain() { insecureCertAllowed := flag.Bool("insecureCert", true, "Is insecure cert (self-signed cert) allowed on serverside") clientLogLevel := *flag.Int("logLevel", 2, "Logging level from 0 (quite) to 2 (debug)") isMTLS := flag.Bool("mtls", false, "Is mTLS enabled") - caCert := flag.String("cacert", ".\\certs\\ca.crt", "CA cert used in mTLS mode") + caCert := flag.String("cacert", "./certs/ca.crt", "CA cert used in mTLS mode") clientMode := flag.String("clientMode", "raw", "Client listen-and-proxying mode (raw, socks5, http)") - cert := flag.String("cert", ".\\certs\\client.crt", "Cert that client holds in mTLS mode") - key := flag.String("key", ".\\certs\\client.key", "Key that client holds in mTLS mode") + cert := flag.String("cert", "./certs/client.crt", "Cert that client holds in mTLS mode") + key := flag.String("key", "./certs/client.key", "Key that client holds in mTLS mode") flag.Parse() diff --git a/serv/groxy_server_dconn.go b/serv/groxy_server_dconn.go index 535d3dc..0d1b4fe 100644 --- a/serv/groxy_server_dconn.go +++ b/serv/groxy_server_dconn.go @@ -32,16 +32,16 @@ some notes about differences between .key, .pem and .crt files func parseServerCArgs() *ServerConfig { localAddr := flag.String("localAddr", "127.0.0.1", "Address that this groxy server will listen at") localPort := flag.Int("localPort", 38620, "Port that this groxy server will listen on") - certFile := flag.String("cert", ".\\certs\\server.pem", "Certificate file that TLS requires, in PEM format") - keyFile := flag.String("key", ".\\certs\\server.key", "Key file for TLS encryption") + certFile := flag.String("cert", "./certs/server.pem", "Certificate file that TLS requires, in PEM format") + keyFile := flag.String("key", "./certs/server.key", "Key file for TLS encryption") remoteAddr := flag.String("remoteAddr", "127.0.0.1", "Address that remote application exists") remotePort := flag.Int("remotePort", 55590, "Port that remote application exists") servLogLevel := *flag.Int("logLevel", 2, "Logging level from 0 (quite) to 2 (debug)") isMTLS := flag.Bool("mtls", false, "Is mTLS enabled") serverMode := flag.String("serverMode", "dynamic", "Server Mode (dynamic or legacy)") - caCert := flag.String("cacert", ".\\certs\\ca.crt", "CA cert used in mTLS mode") + caCert := flag.String("cacert", "./certs/ca.crt", "CA cert used in mTLS mode") isKeyLoggerEnabled := flag.Bool("keyLogger", false, "Is key logger enabled (FOR AUDIT PURPOSE ONLY)") - keyLoggerPath := flag.String("keyloggerPath", ".\\TLS_KEY_LOG", "Key logger file path (FOR AUDIT PURPOSE ONLY)") + keyLoggerPath := flag.String("keyloggerPath", "./TLS_KEY_LOG", "Key logger file path (FOR AUDIT PURPOSE ONLY)") flag.Parse() @@ -100,7 +100,7 @@ func serverDconnInit(config ServerConfig) { panic(err) } - var tlsConf *tls.Config + var tlsConf tls.Config tlsConf.MinVersion = tls.VersionTLS13 // set to TLS 1.3 according to the thesis if config.IsMTLS { @@ -112,7 +112,7 @@ func serverDconnInit(config ServerConfig) { caCertPool := x509.NewCertPool() caCertPool.AppendCertsFromPEM(caCertFile) - tlsConf = &tls.Config{ + tlsConf = tls.Config{ Certificates: []tls.Certificate{cert}, ClientCAs: caCertPool, ClientAuth: tls.RequireAndVerifyClientCert, // client MUST provide cert in mTLS mode @@ -132,7 +132,7 @@ func serverDconnInit(config ServerConfig) { } // listen TLS connections on specific port and addr - clientListen, err := tls.Listen("tcp4", config.LocalAddr+":"+strconv.Itoa(config.LocalPort), tlsConf) + clientListen, err := tls.Listen("tcp4", config.LocalAddr+":"+strconv.Itoa(config.LocalPort), &tlsConf) if err != nil { panic("handleClient::failed to TLS listen: " + err.Error()) }