Skip to content

Commit

Permalink
Option tcpcork works on server-side
Browse files Browse the repository at this point in the history
  • Loading branch information
riobard committed Aug 19, 2020
1 parent d551e24 commit 67ba6d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 3 additions & 0 deletions tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 67ba6d4

Please sign in to comment.