go http3 proxy
1.0.0
使用socks5/udp 伺服器透過HTTP3/QUIC 協定代理請求的簡單範例。
# # Terminal_1
$ go run ./cmd/server
> Server is listening...
# # Terminal_2
$ go run ./cmd/proxy
> Proxy is listening...
# # Terminal_3
# # This terminal depends on Terminal_1 & Terminal_2
$ go run ./cmd/client
> 200 echo: ' hello, server! '
> 200 echo: ' hello, server! '
> 200 echo: ' hello, server! '
...
該範例也可以使用 docker 運行。在這種情況下,使用 make 指令就足夠了,之後 docker-compose 將會建立三個服務: server
、 proxy
和client
。客戶端和伺服器不直接互相通信,而是使用橋接器: client-proxy
和server-proxy
。
$ make
> go-http3-proxy-server-1 | Server is listening...
> go-http3-proxy-proxy-1 | Proxy is listening...
> go-http3-proxy-client-1 | 200 echo: ' hello, server! '
> go-http3-proxy-client-1 | 200 echo: ' hello, server! '
> go-http3-proxy-client-1 | 200 echo: ' hello, server! '
...
version : " 3 "
services :
server :
build :
context : ./
dockerfile : cmd/server/Dockerfile
networks :
- server-proxy
proxy :
build :
context : ./
dockerfile : cmd/proxy/Dockerfile
networks :
- server-proxy
- client-proxy
client :
build :
context : ./
dockerfile : cmd/client/Dockerfile
depends_on :
- proxy
- server
networks :
- client-proxy
networks :
client-proxy :
driver : bridge
server-proxy :
driver : bridge