From c84e38d4cc3e7cee5f9846b1d20ab3255ac0c97c Mon Sep 17 00:00:00 2001 From: komey Date: Sat, 25 Apr 2020 16:41:55 +0800 Subject: [PATCH] feature: modify dfdaemon port validate method, allow to expose more port to listen. Signed-off-by: komey --- dfdaemon/config/config.go | 2 +- dfdaemon/config/config_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dfdaemon/config/config.go b/dfdaemon/config/config.go index c2df6153d..cc1dcfc8f 100644 --- a/dfdaemon/config/config.go +++ b/dfdaemon/config/config.go @@ -118,7 +118,7 @@ type Properties struct { // Validate validates the config func (p *Properties) Validate() error { - if p.Port <= 2000 || p.Port > 65535 { + if p.Port <= 0 || p.Port > 65535 { return dferr.Newf( constant.CodeExitPortInvalid, "invalid port %d", p.Port, diff --git a/dfdaemon/config/config_test.go b/dfdaemon/config/config_test.go index d688b1bac..f0b232884 100644 --- a/dfdaemon/config/config_test.go +++ b/dfdaemon/config/config_test.go @@ -57,7 +57,7 @@ func (ts *configTestSuite) TestValidatePort() { c := defaultConfig() r := ts.Require() - for _, p := range []uint{0, 80, 2000, 65536} { + for _, p := range []uint{0, 65536} { c.Port = p err := c.Validate() r.NotNil(err) @@ -66,7 +66,7 @@ func (ts *configTestSuite) TestValidatePort() { r.Equal(constant.CodeExitPortInvalid, de.Code) } - for _, p := range []uint{2001, 65001, 65535} { + for _, p := range []uint{80, 2001, 65001, 65535} { c.Port = p r.Nil(c.Validate()) }