diff --git a/main.go b/main.go index 4a4be4b6..ee90b773 100644 --- a/main.go +++ b/main.go @@ -62,7 +62,7 @@ func main() { 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.TCP, "tcp", true, "(server-only) enable TCP support") - flag.BoolVar(&config.TCPCork, "tcpcork", false, "(client-only) enable TCP_CORK (Linux) or TCP_NOPUSH (BSD) for the first few packets") + flag.BoolVar(&config.TCPCork, "tcpcork", false, "coalesce writing first few packets") flag.DurationVar(&config.UDPTimeout, "udptimeout", 5*time.Minute, "UDP tunnel timeout") flag.Parse() diff --git a/tcp.go b/tcp.go index 63ecedca..4919ecb0 100644 --- a/tcp.go +++ b/tcp.go @@ -112,6 +112,9 @@ func tcpRemote(addr string, shadow func(net.Conn) net.Conn) { go func() { defer c.Close() + if config.TCPCork { + c = timedCork(c, 10*time.Millisecond, 1280) + } sc := shadow(c) tgt, err := socks.ReadAddr(sc)