fix(sub): pass numeric XMUX counts to Clash reuse-settings (#6843)

Inbound XMUX counts such as maxConnections are stored as JSON numbers, but
buildXhttpClashOpts kept only string values, so the panel default
maxConnections: 3 never reached Clash/Mihomo clients. Numeric values are now
rendered as plain integers (FormatFloat, so 1000000 does not become 1e+06) and
zero values are still dropped.
This commit is contained in:
Murphy Shannon
2026-10-24 10:51:16 +08:00
committed by GitHub
parent 2f62dadd25
commit 864cbd234a
2 changed files with 41 additions and 2 deletions
+9 -2
View File
@@ -1018,8 +1018,15 @@ func buildXhttpClashOpts(xhttp map[string]any) map[string]any {
{"hMaxRequestTimes", "h-max-request-times"},
{"hMaxReusableSecs", "h-max-reusable-secs"},
} {
if v, ok := xmux[f.src].(string); ok && v != "" {
reuse[f.dst] = v
v, ok := nonZeroShareValue(xmux[f.src])
if !ok {
continue
}
if n, isFloat := v.(float64); isFloat {
// JSON numbers decode as float64, and %v would render 1000000 as "1e+06".
reuse[f.dst] = strconv.FormatFloat(n, 'f', -1, 64)
} else {
reuse[f.dst] = fmt.Sprint(v)
}
}
if v, ok := nonZeroShareValue(xmux["hKeepAlivePeriod"]); ok {