mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6482] [Enhancement]: The Freedom Protocol strategy still creates the outdated freedom.domainStrategy parameter. #4374
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4374
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jameszeroX on GitHub (Sep 12, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6482
Describe the bug
When Freedom Protocol Strategy is changed in the UI, 3x-ui generated the old Xray configuration format
How to reproduce the problem
Change the parameter in the 3x-ui settings -
Xray Configs>>Basic>>Freedom Protocol StrategyExpected behavior
Actual behavior
Additional context
Xray-core's current configuration logic explicitly migrates
freedom.domainStrategytosockopt.domainStrategywith a warning:Therefore, it would be preferable for 3x-ui to write the new configuration format directly.
3x-ui version
Dev build
0a2cd789Xray-core version
26.9.9
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 22
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Sep 12, 2026):
Your observation is correct — the panel does write the settings-level
domainStrategy, and it does so deliberately for backward compatibility, so nothing is malfunctioning today. I'm treating this as a forward-compatibility cleanup (the key is deprecated and will eventually be removed) rather than a defect, and leaving it open.What the code actually does
The
Xray Configs→Basic→Freedom Protocol Strategyselect reads and writes only thedirectfreedom outbound'ssettings.domainStrategy:and reads it back the same way (
BasicsTab.tsx:112-116, defaulting to'AsIs'). The shipped default template already carries it in that position, so the key is there before anyone touches the select:Why it is written that way
This placement is an explicit compatibility decision, documented in the outbound adapter:
That comment arrived with
258d8b73"feat(frontend): add targetStrategy field to the outbound editor", whose body states it plainly: "Freedom settings additionally read the new settings-level targetStrategy with domainStrategy as fallback, mirroring the core, while still emitting the legacy domainStrategy key so configs keep working on older cores." The panel therefore reads either key (outbound-form-adapter.ts:309-310:asString(raw.targetStrategy) || asString(raw.domainStrategy)) but always writes the legacy one.One thing to pin down before changing it
Your report and that commit name two different replacements. You quote the core migrating
freedom.domainStrategy→sockopt.domainStrategy;258d8b73describes the core's replacement as a settings-leveltargetStrategy. I could not re-derive either from the Xray-core source in this environment (the dependency source is not available here and I cannot fetch it), so the warning text and its migration target are your evidence, not something I confirmed. Which of the two keys the core at v26.9.9 actually prefers decides the whole change, and readinginfra/conf/freedom.goat that tag is the single check that settles it. For what it's worth, your Xray version matches exactly what the panel bundles —DockerInit.sh:35pins.../releases/download/v26.9.9/Xray-linux-${ARCH}.zip— so the warning you quote would come from the bundled core.Scope, for whoever picks this up
The deprecated key is written in five places, not one — including the template handed to clients:
internal/database/db.gowould also need a seeder to move the key in templates already saved in users' databases —normalizeFreedomFinalRules/hardenFreedomFinalRules(db.go:1829,db.go:1932) are the existing pattern for rewriting exactly this outbound. Note thatinternal/database/freedom_finalrules_migration_test.go:126-127currently assertssettings["domainStrategy"] == "AsIs"survives that migration untouched; that is an untouched-neighbour assertion, not a statement of intent about the key's position, but it would need updating.Two smaller notes from the same code path:
BasicsTab.tsx:112-116ignores a top-leveltargetStrategy, so the Basics select displaysAsIseven when one is set via the Outbounds editor; and if the core does migrate intosockopt, it is worth checking what happens whensockopt.domainStrategyis already set explicitly there — the Basics tab writes into the samestreamSettings.sockoptobject for the Happy Eyeballs switch (BasicsTab.tsx:141-152).I relabelled this from
bugtoenhancement; the title states your observation accurately, so I left it as is.Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.
@BlindMaster24 commented on GitHub (Sep 14, 2026):
The open question in the analysis above — whether the replacement key is
sockopt.domainStrategyor a settings-leveltargetStrategy— can be settled from the core the panel is actually pinned to,github.com/xtls/xray-core v1.260327.1-0.20260908222543-52a412d9e2f5(go.mod:28):infra/conf/freedom.go:19-30— the freedom settings struct declares bothtargetStrategyanddomainStrategy.infra/conf/xray.go:340-368— this is the deciding part. The loader checks, in order:senderSettings.TargetStrategy(an outbound-level key, a sibling ofsettings, not a key inside it) and then the freedom config's ownDomainStrategy. The latter is what producesThe "freedom.domainStrategy" setting is deprecated and will be removed…. Whichever value it resolves is then written tosenderSettings.StreamSettings.SocketSettings.DomainStrategy, i.e.streamSettings.sockopt.domainStrategy.proxy/freedom/freedom.go:57—h.resolveStrategy = streamSettings.SocketSettings.DomainStrategy. Freedom takes its resolve strategy from the socket layer, not from its ownsettings, so the settings-level key has no other consumer: that migration is the only thing that reads it.So the reporter's expectation is right, and the target is
sockopt.domainStrategy;settings.targetStrategyis not the new home — the core's owntargetStrategylives one level up.Where the panel writes the legacy key today, for whoever picks this up: the Basics tab's "Freedom Protocol Strategy" select (
frontend/src/pages/xray/basics/BasicsTab.tsx, both the read at ~L112 and the write at ~L193), the outbound defaults infrontend/src/pages/xray/basics/constants.ts(ipv4Settings), andfreedomToWireinfrontend/src/lib/xray/outbound-form-adapter.ts. One detail that matters for a fix: on write the legacy key has to be removed, not merely superseded — leaving a non-AsIsfreedom.domainStrategyin place keeps the loader on the warning path regardless of whatsockoptsays.Impact today is log noise rather than breakage, since the automatic migration works; it turns into a silently dead setting once the key is dropped upstream.