From 919daf0dbb7cf3b50b725384f8d6102f317426fe Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Wed, 21 Jun 2023 14:00:49 +0800 Subject: [PATCH] fix: tuic server cwnd parsing --- config/config.go | 2 ++ hub/route/configs.go | 4 ++++ listener/inbound/tuic.go | 2 ++ 3 files changed, 8 insertions(+) diff --git a/config/config.go b/config/config.go index 0e161ddd..e2e96936 100644 --- a/config/config.go +++ b/config/config.go @@ -230,6 +230,7 @@ type RawTuicServer struct { AuthenticationTimeout int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"` ALPN []string `yaml:"alpn" json:"alpn,omitempty"` MaxUdpRelayPacketSize int `yaml:"max-udp-relay-packet-size" json:"max-udp-relay-packet-size,omitempty"` + CWND int `yaml:"cwnd" json:"cwnd,omitempty"` } type RawConfig struct { @@ -1304,6 +1305,7 @@ func parseTuicServer(rawTuic RawTuicServer, general *General) error { AuthenticationTimeout: rawTuic.AuthenticationTimeout, ALPN: rawTuic.ALPN, MaxUdpRelayPacketSize: rawTuic.MaxUdpRelayPacketSize, + CWND: rawTuic.CWND, } return nil } diff --git a/hub/route/configs.go b/hub/route/configs.go index a8c24f90..cb7c93f6 100644 --- a/hub/route/configs.go +++ b/hub/route/configs.go @@ -95,6 +95,7 @@ type tuicServerSchema struct { AuthenticationTimeout *int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"` ALPN *[]string `yaml:"alpn" json:"alpn,omitempty"` MaxUdpRelayPacketSize *int `yaml:"max-udp-relay-packet-size" json:"max-udp-relay-packet-size,omitempty"` + CWND *int `yaml:"cwnd" json:"cwnd,omitempty"` } func getConfigs(w http.ResponseWriter, r *http.Request) { @@ -211,6 +212,9 @@ func pointerOrDefaultTuicServer(p *tuicServerSchema, def LC.TuicServer) LC.TuicS if p.MaxUdpRelayPacketSize != nil { def.MaxUdpRelayPacketSize = *p.MaxUdpRelayPacketSize } + if p.CWND != nil { + def.CWND = *p.CWND + } } return def } diff --git a/listener/inbound/tuic.go b/listener/inbound/tuic.go index 2e234e2d..bf448d31 100644 --- a/listener/inbound/tuic.go +++ b/listener/inbound/tuic.go @@ -18,6 +18,7 @@ type TuicOption struct { AuthenticationTimeout int `inbound:"authentication-timeout,omitempty"` ALPN []string `inbound:"alpn,omitempty"` MaxUdpRelayPacketSize int `inbound:"max-udp-relay-packet-size,omitempty"` + CWND int `inbound:"cwnd,omitempty"` } func (o TuicOption) Equal(config C.InboundConfig) bool { @@ -51,6 +52,7 @@ func NewTuic(options *TuicOption) (*Tuic, error) { AuthenticationTimeout: options.AuthenticationTimeout, ALPN: options.ALPN, MaxUdpRelayPacketSize: options.MaxUdpRelayPacketSize, + CWND: options.CWND, }, }, nil }