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

Commit

Permalink
Merge pull request #1300 from Komey/feature_expose_more_ports
Browse files Browse the repository at this point in the history
feature: allow dfdaemon to listen port on 0~65535
  • Loading branch information
lowzj committed Apr 26, 2020
2 parents 06d2368 + c84e38d commit 97d20db
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 97d20db

Please sign in to comment.