return TCPing test + External proxy should no longer show : null (#1621)

When Subscription Json is enabled in Alireza x-ui +v1.10.0
- TCPing test in apps such as v2rayNG should return again
- External proxy should no longer show ": null"
also:
- Preserves VMess compatibility properly
- Keeps level consistent
- Avoids empty flow
- Matches standard Xray schema precisely
This commit is contained in:
Davood Qorbani
2026-02-27 00:39:20 +01:00
committed by GitHub
parent 49e43a2079
commit a3df597b5d

View File

@@ -309,19 +309,39 @@ func (s *SubJsonService) genVnext(inbound *model.Inbound, streamSettings json_ut
outbound.Protocol = string(inbound.Protocol)
outbound.Tag = "proxy"
if s.mux != "" {
outbound.Mux = json_util.RawMessage(s.mux)
}
outbound.StreamSettings = streamSettings
settings := make(map[string]any)
settings["address"] = inbound.Listen
settings["port"] = inbound.Port
settings["id"] = client.ID
if inbound.Protocol == model.VLESS {
settings["flow"] = client.Flow
settings["encryption"] = encryption
// Build standard Xray/V2Ray schema
user := map[string]any{
"id": client.ID,
"level": 8,
}
if inbound.Protocol == model.VLESS {
user["encryption"] = encryption
if client.Flow != "" {
user["flow"] = client.Flow
}
} else {
// VMess
user["alterId"] = 0
user["security"] = "auto"
}
vnext := map[string]any{
"address": inbound.Listen,
"port": inbound.Port,
"users": []any{user},
}
outbound.Settings = map[string]any{
"vnext": []any{vnext},
}
outbound.Settings = settings
result, _ := json.MarshalIndent(outbound, "", " ")
return result