mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-07-02 17:29:54 +00:00
feat: add UDPIdleTimeout to server config
This commit is contained in:
parent
fb7e6ed915
commit
fd4d095dcd
@ -32,15 +32,16 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type serverConfig struct {
|
type serverConfig struct {
|
||||||
Listen string `mapstructure:"listen"`
|
Listen string `mapstructure:"listen"`
|
||||||
Obfs serverConfigObfs `mapstructure:"obfs"`
|
Obfs serverConfigObfs `mapstructure:"obfs"`
|
||||||
TLS *serverConfigTLS `mapstructure:"tls"`
|
TLS *serverConfigTLS `mapstructure:"tls"`
|
||||||
ACME *serverConfigACME `mapstructure:"acme"`
|
ACME *serverConfigACME `mapstructure:"acme"`
|
||||||
QUIC serverConfigQUIC `mapstructure:"quic"`
|
QUIC serverConfigQUIC `mapstructure:"quic"`
|
||||||
Bandwidth serverConfigBandwidth `mapstructure:"bandwidth"`
|
Bandwidth serverConfigBandwidth `mapstructure:"bandwidth"`
|
||||||
DisableUDP bool `mapstructure:"disableUDP"`
|
DisableUDP bool `mapstructure:"disableUDP"`
|
||||||
Auth serverConfigAuth `mapstructure:"auth"`
|
UDPIdleTimeout time.Duration `mapstructure:"udpIdleTimeout"`
|
||||||
Masquerade serverConfigMasquerade `mapstructure:"masquerade"`
|
Auth serverConfigAuth `mapstructure:"auth"`
|
||||||
|
Masquerade serverConfigMasquerade `mapstructure:"masquerade"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type serverConfigObfsSalamander struct {
|
type serverConfigObfsSalamander struct {
|
||||||
@ -235,6 +236,11 @@ func (c *serverConfig) fillDisableUDP(hyConfig *server.Config) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *serverConfig) fillUDPIdleTimeout(hyConfig *server.Config) error {
|
||||||
|
hyConfig.UDPIdleTimeout = c.UDPIdleTimeout
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *serverConfig) fillAuthenticator(hyConfig *server.Config) error {
|
func (c *serverConfig) fillAuthenticator(hyConfig *server.Config) error {
|
||||||
if c.Auth.Type == "" {
|
if c.Auth.Type == "" {
|
||||||
return configError{Field: "auth.type", Err: errors.New("empty auth type")}
|
return configError{Field: "auth.type", Err: errors.New("empty auth type")}
|
||||||
@ -304,6 +310,7 @@ func (c *serverConfig) Config() (*server.Config, error) {
|
|||||||
c.fillQUICConfig,
|
c.fillQUICConfig,
|
||||||
c.fillBandwidthConfig,
|
c.fillBandwidthConfig,
|
||||||
c.fillDisableUDP,
|
c.fillDisableUDP,
|
||||||
|
c.fillUDPIdleTimeout,
|
||||||
c.fillAuthenticator,
|
c.fillAuthenticator,
|
||||||
c.fillEventLogger,
|
c.fillEventLogger,
|
||||||
c.fillMasqHandler,
|
c.fillMasqHandler,
|
||||||
|
@ -55,7 +55,8 @@ func TestServerConfig(t *testing.T) {
|
|||||||
Up: "500 mbps",
|
Up: "500 mbps",
|
||||||
Down: "100 mbps",
|
Down: "100 mbps",
|
||||||
},
|
},
|
||||||
DisableUDP: true,
|
DisableUDP: true,
|
||||||
|
UDPIdleTimeout: 120 * time.Second,
|
||||||
Auth: serverConfigAuth{
|
Auth: serverConfigAuth{
|
||||||
Type: "password",
|
Type: "password",
|
||||||
Password: "goofy_ahh_password",
|
Password: "goofy_ahh_password",
|
||||||
|
@ -35,6 +35,7 @@ bandwidth:
|
|||||||
down: 100 mbps
|
down: 100 mbps
|
||||||
|
|
||||||
disableUDP: true
|
disableUDP: true
|
||||||
|
udpIdleTimeout: 120s
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
type: password
|
type: password
|
||||||
|
Loading…
x
Reference in New Issue
Block a user