From f86219f4de750c2ee2654c7e09435a608c894443 Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Tue, 17 Jun 2025 22:45:03 +0700 Subject: refactor: use `math.MaxUint16` when checking port --- web/entity/entity.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'web/entity') diff --git a/web/entity/entity.go b/web/entity/entity.go index 543b80e0..889c9024 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -5,6 +5,7 @@ import ( "net" "strings" "time" + "math" "x-ui/util/common" ) @@ -78,11 +79,11 @@ func (s *AllSetting) CheckValid() error { } } - if s.WebPort <= 0 || s.WebPort > 65535 { + if s.WebPort <= 0 || s.WebPort > math.MaxUint16 { return common.NewError("web port is not a valid port:", s.WebPort) } - if s.SubPort <= 0 || s.SubPort > 65535 { + if s.SubPort <= 0 || s.SubPort > math.MaxUint16 { return common.NewError("Sub port is not a valid port:", s.SubPort) } -- cgit v1.2.3