Skip to content

Commit 049c0ec

Browse files
committed
fix(util/ExtractListenPort): enlarge acceptable port number
1 parent 69d524d commit 049c0ec

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/util/hostname.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func ExtractListenPort(listen string) string {
3535
} else {
3636
lenListen := len(listen)
3737
if (lenListen < 5 && IsDigits(listen)) ||
38-
(lenListen == 5 && strings.Compare(listen, "65535") == -1) {
38+
(lenListen == 5 && listen < "65536") {
3939
return listen
4040
}
4141
}

src/util/hostname_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func TestExtractListenPort(t *testing.T) {
6464
t.Error(1)
6565
}
6666

67+
if ExtractListenPort("65535") != "65535" {
68+
t.Error(1)
69+
}
70+
6771
if ExtractListenPort("65536") != "" {
6872
t.Error(1)
6973
}

0 commit comments

Comments
 (0)