From 32b3dc65a054ec5f296ec473749e351e83426a08 Mon Sep 17 00:00:00 2001 From: Toby Date: Mon, 23 Aug 2021 14:38:10 -0700 Subject: [PATCH] Add an option to disable MTU discovery --- cmd/client.go | 1 + cmd/config.go | 20 +++++++++++--------- cmd/server.go | 1 + go.mod | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/client.go b/cmd/client.go index 4a635fb..c9b9484 100644 --- a/cmd/client.go +++ b/cmd/client.go @@ -57,6 +57,7 @@ func client(config *clientConfig) { InitialConnectionReceiveWindow: config.ReceiveWindow, MaxConnectionReceiveWindow: config.ReceiveWindow, KeepAlive: true, + DisablePathMTUDiscovery: config.DisableMTUDiscovery, EnableDatagrams: true, } if config.ReceiveWindowConn == 0 { diff --git a/cmd/config.go b/cmd/config.go index 1723c94..800c9a5 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -42,6 +42,7 @@ 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"` } func (c *serverConfig) Check() error { @@ -115,15 +116,16 @@ type clientConfig struct { Listen string `json:"listen"` Timeout int `json:"timeout"` } `json:"tproxy_udp"` - ACL string `json:"acl"` - Obfs string `json:"obfs"` - Auth []byte `json:"auth"` - AuthString string `json:"auth_str"` - ServerName string `json:"server_name"` - Insecure bool `json:"insecure"` - CustomCA string `json:"ca"` - ReceiveWindowConn uint64 `json:"recv_window_conn"` - ReceiveWindow uint64 `json:"recv_window"` + ACL string `json:"acl"` + Obfs string `json:"obfs"` + Auth []byte `json:"auth"` + AuthString string `json:"auth_str"` + 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"` } func (c *clientConfig) Check() error { diff --git a/cmd/server.go b/cmd/server.go index c237620..dc56dfe 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -61,6 +61,7 @@ func server(config *serverConfig) { MaxConnectionReceiveWindow: config.ReceiveWindowClient, MaxIncomingStreams: int64(config.MaxConnClient), KeepAlive: true, + DisablePathMTUDiscovery: config.DisableMTUDiscovery, EnableDatagrams: true, } if config.ReceiveWindowConn == 0 { diff --git a/go.mod b/go.mod index 944d3d7..25910f6 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e github.com/eycorsican/go-tun2socks v1.16.11 github.com/hashicorp/golang-lru v0.5.4 - github.com/lucas-clemente/quic-go v0.20.1 + github.com/lucas-clemente/quic-go v0.22.0 github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/prometheus/client_golang v1.11.0