diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-06-17 18:45:03 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-17 18:45:03 +0300 |
| commit | f86219f4de750c2ee2654c7e09435a608c894443 (patch) | |
| tree | c8c0cbb64c732ad7ec6286aa89819f0eed401084 /web | |
| parent | e272c160b12ff8ae8d0d3812756e986ace72a924 (diff) | |
refactor: use `math.MaxUint16` when checking port
Diffstat (limited to 'web')
| -rw-r--r-- | web/entity/entity.go | 5 |
1 files changed, 3 insertions, 2 deletions
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) } |
