Skip to content

Commit

Permalink
Add a toggle to disable TCP mode
Browse files Browse the repository at this point in the history
  • Loading branch information
riobard committed Aug 9, 2020
1 parent 5b9e5a6 commit c4371a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func main() {
UDPTun string
UDPSocks bool
UDP bool
TCP bool
Plugin string
PluginOpts string
}
Expand All @@ -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")

This comment has been minimized.

Copy link
@dev4u

dev4u Aug 9, 2020

is it typo? may be it is "&flags.TCP".

This comment has been minimized.

Copy link
@riobard

riobard Aug 9, 2020

Author

Ah, right!

flag.DurationVar(&config.UDPTimeout, "udptimeout", 5*time.Minute, "UDP tunnel timeout")
flag.Parse()

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c4371a6

Please sign in to comment.