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