From b593df44b75b4ca21bef62bbfe736fffe0bc9116 Mon Sep 17 00:00:00 2001 From: Toby Date: Thu, 3 Feb 2022 20:37:08 -0800 Subject: [PATCH 1/2] feat: disable quic-go PMTUD due to broken implementation --- cmd/client.go | 2 +- cmd/config.go | 26 ++++++++++++-------------- cmd/server.go | 2 +- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cmd/client.go b/cmd/client.go index ac9bc58..dffb732 100644 --- a/cmd/client.go +++ b/cmd/client.go @@ -67,7 +67,7 @@ func client(config *clientConfig) { InitialConnectionReceiveWindow: config.ReceiveWindow, MaxConnectionReceiveWindow: config.ReceiveWindow, KeepAlive: true, - DisablePathMTUDiscovery: config.DisableMTUDiscovery, + DisablePathMTUDiscovery: true, // Ref: https://github.com/lucas-clemente/quic-go/issues/3327 EnableDatagrams: true, } if config.ReceiveWindowConn == 0 { diff --git a/cmd/config.go b/cmd/config.go index 742e4d3..2049599 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -49,7 +49,6 @@ type serverConfig struct { ReceiveWindowConn uint64 `json:"recv_window_conn"` ReceiveWindowClient uint64 `json:"recv_window_client"` MaxConnClient int `json:"max_conn_client"` - DisableMTUDiscovery bool `json:"disable_mtu_discovery"` IPv6Only bool `json:"ipv6_only"` Resolver string `json:"resolver"` } @@ -139,19 +138,18 @@ type clientConfig struct { Listen string `json:"listen"` Timeout int `json:"timeout"` } `json:"tproxy_udp"` - ACL string `json:"acl"` - MMDB string `json:"mmdb"` - Obfs string `json:"obfs"` - Auth []byte `json:"auth"` - AuthString string `json:"auth_str"` - ALPN string `json:"alpn"` - ServerName string `json:"server_name"` - Insecure bool `json:"insecure"` - CustomCA string `json:"ca"` - ReceiveWindowConn uint64 `json:"recv_window_conn"` - ReceiveWindow uint64 `json:"recv_window"` - DisableMTUDiscovery bool `json:"disable_mtu_discovery"` - Resolver string `json:"resolver"` + ACL string `json:"acl"` + MMDB string `json:"mmdb"` + Obfs string `json:"obfs"` + Auth []byte `json:"auth"` + AuthString string `json:"auth_str"` + ALPN string `json:"alpn"` + ServerName string `json:"server_name"` + Insecure bool `json:"insecure"` + CustomCA string `json:"ca"` + ReceiveWindowConn uint64 `json:"recv_window_conn"` + ReceiveWindow uint64 `json:"recv_window"` + Resolver string `json:"resolver"` } func (c *clientConfig) Check() error { diff --git a/cmd/server.go b/cmd/server.go index 5d6eec6..081bf7d 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -70,7 +70,7 @@ func server(config *serverConfig) { MaxConnectionReceiveWindow: config.ReceiveWindowClient, MaxIncomingStreams: int64(config.MaxConnClient), KeepAlive: true, - DisablePathMTUDiscovery: config.DisableMTUDiscovery, + DisablePathMTUDiscovery: true, // Ref: https://github.com/lucas-clemente/quic-go/issues/3327 EnableDatagrams: true, } if config.ReceiveWindowConn == 0 { From a4a4130ba128df47782ca06807818300f612af19 Mon Sep 17 00:00:00 2001 From: Toby Date: Thu, 3 Feb 2022 20:54:30 -0800 Subject: [PATCH 2/2] fix: zero initMaxDatagramSize in brutal CC (wtf...) --- pkg/congestion/brutal.go | 5 ++++- pkg/congestion/pacer.go | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/congestion/brutal.go b/pkg/congestion/brutal.go index 71d3467..f11ef46 100644 --- a/pkg/congestion/brutal.go +++ b/pkg/congestion/brutal.go @@ -6,6 +6,8 @@ import ( ) const ( + initMaxDatagramSize = 1252 + pktInfoSlotCount = 4 minSampleCount = 50 minAckRate = 0.75 @@ -28,7 +30,8 @@ type pktInfo struct { func NewBrutalSender(bps congestion.ByteCount) *BrutalSender { bs := &BrutalSender{ - bps: bps, + bps: bps, + maxDatagramSize: initMaxDatagramSize, } bs.pacer = newPacer(func() congestion.ByteCount { return congestion.ByteCount(float64(bs.bps) / bs.getAckRate()) diff --git a/pkg/congestion/pacer.go b/pkg/congestion/pacer.go index 100b14f..d074ac0 100644 --- a/pkg/congestion/pacer.go +++ b/pkg/congestion/pacer.go @@ -7,9 +7,8 @@ import ( ) const ( - initMaxDatagramSize = 1252 - maxBurstPackets = 10 - minPacingDelay = time.Millisecond + maxBurstPackets = 10 + minPacingDelay = time.Millisecond ) // The pacer implements a token bucket pacing algorithm.