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:
authorMHSanaei <ho3ein.sanaei@gmail.com>2026-04-20 14:44:52 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2026-04-20 14:44:52 +0300
commit0a424a9f160b0193bd8064b94e54aa1bfb9f0de5 (patch)
tree0c35f76a40c8817da6dad8587f49da9536a52a59
parent36b2a586756fc279304170976c9d486498d55919 (diff)
Use vnext/users structure for VLESS outbound
Replace the previous flat settings map for VLESS outbound with a vnext/users structure. Encryption is now pulled from inbound settings into the user object, a level field (8) is added, and client id and flow are preserved. Address and port are nested under vnext and outbound.Settings is set to {vnext: [...]}, aligning the outbound format with the expected VLESS schema. Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
-rw-r--r--sub/subJsonService.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/sub/subJsonService.go b/sub/subJsonService.go
index 72c5c6f1..05552fe8 100644
--- a/sub/subJsonService.go
+++ b/sub/subJsonService.go
@@ -322,22 +322,30 @@ func (s *SubJsonService) genVless(inbound *model.Inbound, streamSettings json_ut
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 client.Flow != "" {
- settings["flow"] = client.Flow
- }
// Add encryption for VLESS outbound from inbound settings
var inboundSettings map[string]any
json.Unmarshal([]byte(inbound.Settings), &inboundSettings)
- if encryption, ok := inboundSettings["encryption"].(string); ok {
- settings["encryption"] = encryption
+ encryption, _ := inboundSettings["encryption"].(string)
+
+ user := map[string]any{
+ "id": client.ID,
+ "level": 8,
+ "encryption": encryption,
+ }
+ if client.Flow != "" {
+ user["flow"] = client.Flow
}
- outbound.Settings = settings
+ vnext := map[string]any{
+ "address": inbound.Listen,
+ "port": inbound.Port,
+ "users": []any{user},
+ }
+
+ outbound.Settings = map[string]any{
+ "vnext": []any{vnext},
+ }
result, _ := json.MarshalIndent(outbound, "", " ")
return result
}