Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpwnnex <eternxles@gmail.com>2026-04-22 18:55:27 +0300
committerpwnnex <eternxles@gmail.com>2026-04-22 18:55:27 +0300
commit17f67ef3a51537cbb32b2fcd3884c26434f4ee62 (patch)
tree162690874adadab6ea67c89e3ce25cf1ce47930b
parenteb4791a1cdabebbf0b0d5a81a40ecc7d88924656 (diff)
sub: dont panic on bad externalProxy entry in genHysteriaLink
The externalProxy fanout from #4073 did `int(ep["port"].(float64))` with no ok-check. If any entry is missing port or has the wrong type it panics, and since this runs in the /sub/<id> handler the whole subscription returns 500. Skip malformed entries instead.
-rw-r--r--sub/subService.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/sub/subService.go b/sub/subService.go
index 44549390..272bf9d5 100644
--- a/sub/subService.go
+++ b/sub/subService.go
@@ -987,12 +987,18 @@ func (s *SubService) genHysteriaLink(inbound *model.Inbound, email string) strin
if len(externalProxies) > 0 {
links := make([]string, 0, len(externalProxies))
for _, externalProxy := range externalProxies {
- ep, _ := externalProxy.(map[string]interface{})
+ ep, ok := externalProxy.(map[string]interface{})
+ if !ok {
+ continue
+ }
dest, _ := ep["dest"].(string)
- epPort := int(ep["port"].(float64))
+ portF, okPort := ep["port"].(float64)
+ if dest == "" || !okPort {
+ continue
+ }
epRemark, _ := ep["remark"].(string)
- link := fmt.Sprintf("%s://%s@%s:%d", protocol, auth, dest, epPort)
+ link := fmt.Sprintf("%s://%s@%s:%d", protocol, auth, dest, int(portF))
u, _ := url.Parse(link)
q := u.Query()
for k, v := range params {