Skip to content

Commit

Permalink
Updated README.md and README_en.md;
Browse files Browse the repository at this point in the history
Fixed path separators that caused file-not-found error under Linux

Added auto-build workflow

Added manual starter for the workflow

Adding release tag for the release push

Added release tag for the release push

Added release tag generator for the release push

Fixed permissions for release pushing

Fixed permissions for release pushing
  • Loading branch information
HorizonChaser committed May 24, 2023
1 parent 39f8579 commit c2b858b
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 57 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build_release.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
51 changes: 6 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ groxy 是一个简单的使用 TLS 加密的 TCP 代理, 它会在服务器端
- [x] 导出 TLSKEYLOG 供流量分析
- [x] 支持标准的代理协议
- [x] 支持 SOCKS5 代理
- [x] 支持 HTTP 代理 ~~(很可能不会实现)~~
- [x] 支持 HTTP 代理
- [ ] 捕获客户端所有 TCP 流量
- 可能使用 TUN 配合路由表劫持
- [x] 性能测试
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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 格式
Expand Down Expand Up @@ -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.
5 changes: 3 additions & 2 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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/`.
6 changes: 3 additions & 3 deletions client/groxy_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
14 changes: 7 additions & 7 deletions serv/groxy_server_dconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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())
}
Expand Down

0 comments on commit c2b858b

Please sign in to comment.