package main import ( "log" "os" "os/signal" "syscall" "net-tunnel/internal/client" pb "net-tunnel/pkg/proto" ) func main() { // 创建客户端 cli := client.NewClient("localhost", 7000) // 添加 TCP 代理示例 cli.AddProxy("ssh", pb.ProxyType_TCP, "127.0.0.1", 22, 2222) // 添加 UDP 代理示例 // cli.AddProxy("dns", pb.ProxyType_UDP, "8.8.8.8", 53, 5353) // 启动客户端 if err := cli.Start(); err != nil { log.Fatalf("Client error: %v", err) } // 等待中断信号 sig := make(chan os.Signal, 1) signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM) <-sig // 优雅关闭 cli.Stop() }