Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit 329c2f9

Browse files
committed
feature: modify dfdaemon port validate method, allow to expose more port to listen.
1 parent 06d2368 commit 329c2f9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

dfdaemon/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type Properties struct {
118118

119119
// Validate validates the config
120120
func (p *Properties) Validate() error {
121-
if p.Port <= 2000 || p.Port > 65535 {
121+
if p.Port <= 0 || p.Port > 65535 {
122122
return dferr.Newf(
123123
constant.CodeExitPortInvalid,
124124
"invalid port %d", p.Port,

dfdaemon/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (ts *configTestSuite) TestValidatePort() {
5757
c := defaultConfig()
5858
r := ts.Require()
5959

60-
for _, p := range []uint{0, 80, 2000, 65536} {
60+
for _, p := range []uint{0, 65536} {
6161
c.Port = p
6262
err := c.Validate()
6363
r.NotNil(err)
@@ -66,7 +66,7 @@ func (ts *configTestSuite) TestValidatePort() {
6666
r.Equal(constant.CodeExitPortInvalid, de.Code)
6767
}
6868

69-
for _, p := range []uint{2001, 65001, 65535} {
69+
for _, p := range []uint{80, 2001, 65001, 65535} {
7070
c.Port = p
7171
r.Nil(c.Validate())
7272
}

0 commit comments

Comments
 (0)