Skip to content

Commit 444686f

Browse files
committed
doc(gt): update readme
1 parent 3f67e59 commit 444686f

File tree

3 files changed

+367
-24
lines changed

3 files changed

+367
-24
lines changed

.github/workflows/container.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
release/*
128128
129129
130-
build-liunx:
130+
build-linux:
131131
runs-on: ubuntu-22.04
132132
permissions:
133133
contents: read
@@ -374,7 +374,7 @@ jobs:
374374
cache-to: type=gha,mode=max
375375
file: Dockerfile-client
376376

377-
build-x8664-macos:
377+
build-macos-x86_64:
378378
runs-on: macos-13
379379
permissions:
380380
contents: read
@@ -423,7 +423,7 @@ jobs:
423423
path: |
424424
release/*
425425
426-
build-arm64-macos:
426+
build-macos-arm64:
427427
runs-on: macos-14
428428
permissions:
429429
contents: read

README.en.md

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
[简体中文](./README.md) | English
2+
3+
<h1 align="center">GT</h1>
4+
5+
<div align="center">
6+
7+
A fast WebSocket(s)/HTTP(s)/TCP relay proxy with WebRTC P2P supports.
8+
9+
[![GitHub (pre-)release](https://img.shields.io/github/release/ao-space/gt/all.svg)](https://github.com/ao-space/gt/releases) [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ao-space/gt/.github%2Fworkflows%2Fcontainer.yml)](https://github.com/ao-space/gt/actions) [![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/ao-space/gt/total)](https://github.com/ao-space/gt/releases) [![GitHub issues](https://img.shields.io/github/issues/ao-space/gt.svg)](https://github.com/ao-space/gt/issues) [![GitHub closed issues](https://img.shields.io/github/issues-closed/ao-space/gt.svg)](https://github.com/ao-space/gt/issues?q=is%3Aissue+is%3Aclosed) [![GitHub](https://img.shields.io/github/license/ao-space/gt.svg)](./LICENSE)
10+
11+
</div>
12+
13+
**Key Design Features:**
14+
15+
- **Stability**
16+
- Highly available, can upgrade versions on the fly without worrying about connection loss, service interruptions, or downtime.
17+
- During reload, forwarding is maintained successfully. During stress testing, reload resulted in 0 errors.
18+
- Process supervision ensures that worker processes automatically restart if they crash.
19+
20+
- **Performance**
21+
- Aiming for higher performance while maintaining cross-platform compatibility, employing more efficient technical solutions.
22+
- Minimize memory allocation to ease the burden on the garbage collector: use resource pools; instantiate a Value in LoadOrStore only during the Store operation.
23+
- Minimize memory copying: Reader uses Peek and Discard instead of Read.
24+
- Avoid system calls: Virtual Listener and Conn forward request data to in-process API services.
25+
- Utilize appropriate concurrency techniques for different concurrency scenarios.
26+
27+
- **Usability**
28+
- Supports web-based configuration management.
29+
- Zero-parameter startup initiates web configuration setup.
30+
- Supports loading configuration file directories, allowing simultaneous startup of multiple servers and clients.
31+
- Clients can point to multiple services.
32+
- Server supports multi-user functionality.
33+
- Clients intelligently choose the communication protocol with the server based on network conditions.
34+
35+
- **Privacy Protection**
36+
- The server's port reuse feature is based on the characteristic position of the protocol target. For instance, when forwarding HTTP protocol at the application layer, it is based on the TCP data stream, targeting only the first packet's HTTP protocol header for forwarding, then directly forwarding subsequent data.
37+
- Does not log sensitive information.
38+
- Supports HTTPS SNI for end-to-end encryption forwarding.
39+
40+
## Working Principle
41+
42+
```text
43+
┌──────────────────────────────────────┐
44+
│ Web Android iOS PC ... │
45+
└──────────────────┬───────────────────┘
46+
┌──────┴──────┐
47+
│ GT Server │
48+
└──────┬──────┘
49+
┌─────────────────┼─────────────────┐
50+
┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
51+
│ GT Client │ │ GT Client │ │ GT Client │ ...
52+
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
53+
┌──────┴──────┐ ┌──────┴──────┐ ┌──────┴──────┐
54+
│ SSH │ │ HTTP(S) │ │ SMB │ ...
55+
└─────────────┘ └─────────────┘ └─────────────┘
56+
```
57+
58+
## Download
59+
60+
### Github
61+
62+
Choose the appropriate version to download from [https://github.com/ao-space/gt/releases](https://github.com/ao-space/gt/releases).
63+
64+
### Docker Container
65+
66+
More container image information can be found at [https://github.com/ao-space/gt/pkgs/container/gt](https://github.com/ao-space/gt/pkgs/container/gt).
67+
68+
```shell
69+
docker pull ghcr.io/ao-space/gt:server-dev
70+
71+
docker pull ghcr.io/ao-space/gt:client-dev
72+
```
73+
74+
## Usage
75+
76+
```shell
77+
gt --help
78+
Fast WebSocket(s)/HTTP(s)/TCP relay proxy with WebRTC P2P supports.
79+
80+
Usage: gt [OPTIONS] [COMMAND]
81+
82+
Commands:
83+
server Run GT Server
84+
client Run GT Client
85+
help Print this message or the help of the given subcommand(s)
86+
87+
Options:
88+
-c, --config <CONFIG>
89+
Path to the config file or the directory containing the config files
90+
91+
-s, --signal <SIGNAL>
92+
Send signal to the running GT processes
93+
94+
Possible values:
95+
- reload: Send reload signal
96+
- restart: Send restart signal
97+
- stop: Send stop signal
98+
99+
-h, --help
100+
Print help (see a summary with '-h')
101+
102+
-V, --version
103+
Print version
104+
```
105+
106+
## Configuration File
107+
108+
Configuration files can be edited and generated through the web management backend.
109+
110+
### Server
111+
112+
Run with default configuration, after which you can obtain the web management backend address from the logs, open it with a browser, and edit the configuration items:
113+
114+
```shell
115+
gt server
116+
```
117+
118+
Run with a specified configuration file:
119+
120+
```shell
121+
gt server -c ./config.yml
122+
```
123+
124+
### Client
125+
126+
Run with default configuration, after which you can obtain the web management backend address from the logs, open it with a browser, and edit the configuration items:
127+
128+
```shell
129+
gt client
130+
```
131+
132+
Run with a specified configuration file:
133+
134+
```shell
135+
gt client -c ./config.yml
136+
```
137+
138+
### Batch Startup
139+
140+
Batch startup by specifying the configuration file directory:
141+
142+
```shell
143+
gt -c ./conf.d
144+
```
145+
146+
## Performance Testing
147+
148+
### Group 1 (MacOS Environment + Nginx Test)
149+
150+
Stress test comparison between this project and frp using wrk, with the internal network service pointing to the local nginx test page, results as follows:
151+
152+
```text
153+
Model Name: MacBook Pro
154+
Model Identifier: MacBookPro17,1
155+
Chip: Apple M1
156+
Total Number of Cores: 8 (4 performance and 4 efficiency)
157+
Memory: 16 GB
158+
```
159+
160+
#### GT Benchmark
161+
162+
```shell
163+
$ wrk -c 100 -d 30s -t 10 http://pi.example.com:7001
164+
Running 30s test @ http://pi.example.com:7001
165+
10 threads and 100 connections
166+
Thread Stats Avg Stdev Max +/- Stdev
167+
Latency 2.22ms 710.73us 37.99ms 98.30%
168+
Req/Sec 4.60k 231.54 4.86k 91.47%
169+
1374783 requests in 30.01s, 1.09GB read
170+
Requests/sec: 45811.08
171+
Transfer/sec: 37.14MB
172+
173+
$ ps aux
174+
PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
175+
2768 0.0 0.1 408697792 17856 s008 S+ 4:55PM 0:52.34 ./client -local http://localhost:8080 -remote tcp://localhost:7001 -id pi -threads 3
176+
2767 0.0 0.1 408703664 17584 s007 S+ 4:55PM 0:52.16 ./server -port 7001
177+
```
178+
179+
#### frp dev branch 42745a3
180+
181+
```shell
182+
$ wrk -c 100 -d 30s -t 10 http://pi.example.com:7000
183+
Running 30s test @ http://pi.example.com:7000
184+
10 threads and 100 connections
185+
Thread Stats Avg Stdev Max +/- Stdev
186+
Latency 76.92ms 73.46ms 748.61ms 74.21%
187+
Req/Sec 154.63 308.28 2.02k 93.75%
188+
45487 requests in 30.10s, 31.65MB read
189+
Non-2xx or 3xx responses: 20610
190+
Requests/sec: 1511.10
191+
Transfer/sec: 1.05MB
192+
193+
$ ps aux
194+
PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
195+
2975 0.3 0.5 408767328 88768 s004 S+ 5:01PM 0:21.88 ./frps -c ./frps.ini
196+
2976 0.0 0.4 408712832 66112 s005 S+ 5:01PM 1:06.51 ./frpc -c ./frpc.ini
197+
```
198+
199+
### Group 2 (Ubuntu Environment + Nginx Test)
200+
201+
Stress test comparison between this project and frp using wrk, with the internal network service pointing to the local nginx test page, results as follows:
202+
203+
```text
204+
System: Ubuntu 22.04
205+
Chip: Intel i9-12900
206+
Total Number of Cores: 16 (8 performance and 8 efficiency)
207+
Memory: 32 GB
208+
```
209+
210+
#### GT-TCP
211+
212+
```shell
213+
$ ./release/linux-amd64-server -addr 12080 -id id1 -secret secret1
214+
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote tcp://id1.example.com:12080 -id id1 -secret secret1
215+
216+
$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080
217+
Running 30s test @ http://id1.example.com:12080
218+
10 threads and 100 connections
219+
Thread Stats Avg Stdev Max +/- Stdev
220+
Latency 558.51us 2.05ms 71.54ms 99.03%
221+
Req/Sec 24.29k 2.28k 49.07k 95.74%
222+
7264421 requests in 30.10s, 5.81GB read
223+
Requests/sec: 241344.46
224+
Transfer/sec: 197.70MB
225+
```
226+
227+
#### GT-QUIC
228+
229+
```shell
230+
$ ./release/linux-amd64-server -addr 12080 -quicAddr 443 -certFile /root/openssl_crt/tls.crt -keyFile /root/openssl_crt/tls.key -id id1 -secret secret1
231+
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote quic://id1.example.com:443 -remoteCertInsecure -id id1 -secret secret1
232+
233+
$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080
234+
Running 30s test @ http://id1.example.com:12080
235+
10 threads and 100 connections
236+
Thread Stats Avg Stdev Max +/- Stdev
237+
Latency 826.65us 1.14ms 66.29ms 98.68%
238+
Req/Sec 12.91k 1.36k 23.53k 79.43%
239+
3864241 requests in 30.10s, 3.09GB read
240+
Requests/sec: 128380.49
241+
Transfer/sec: 105.16MB
242+
```
243+
244+
#### frp v0.52.1
245+
246+
```shell
247+
$ ./frps -c ./frps.toml
248+
$ ./frpc -c ./frpc.toml
249+
250+
$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
251+
Running 30s test @ http://id1.example.com:12080/
252+
10 threads and 100 connections
253+
Thread Stats Avg Stdev Max +/- Stdev
254+
Latency 4.49ms 8.27ms 154.62ms 92.43%
255+
Req/Sec 4.02k 2.08k 7.51k 53.21%
256+
1203236 requests in 30.08s, 0.93GB read
257+
Requests/sec: 40003.03
258+
Transfer/sec: 31.82MB
259+
```
260+
261+
### Group 3 (Ubuntu Environment + Short Request Test)
262+
263+
Stress test comparison between this project and frp using wrk, where each request only returns a field response of less than 10 bytes, simulating HTTP short requests, results as follows:
264+
265+
#### GT-TCP
266+
267+
```shell
268+
$ ./release/linux-amd64-server -addr 12080 -id id1 -secret secret1
269+
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote tcp://id1.example.com:12080 -id id1 -secret secret1
270+
271+
$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
272+
Running 30s test @ http://id1.example.com:12080/
273+
10 threads and 100 connections
274+
Thread Stats Avg Stdev Max +/- Stdev
275+
Latency 4.55ms 13.48ms 220.23ms 95.31%
276+
Req/Sec 5.23k 2.11k 12.40k 76.10%
277+
1557980 requests in 30.06s, 191.67MB read
278+
Requests/sec: 51822.69
279+
Transfer/sec: 6.38MB
280+
```
281+
282+
#### GT-QUIC
283+
284+
```shell
285+
$ ./release/linux-amd64-server -addr 12080 -quicAddr 443 -certFile /root/openssl_crt/tls.crt -keyFile /root/openssl_crt/tls.key -id id1 -secret secret1
286+
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote quic://id1.example.com:443 -remoteCertInsecure -id id1 -secret secret1
287+
288+
$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
289+
Running 30s test @ http://id1.example.com:12080/
290+
10 threads and 100 connections
291+
Thread Stats Avg Stdev Max +/- Stdev
292+
Latency 1.84ms 6.75ms 168.93ms 98.47%
293+
Req/Sec 9.33k 2.13k 22.86k 78.54%
294+
2787908 requests in 30.10s, 342.98MB read
295+
Requests/sec: 92622.63
296+
Transfer/sec: 11.39MB
297+
```
298+
299+
#### frp v0.52.1
300+
301+
```shell
302+
$ ./frps -c ./frps.toml
303+
$ ./frpc -c ./frpc.toml
304+
305+
$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
306+
Running 30s test @ http://id1.example.com:12080/
307+
10 threads and 100 connections
308+
Thread Stats Avg Stdev Max +/- Stdev
309+
Latency 2.95ms 3.74ms 136.09ms 91.10%
310+
Req/Sec 4.16k 1.22k 12.86k 87.85%
311+
1243103 requests in 30.07s, 152.93MB read
312+
Requests/sec: 41334.52
313+
Transfer/sec: 5.09MB
314+
```
315+
316+
## Community
317+
318+
Welcome to join the [Slack](https://slack.ao.space) channel for discussions.
319+
320+
## Contributors
321+
322+
Thank you to the following developers for their contributions to the project:
323+
324+
- [zhiyi](https://github.com/vyloy)
325+
- [jianti](https://github.com/FH0)
326+
- [huwf5](https://github.com/huwf5)
327+
- [AdachiAndShimamura](https://github.com/AdachiAndShimamura)
328+
- [DrakenLibra](https://github.com/DrakenLibra)

0 commit comments

Comments
 (0)