This commit is contained in:
Nikita Nemirovsky 2026-04-02 04:07:17 +00:00 committed by GitHub
commit 3aa4ac1684
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 84 additions and 54 deletions

View file

@ -435,8 +435,8 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
}
}
if security == "reality" {
params["security"] = "reality"
// Extract Reality params unconditionally so they're available when
// externalProxy overrides security to "reality" via forceTls.
realitySetting, _ := stream["realitySettings"].(map[string]any)
realitySettings, _ := searchKey(realitySetting, "settings")
if realitySetting != nil {
@ -464,6 +464,9 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
params["spx"] = "/" + random.Seq(15)
}
if security == "reality" {
params["security"] = "reality"
if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 {
params["flow"] = clients[clientIndex].Flow
}
@ -489,6 +492,14 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
} else {
params["security"] = security
}
// Allow externalProxy to override SNI (useful when the
// inbound has extra serverNames for fallback routing that
// should not appear in subscription links).
if sni, ok := ep["sni"].(string); ok && len(sni) > 0 {
params["sni"] = sni
}
url, _ := url.Parse(link)
q := url.Query()
@ -627,8 +638,8 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
}
}
if security == "reality" {
params["security"] = "reality"
// Extract Reality params unconditionally so they're available when
// externalProxy overrides security to "reality" via forceTls.
realitySetting, _ := stream["realitySettings"].(map[string]any)
realitySettings, _ := searchKey(realitySetting, "settings")
if realitySetting != nil {
@ -656,6 +667,9 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
params["spx"] = "/" + random.Seq(15)
}
if security == "reality" {
params["security"] = "reality"
if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 {
params["flow"] = clients[clientIndex].Flow
}
@ -681,6 +695,14 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
} else {
params["security"] = security
}
// Allow externalProxy to override SNI (useful when the
// inbound has extra serverNames for fallback routing that
// should not appear in subscription links).
if sni, ok := ep["sni"].(string); ok && len(sni) > 0 {
params["sni"] = sni
}
url, _ := url.Parse(link)
q := url.Query()
@ -848,6 +870,14 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st
} else {
params["security"] = security
}
// Allow externalProxy to override SNI (useful when the
// inbound has extra serverNames for fallback routing that
// should not appear in subscription links).
if sni, ok := ep["sni"].(string); ok && len(sni) > 0 {
params["sni"] = sni
}
url, _ := url.Parse(link)
q := url.Query()

View file

@ -1738,7 +1738,7 @@ class Inbound extends XrayCommonClass {
'o': '',
};
if (ObjectUtil.isArrEmpty(this.stream.externalProxy)) {
let r = orderChars.split('').map(char => orders[char]).filter(x => x.length > 0).join(separationChar);
let r = orderChars.split('').map(char => orders[char]).filter(x => x && x.length > 0).join(separationChar);
result.push({
remark: r,
link: this.genLink(addr, port, 'same', r, client)
@ -1746,7 +1746,7 @@ class Inbound extends XrayCommonClass {
} else {
this.stream.externalProxy.forEach((ep) => {
orders['o'] = ep.remark;
let r = orderChars.split('').map(char => orders[char]).filter(x => x.length > 0).join(separationChar);
let r = orderChars.split('').map(char => orders[char]).filter(x => x && x.length > 0).join(separationChar);
result.push({
remark: r,
link: this.genLink(ep.dest, ep.port, ep.forceTls, r, client)