Documentation
¶
Overview ¶
Package main provides a simple example of using the tunnel package.
This example demonstrates: - Starting a Gateway server - Connecting an Agent to the Gateway - Registering services and proxying HTTP requests
Usage:
# Run all components together (gateway + agent + backend) go run ./core/tunnel/example/main.go # Run with different transport protocols go run ./core/tunnel/example/main.go -transport=quic go run ./core/tunnel/example/main.go -transport=kcp # Run components separately (in different terminals) go run ./core/tunnel/example/main.go -mode=backend go run ./core/tunnel/example/main.go -mode=gateway go run ./core/tunnel/example/main.go -mode=agent # Verify request routing curl http://127.0.0.1:18080/demo-svc/hello
Directories
¶
| Path | Synopsis |
|---|---|
|
Demo: 代理鉴权 —— 配置 TUNNEL_AUTH_TOKEN 后,HTTP 代理要求客户端携带 token。
|
Demo: 代理鉴权 —— 配置 TUNNEL_AUTH_TOKEN 后,HTTP 代理要求客户端携带 token。 |
|
Demo: gRPC over tunnel —— 经网关 gRPC 代理调用后端 gRPC 服务。
|
Demo: gRPC over tunnel —— 经网关 gRPC 代理调用后端 gRPC 服务。 |
|
Demo: 最简上手 —— Standalone Agent + HTTP 代理(单进程跑通)。
|
Demo: 最简上手 —— Standalone Agent + HTTP 代理(单进程跑通)。 |
|
Demo: TLS 传输 —— Agent ↔ Gateway 之间启用 TLS(yamux over TLS)。
|
Demo: TLS 传输 —— Agent ↔ Gateway 之间启用 TLS(yamux over TLS)。 |
Click to show internal directories.
Click to hide internal directories.