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 --- xray/api.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xray') diff --git a/xray/api.go b/xray/api.go index 3a2dddd6..d68b1f96 100644 --- a/xray/api.go +++ b/xray/api.go @@ -6,6 +6,7 @@ import ( "fmt" "regexp" "time" + "math" "x-ui/logger" "x-ui/util/common" @@ -32,7 +33,7 @@ type XrayAPI struct { } func (x *XrayAPI) Init(apiPort int) error { - if apiPort <= 0 { + if apiPort <= 0 || apiPort > math.MaxUint16 { return fmt.Errorf("invalid Xray API port: %d", apiPort) } -- cgit v1.2.3