diff --git a/app/cmd/server.go b/app/cmd/server.go index 6617d26..e5b097b 100644 --- a/app/cmd/server.go +++ b/app/cmd/server.go @@ -32,15 +32,16 @@ func init() { } type serverConfig struct { - Listen string `mapstructure:"listen"` - Obfs serverConfigObfs `mapstructure:"obfs"` - TLS *serverConfigTLS `mapstructure:"tls"` - ACME *serverConfigACME `mapstructure:"acme"` - QUIC serverConfigQUIC `mapstructure:"quic"` - Bandwidth serverConfigBandwidth `mapstructure:"bandwidth"` - DisableUDP bool `mapstructure:"disableUDP"` - Auth serverConfigAuth `mapstructure:"auth"` - Masquerade serverConfigMasquerade `mapstructure:"masquerade"` + Listen string `mapstructure:"listen"` + Obfs serverConfigObfs `mapstructure:"obfs"` + TLS *serverConfigTLS `mapstructure:"tls"` + ACME *serverConfigACME `mapstructure:"acme"` + QUIC serverConfigQUIC `mapstructure:"quic"` + Bandwidth serverConfigBandwidth `mapstructure:"bandwidth"` + DisableUDP bool `mapstructure:"disableUDP"` + UDPIdleTimeout time.Duration `mapstructure:"udpIdleTimeout"` + Auth serverConfigAuth `mapstructure:"auth"` + Masquerade serverConfigMasquerade `mapstructure:"masquerade"` } type serverConfigObfsSalamander struct { @@ -235,6 +236,11 @@ func (c *serverConfig) fillDisableUDP(hyConfig *server.Config) error { return nil } +func (c *serverConfig) fillUDPIdleTimeout(hyConfig *server.Config) error { + hyConfig.UDPIdleTimeout = c.UDPIdleTimeout + return nil +} + func (c *serverConfig) fillAuthenticator(hyConfig *server.Config) error { if c.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.fillBandwidthConfig, c.fillDisableUDP, + c.fillUDPIdleTimeout, c.fillAuthenticator, c.fillEventLogger, c.fillMasqHandler, diff --git a/app/cmd/server_test.go b/app/cmd/server_test.go index 72700f6..614bdfd 100644 --- a/app/cmd/server_test.go +++ b/app/cmd/server_test.go @@ -55,7 +55,8 @@ func TestServerConfig(t *testing.T) { Up: "500 mbps", Down: "100 mbps", }, - DisableUDP: true, + DisableUDP: true, + UDPIdleTimeout: 120 * time.Second, Auth: serverConfigAuth{ Type: "password", Password: "goofy_ahh_password", diff --git a/app/cmd/server_test.yaml b/app/cmd/server_test.yaml index 74eea8f..48744f5 100644 --- a/app/cmd/server_test.yaml +++ b/app/cmd/server_test.yaml @@ -35,6 +35,7 @@ bandwidth: down: 100 mbps disableUDP: true +udpIdleTimeout: 120s auth: type: password