mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-19 03:25:01 +03:00
fix(xray): read an outbound protocol id the way the core does (#6521)
* fix(xray): read an outbound protocol id the way the core does xray-core lowercases a protocol id before it looks up the handler (infra/conf/loader.go: `id = strings.ToLower(id)`), so a template that spells the direct outbound "Freedom" runs as freedom. The three config rewriters compared the id case-sensitively, so such an outbound was skipped while the seed was recorded as applied: the refused sockopt.addressPortStrategy stayed and xray-core refused to start. * fix(xray): match an outbound protocol id case-insensitively xray-core lowercases a protocol id before looking up its handler, so a template that spells the direct outbound "Freedom" runs as freedom while this rewriter skipped it and left the deprecated placement in place. * fix(xray): re-run the freedom finalRules rewrite where its seeder was gated Both finalRules seeders recorded their rows before the predicate could see an outbound spelled "Freedom", and a recorded row is never re-run, so the corrected predicates alone left the #6037 private-egress hardening unapplied on every panel that had already run them. The new one-shot seeder replays both rewrites, and only when the config actually carries a differently spelled freedom outbound, so stock lowercase configs stay byte-identical.
This commit is contained in:
@@ -169,6 +169,11 @@ func TestRewriteFreedomDomainStrategySatisfiesCore(t *testing.T) {
|
||||
raw: `{"protocol":"freedom","tag":"direct","targetStrategy":"ForceIPv6","settings":{}}`,
|
||||
wantValue: `"domainStrategy": "ForceIPv6"`,
|
||||
},
|
||||
{
|
||||
name: "uppercase protocol spelling",
|
||||
raw: `{"protocol":"Freedom","tag":"direct","settings":{"domainStrategy":"UseIPv4","finalRules":[{"action":"allow"}]}}`,
|
||||
wantValue: `"domainStrategy": "UseIPv4"`,
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
capture := captureCoreLogs(t)
|
||||
|
||||
Reference in New Issue
Block a user