Skip to content
forked from ao-space/gt

GT is an open source reverse proxy project that supports peer-to-peer direct connection (P2P) and Internet relay.

License

Notifications You must be signed in to change notification settings

AdachiAndShimamura/gt

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

95 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

็ฎ€ไฝ“ไธญๆ–‡ | English

GT

ไธ€ไธช้ซ˜ๆ€ง่ƒฝ็š„ WebSocket(s)/HTTP(s)/TCP ไธญ่ฝฌไปฃ็†ใ€‚

GitHub (pre-)release GitHub Actions Workflow Status GitHub Downloads (all assets, all releases) GitHub issues GitHub closed issues GitHub

ๅ…ณ้”ฎ่ฎพ่ฎก็‰น็‚น๏ผš

  • ๆณจ้‡็จณๅฎšๆ€ง
    • ้ซ˜ๅฏ็”จ๏ผŒๅฏไปฅๅœจ่ฟ่กŒๆ—ถๅ‡็บง็‰ˆๆœฌ๏ผŒๆ— ้œ€ๆ‹…ๅฟƒ่ฟžๆŽฅไธขๅคฑใ€ๆœๅŠกไธญๆ–ญใ€ๅœๆœบ
    • ๅœจ reload ่ฟ‡็จ‹ไธญ๏ผŒไผšไฟๆŒ่ฝฌๅ‘ๅฏไปฅๆˆๅŠŸใ€‚ๅŽ‹ๅŠ›ๆต‹่ฏ•่ฟ‡็จ‹ไธญ reload๏ผŒๆต‹่ฏ•็ป“ๆžœ 0 error
    • ่ฟ›็จ‹ๅฎˆๆŠค๏ผŒๅทฅไฝœ่ฟ›็จ‹ๅดฉๆบƒ่‡ชๅŠจ้‡ๅฏ
  • ๆณจ้‡ๆ€ง่ƒฝ๏ผŒๅœจไฟๆŒ่ทจๅนณๅฐ็š„ๅ‰ๆไธ‹๏ผŒไผšๅฐ่ฏ•้‡‡็”จๆ€ง่ƒฝๆ›ด้ซ˜็š„ๆŠ€ๆœฏๆ–นๆกˆ
    • ๅ‡ๅฐ‘ๅ†…ๅญ˜ๅˆ†้…ๆฅๅ‡่ฝป GC ่ดŸๆ‹…๏ผš่ต„ๆบๆฑ ๏ผ›LoadOrStore ไป…ๅœจ Store ๆ—ถๆ‰ๅˆ›ๅปบ Value
    • ๅ‡ๅฐ‘ๅ†…ๅญ˜ๅคๅˆถ๏ผšReader ไฝฟ็”จ Peek ๅ’Œ Discard ๅ–ไปฃ Read
    • ้ฟๅ…็ณป็ปŸ่ฐƒ็”จ๏ผšVirtual Listenerใ€Conn ๅฐ†่ฏทๆฑ‚ๆ•ฐๆฎ่ฝฌๅ‘ๅˆฐ่ฟ›็จ‹ๅ†… API ๆœๅŠก
    • ๆ นๆฎไธๅŒ็š„ๅนถๅ‘ๅœบๆ™ฏ๏ผŒไฝฟ็”จ้€‚ๅฝ“็š„ๅนถๅ‘ๆŠ€ๆœฏ
  • ๆณจ้‡ๆ˜“็”จๆ€ง
    • ๆ”ฏๆŒ Web ้…็ฝฎ็ฎก็†
    • ้›ถๅ‚ๆ•ฐ้…็ฝฎๅฏๅŠจ๏ผŒ่ฟ›ๅ…ฅ Web ้…็ฝฎๅˆๅง‹ๅŒ–
    • ๆ”ฏๆŒๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ็›ฎๅฝ•๏ผŒๅฏไปฅๅŒๆ—ถๅฏๅŠจๅคšไธชๆœๅŠก็ซฏๅ’Œๅฎขๆˆท็ซฏ
    • ๅฎขๆˆท็ซฏๆ”ฏๆŒๆŒ‡ๅ‘ๅคšไธชๆœๅŠก
    • ๆœๅŠก็ซฏๆ”ฏๆŒๅคš็”จๆˆทๅŠŸ่ƒฝ
    • ๅฎขๆˆท็ซฏ่‡ชๅŠจๆ นๆฎ็ฝ‘็ปœ็Šถๅ†ต๏ผŒๆ™บ่ƒฝ้€‰ๆ‹ฉไธŽๆœๅŠก็ซฏ็š„้€šไฟกๅ่ฎฎ
  • ๆณจ้‡้š็งไฟๆŠค
    • ๆœๅŠก็ซฏ็š„็ซฏๅฃๅค็”จๅŠŸ่ƒฝ๏ผŒๆ˜ฏๅŸบไบŽๅ่ฎฎ็›ฎๆ ‡็š„็‰นๅพไฝ็ฝฎๆฅๅฎž็Žฐ็š„ใ€‚ไพ‹ๅฆ‚๏ผšๅบ”็”จๅฑ‚ HTTP ๅ่ฎฎ่ฝฌๅ‘๏ผŒๅŸบไบŽ TCP ๆ•ฐๆฎๆต๏ผŒๅชๅฎšไฝ่Žทๅ–็ฌฌไธ€ไธชๆ•ฐๆฎๅŒ…็š„ HTTP ๅ่ฎฎๅคด็š„่ฝฌๅ‘็›ฎๆ ‡๏ผŒ็„ถๅŽๅฐ†ๅŽ็ปญๆ•ฐๆฎ็›ดๆŽฅ่ฝฌๅ‘
    • ไธๆ‰“ๅฐๆ•ๆ„Ÿไฟกๆฏๅˆฐๆ—ฅๅฟ—
    • ๆ”ฏๆŒ HTTPS SNI ็ซฏๅˆฐ็ซฏๅŠ ๅฏ†่ฝฌๅ‘

ๅทฅไฝœๅŽŸ็†

      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚  Web    Android     iOS    PC    ... โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚  GT Server  โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  GT Client  โ”‚   โ”‚  GT Client  โ”‚   โ”‚  GT Client  โ”‚ ...
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚     SSH     โ”‚   โ”‚   HTTP(S)   โ”‚   โ”‚     SMB     โ”‚ ...
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

ไธ‹่ฝฝ

Github

ไปŽ https://github.com/ao-space/gt/releases ้€‰ๆ‹ฉๅˆ้€‚็š„็‰ˆๆœฌไธ‹่ฝฝใ€‚

Docker ๅฎนๅ™จ

ๆ›ดๅคšๅฎนๅ™จ้•œๅƒไฟกๆฏๅฏไปฅไปŽ https://github.com/ao-space/gt/pkgs/container/gt ่Žทๅ–ใ€‚

docker pull ghcr.io/ao-space/gt:server-dev

docker pull ghcr.io/ao-space/gt:client-dev

็”จๆณ•

gt --help
Fast WebSocket(s)/HTTP(s)/TCP relay proxy with WebRTC P2P supports.

Usage: gt [OPTIONS] [COMMAND]

Commands:
  server  Run GT Server
  client  Run GT Client
  help    Print this message or the help of the given subcommand(s)

Options:
  -c, --config <CONFIG>
          Path to the config file or the directory contains the config files

  -s, --signal <SIGNAL>
          Send signal to the running GT processes

          Possible values:
          - reload:  Send reload signal
          - restart: Send restart signal
          - stop:    Send stop signal

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

้…็ฝฎๆ–‡ไปถ

้…็ฝฎๆ–‡ไปถๅฏไปฅ้€š่ฟ‡ Web ็ฎก็†ๅŽๅฐ็ผ–่พ‘็”Ÿๆˆ๏ผŒๆŽจ่็›ดๆŽฅไฝฟ็”จ Web ็ฎก็†ๅŽๅฐ็ผ–่พ‘ใ€‚

ๆœๅŠก็ซฏ

ไฝฟ็”จ้ป˜่ฎค้…็ฝฎ่ฟ่กŒ๏ผŒ่ฟ่กŒๅŽๅฏไปŽๆ—ฅๅฟ—่Žทๅ– Web ็ฎก็†ๅŽๅฐๅœฐๅ€๏ผŒ็”จๆต่งˆๅ™จๆ‰“ๅผ€ๅŽ๏ผŒ่ฟ›่กŒ้…็ฝฎ้กน็ผ–่พ‘๏ผš

gt server

้€š่ฟ‡ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ฟ่กŒ๏ผš

gt server -c ./config.yml

ๅฎขๆˆท็ซฏ

ไฝฟ็”จ้ป˜่ฎค้…็ฝฎ่ฟ่กŒ๏ผŒ่ฟ่กŒๅŽๅฏไปŽๆ—ฅๅฟ—่Žทๅ– Web ็ฎก็†ๅŽๅฐๅœฐๅ€๏ผŒ็”จๆต่งˆๅ™จๆ‰“ๅผ€ๅŽ๏ผŒ่ฟ›่กŒ้…็ฝฎ้กน็ผ–่พ‘๏ผš

gt client

้€š่ฟ‡ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ฟ่กŒ๏ผš

gt client -c ./config.yml

ๆ‰น้‡ๅฏๅŠจ

้€š่ฟ‡ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ็›ฎๅฝ•ๆ‰น้‡ๅฏๅŠจ๏ผš

gt -c ./conf.d

ๆ€ง่ƒฝๆต‹่ฏ•

็ฌฌไธ€็ป„๏ผˆMacOS็Žฏๅขƒ+nginxๆต‹่ฏ•๏ผ‰

้€š่ฟ‡ wrk ่ฟ›่กŒๅŽ‹ๅŠ›ๆต‹่ฏ•ๆœฌ้กน็›ฎไธŽ frp ่ฟ›่กŒๅฏนๆฏ”๏ผŒๅ†…็ฝ‘ๆœๅŠกๆŒ‡ๅ‘ๅœจๆœฌๅœฐ่ฟ่กŒ nginx ็š„ๆต‹่ฏ•้กต้ข๏ผŒๆต‹่ฏ•็ป“ๆžœๅฆ‚ไธ‹๏ผš

Model Name: MacBook Pro
Model Identifier: MacBookPro17,1
Chip: Apple M1
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 16 GB

GT benchmark

$ wrk -c 100 -d 30s -t 10 http://pi.example.com:7001
Running 30s test @ http://pi.example.com:7001
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.22ms  710.73us  37.99ms   98.30%
    Req/Sec     4.60k   231.54     4.86k    91.47%
  1374783 requests in 30.01s, 1.09GB read
Requests/sec:  45811.08
Transfer/sec:     37.14MB

$ ps aux
  PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
 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
 2767   0.0  0.1 408703664  17584 s007  S+    4:55PM   0:52.16 ./server -port 7001

frp dev branch 42745a3

$ wrk -c 100 -d 30s -t 10 http://pi.example.com:7000
Running 30s test @ http://pi.example.com:7000
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    76.92ms   73.46ms 748.61ms   74.21%
    Req/Sec   154.63    308.28     2.02k    93.75%
  45487 requests in 30.10s, 31.65MB read
  Non-2xx or 3xx responses: 20610
Requests/sec:   1511.10
Transfer/sec:      1.05MB

$ ps aux
  PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
 2975   0.3  0.5 408767328  88768 s004  S+    5:01PM   0:21.88 ./frps -c ./frps.ini
 2976   0.0  0.4 408712832  66112 s005  S+    5:01PM   1:06.51 ./frpc -c ./frpc.ini

็ฌฌไบŒ็ป„๏ผˆUbuntu็Žฏๅขƒ+nginxๆต‹่ฏ•๏ผ‰

้€š่ฟ‡ wrk ่ฟ›่กŒๅŽ‹ๅŠ›ๆต‹่ฏ•ๆœฌ้กน็›ฎไธŽ frp ่ฟ›่กŒๅฏนๆฏ”๏ผŒๅ†…็ฝ‘ๆœๅŠกๆŒ‡ๅ‘ๅœจๆœฌๅœฐ่ฟ่กŒ nginx ็š„ๆต‹่ฏ•้กต้ข๏ผŒๆต‹่ฏ•็ป“ๆžœๅฆ‚ไธ‹๏ผš

System: Ubuntu 22.04
Chip: Intel i9-12900
Total Number of Cores: 16 (8 performance and 8 efficiency)
Memory: 32 GB

GT-TCP

$ ./release/linux-amd64-server -addr 12080 -id id1 -secret secret1
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote tcp://id1.example.com:12080 -id id1 -secret secret1

$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080
Running 30s test @ http://id1.example.com:12080
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   558.51us    2.05ms  71.54ms   99.03%
    Req/Sec    24.29k     2.28k   49.07k    95.74%
  7264421 requests in 30.10s, 5.81GB read
Requests/sec: 241344.46
Transfer/sec:    197.70MB

GT-QUIC

$ ./release/linux-amd64-server -addr 12080 -quicAddr 443 -certFile /root/openssl_crt/tls.crt -keyFile /root/openssl_crt/tls.key -id id1 -secret secret1
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote quic://id1.example.com:443 -remoteCertInsecure -id id1 -secret secret1

$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080
Running 30s test @ http://id1.example.com:12080
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   826.65us    1.14ms  66.29ms   98.68%
    Req/Sec    12.91k     1.36k   23.53k    79.43%
  3864241 requests in 30.10s, 3.09GB read
Requests/sec: 128380.49
Transfer/sec:    105.16MB

frp v0.52.1

$ ./frps -c ./frps.toml
$ ./frpc -c ./frpc.toml

$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
Running 30s test @ http://id1.example.com:12080/
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.49ms    8.27ms 154.62ms   92.43%
    Req/Sec     4.02k     2.08k    7.51k    53.21%
  1203236 requests in 30.08s, 0.93GB read
Requests/sec:  40003.03
Transfer/sec:     31.82MB

็ฌฌไธ‰็ป„(Ubuntu็Žฏๅขƒ+short requestๆต‹่ฏ•)

้€š่ฟ‡ wrk ่ฟ›่กŒๅŽ‹ๅŠ›ๆต‹่ฏ•ๆœฌ้กน็›ฎไธŽ frp ่ฟ›่กŒๅฏนๆฏ”๏ผŒๆฏๆฌก่ฏทๆฑ‚ๅชไผš่ฟ”ๅ›žๅฐไบŽ10ๅญ—่Š‚็š„ๅญ—ๆฎตๅ›žๅค๏ผŒ็”จไบŽๆจกๆ‹ŸHTTP short request๏ผŒๆต‹่ฏ•็ป“ๆžœๅฆ‚ไธ‹๏ผš

GT-TCP

$ ./release/linux-amd64-server -addr 12080 -id id1 -secret secret1
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote tcp://id1.example.com:12080 -id id1 -secret secret1

$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
Running 30s test @ http://id1.example.com:12080/
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.55ms   13.48ms 220.23ms   95.31%
    Req/Sec     5.23k     2.11k   12.40k    76.10%
  1557980 requests in 30.06s, 191.67MB read
Requests/sec:  51822.69
Transfer/sec:      6.38MB

GT-QUIC

$ ./release/linux-amd64-server -addr 12080 -quicAddr 443 -certFile /root/openssl_crt/tls.crt -keyFile /root/openssl_crt/tls.key -id id1 -secret secret1
$ ./release/linux-amd64-client -local http://127.0.0.1:80 -remote quic://id1.example.com:443 -remoteCertInsecure -id id1 -secret secret1

$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
Running 30s test @ http://id1.example.com:12080/
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.84ms    6.75ms 168.93ms   98.47%
    Req/Sec     9.33k     2.13k   22.86k    78.54%
  2787908 requests in 30.10s, 342.98MB read
Requests/sec:  92622.63
Transfer/sec:     11.39MB

frp v0.52.1

$ ./frps -c ./frps.toml
$ ./frpc -c ./frpc.toml

$ wrk -c 100 -d 30s -t 10 http://id1.example.com:12080/
Running 30s test @ http://id1.example.com:12080/
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.95ms    3.74ms 136.09ms   91.10%
    Req/Sec     4.16k     1.22k   12.86k    87.85%
  1243103 requests in 30.07s, 152.93MB read
Requests/sec:  41334.52
Transfer/sec:      5.09MB

็คพๅŒบ

ๆฌข่ฟŽๅŠ ๅ…ฅ Slack ้ข‘้“่ฟ›่กŒไบคๆตใ€‚

ๅพฎไฟก็พค๏ผš

ๅฏๆ‰ซๆไธ‹ๆ–นไบŒ็ปด็ ๏ผŒ้‚€่ฏทไฝ ๅŠ ๅ…ฅ GT ็คพๅŒบไบคๆต็พค๏ผŒ่ฏทๅค‡ๆณจ GT

่ดก็Œฎ่€…

ๆ„Ÿ่ฐขไปฅไธ‹ๅผ€ๅ‘่€…ไธบ้กน็›ฎๅšๅ‡บ็š„่ดก็Œฎ๏ผš

About

GT is an open source reverse proxy project that supports peer-to-peer direct connection (P2P) and Internet relay.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 65.3%
  • Vue 11.2%
  • TypeScript 8.2%
  • Rust 6.7%
  • C++ 3.4%
  • Makefile 1.4%
  • Other 3.8%