fix: tuic server cwnd parsing

This commit is contained in:
wwqgtxx 2023-06-21 14:00:49 +08:00 committed by Larvan2
parent 65f84d21ea
commit 29315ce8e5
3 changed files with 8 additions and 0 deletions

View file

@ -230,6 +230,7 @@ type RawTuicServer struct {
AuthenticationTimeout int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"` AuthenticationTimeout int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"`
ALPN []string `yaml:"alpn" json:"alpn,omitempty"` ALPN []string `yaml:"alpn" json:"alpn,omitempty"`
MaxUdpRelayPacketSize int `yaml:"max-udp-relay-packet-size" json:"max-udp-relay-packet-size,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 { type RawConfig struct {
@ -1304,6 +1305,7 @@ func parseTuicServer(rawTuic RawTuicServer, general *General) error {
AuthenticationTimeout: rawTuic.AuthenticationTimeout, AuthenticationTimeout: rawTuic.AuthenticationTimeout,
ALPN: rawTuic.ALPN, ALPN: rawTuic.ALPN,
MaxUdpRelayPacketSize: rawTuic.MaxUdpRelayPacketSize, MaxUdpRelayPacketSize: rawTuic.MaxUdpRelayPacketSize,
CWND: rawTuic.CWND,
} }
return nil return nil
} }

View file

@ -95,6 +95,7 @@ type tuicServerSchema struct {
AuthenticationTimeout *int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"` AuthenticationTimeout *int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"`
ALPN *[]string `yaml:"alpn" json:"alpn,omitempty"` ALPN *[]string `yaml:"alpn" json:"alpn,omitempty"`
MaxUdpRelayPacketSize *int `yaml:"max-udp-relay-packet-size" json:"max-udp-relay-packet-size,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) { 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 { if p.MaxUdpRelayPacketSize != nil {
def.MaxUdpRelayPacketSize = *p.MaxUdpRelayPacketSize def.MaxUdpRelayPacketSize = *p.MaxUdpRelayPacketSize
} }
if p.CWND != nil {
def.CWND = *p.CWND
}
} }
return def return def
} }

View file

@ -18,6 +18,7 @@ type TuicOption struct {
AuthenticationTimeout int `inbound:"authentication-timeout,omitempty"` AuthenticationTimeout int `inbound:"authentication-timeout,omitempty"`
ALPN []string `inbound:"alpn,omitempty"` ALPN []string `inbound:"alpn,omitempty"`
MaxUdpRelayPacketSize int `inbound:"max-udp-relay-packet-size,omitempty"` MaxUdpRelayPacketSize int `inbound:"max-udp-relay-packet-size,omitempty"`
CWND int `inbound:"cwnd,omitempty"`
} }
func (o TuicOption) Equal(config C.InboundConfig) bool { func (o TuicOption) Equal(config C.InboundConfig) bool {
@ -51,6 +52,7 @@ func NewTuic(options *TuicOption) (*Tuic, error) {
AuthenticationTimeout: options.AuthenticationTimeout, AuthenticationTimeout: options.AuthenticationTimeout,
ALPN: options.ALPN, ALPN: options.ALPN,
MaxUdpRelayPacketSize: options.MaxUdpRelayPacketSize, MaxUdpRelayPacketSize: options.MaxUdpRelayPacketSize,
CWND: options.CWND,
}, },
}, nil }, nil
} }