Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
feature: modify dfdaemon port validate method, allow to expose more p…
Browse files Browse the repository at this point in the history
…ort to listen.

Signed-off-by: komey <[email protected]>
  • Loading branch information
Komey committed Apr 25, 2020
1 parent 06d2368 commit c84e38d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dfdaemon/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions dfdaemon/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())
}
Expand Down

0 comments on commit c84e38d

Please sign in to comment.