Uses inbound spx value if available.

The update allows the use of a inbound `spx` value from the reality settings for Vless and Trojan links, if one is provided. This provides more flexibility and customization options.

Previously, a random `spx` value was always generated. which could override the inbound settings.
This commit is contained in:
Sudo Space 2026-02-06 21:11:34 +03:30
parent d8fb09faae
commit 670710a084

View file

@ -469,7 +469,11 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
params["pqv"] = pqv
}
}
params["spx"] = "/" + random.Seq(15)
if spxValue, ok := searchKey(realitySettings, "spx"); ok {
if spx, ok := spxValue.(string); ok && len(spx) > 0 {
params["spx"] = spx
}
}
}
if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 {
@ -666,7 +670,11 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
params["pqv"] = pqv
}
}
params["spx"] = "/" + random.Seq(15)
if spxValue, ok := searchKey(realitySettings, "spx"); ok {
if spx, ok := spxValue.(string); ok && len(spx) > 0 {
params["spx"] = spx
}
}
}
if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 {