From a3df597b5d8310f6961db3ecdfe3083acfd7e7f4 Mon Sep 17 00:00:00 2001 From: Davood Qorbani Date: Fri, 27 Feb 2026 00:39:20 +0100 Subject: [PATCH] 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 --- sub/subJsonService.go | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/sub/subJsonService.go b/sub/subJsonService.go index 322e1adc..efdd6798 100644 --- a/sub/subJsonService.go +++ b/sub/subJsonService.go @@ -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