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 /xray/api.go | |
| parent | e272c160b12ff8ae8d0d3812756e986ace72a924 (diff) | |
refactor: use `math.MaxUint16` when checking port
Diffstat (limited to 'xray/api.go')
| -rw-r--r-- | xray/api.go | 3 |
1 files changed, 2 insertions, 1 deletions
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) } |
