From c4371a6ab856a78c209804347b4170266c5f5bf3 Mon Sep 17 00:00:00 2001 From: Riobard Date: Sun, 9 Aug 2020 13:03:39 +0800 Subject: [PATCH] Add a toggle to disable TCP mode --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 02f2b90e..281b6a8a 100644 --- a/main.go +++ b/main.go @@ -39,6 +39,7 @@ func main() { UDPTun string UDPSocks bool UDP bool + TCP bool Plugin string PluginOpts string } @@ -59,6 +60,7 @@ func main() { flag.StringVar(&flags.Plugin, "plugin", "", "Enable SIP003 plugin. (e.g., v2ray-plugin)") flag.StringVar(&flags.PluginOpts, "plugin-opts", "", "Set SIP003 plugin options. (e.g., \"server;tls;host=mydomain.me\")") flag.BoolVar(&flags.UDP, "udp", false, "(server-only) enable UDP support") + flag.BoolVar(&flags.UDP, "tcp", true, "(server-only) enable TCP support") flag.DurationVar(&config.UDPTimeout, "udptimeout", 5*time.Minute, "UDP tunnel timeout") flag.Parse() @@ -171,7 +173,9 @@ func main() { if flags.UDP { go udpRemote(udpAddr, ciph.PacketConn) } - go tcpRemote(addr, ciph.StreamConn) + if flags.TCP { + go tcpRemote(addr, ciph.StreamConn) + } } sigCh := make(chan os.Signal, 1)