mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-15 19:02:18 +03:00
* fix(xray): place the freedom domain strategy where the core reads it freedom resolves through the socket layer, so xray-core reads sockopt.domainStrategy and treats both other placements as legacy: it warns on every config load for the outbound-root targetStrategy it migrates itself, and again for the settings-level domainStrategy it deprecates. The panel wrote exactly those two keys from its Freedom Protocol Strategy select, the outbound form card, and the IPv4 routing helper, so any install that had configured a strategy logged a deprecation warning on every start. The strategy now travels in streamSettings.sockopt everywhere the panel emits it: the Basics select, the outbound form (including the JSON tab, which shares the same adapter), the shipped default template, and the IPv4 outbound the routing helper injects. Reading mirrors the loader's own order — root targetStrategy, then the settings keys, then sockopt — so the card keeps showing the value the core would actually run with, and saving drops the legacy keys instead of leaving them behind. A seeder moves the keys for configs already stored in the database, following OutboundRemovedKeysFix. The shared outbound-root Target Strategy field is hidden for freedom, since the core migrates that key into the very sockopt value the card writes and two knobs for one value would race. Tests: placement round-trips and the migration table run through the real vendored core (a captured log handler proves the warning is gone after the rewrite and present before it), and the modal asserts freedom offers a single strategy field. * test(database): seed the template row the seeder test needs A fresh InitDB creates no xrayTemplateConfig row — the panel's setting defaults live in the service layer — so the test has to insert the legacy template itself and then assert the seeder's history gate stops a second pass from rewriting it. * fix(xray): keep one strategy control per outbound, seed the row in tests Review findings: the Transport tab's Sockopts block renders for freedom too, so its Domain Strategy select and the freedom card wrote one sockopt value between them and the card won on save — the field is hidden for freedom now, leaving the card as the single control. The seeder is also pre-marked on a fresh install so it does not run on the second start, and the seeder test seeds the template row itself (a fresh InitDB has none) and asserts the rewrite structurally instead of grepping for a key name that sockopt also uses.
87 lines
1.6 KiB
JSON
87 lines
1.6 KiB
JSON
{
|
|
"api": {
|
|
"services": [
|
|
"HandlerService",
|
|
"LoggerService",
|
|
"StatsService",
|
|
"RoutingService"
|
|
],
|
|
"tag": "api"
|
|
},
|
|
"inbounds": [{
|
|
"listen": "127.0.0.1",
|
|
"port": 62789,
|
|
"protocol": "tunnel",
|
|
"settings": {
|
|
"rewriteAddress": "127.0.0.1"
|
|
},
|
|
"tag": "api"
|
|
}],
|
|
"log": {
|
|
"access": "none",
|
|
"dnsLog": false,
|
|
"error": "",
|
|
"loglevel": "warning",
|
|
"maskAddress": ""
|
|
},
|
|
"metrics": {
|
|
"listen": "127.0.0.1:11111",
|
|
"tag": "metrics_out"
|
|
},
|
|
"outbounds": [{
|
|
"protocol": "freedom",
|
|
"settings": {
|
|
"finalRules": [
|
|
{ "action": "block", "ip": ["geoip:private"] },
|
|
{ "action": "allow" }
|
|
]
|
|
},
|
|
"tag": "direct"
|
|
},
|
|
{
|
|
"protocol": "blackhole",
|
|
"settings": {},
|
|
"tag": "blocked"
|
|
}
|
|
],
|
|
"policy": {
|
|
"levels": {
|
|
"0": {
|
|
"statsUserDownlink": true,
|
|
"statsUserUplink": true
|
|
}
|
|
},
|
|
"system": {
|
|
"statsInboundDownlink": true,
|
|
"statsInboundUplink": true,
|
|
"statsOutboundDownlink": false,
|
|
"statsOutboundUplink": false
|
|
}
|
|
},
|
|
"routing": {
|
|
"domainStrategy": "AsIs",
|
|
"rules": [{
|
|
"inboundTag": [
|
|
"api"
|
|
],
|
|
"outboundTag": "api",
|
|
"type": "field"
|
|
},
|
|
{
|
|
"ip": [
|
|
"geoip:private"
|
|
],
|
|
"outboundTag": "blocked",
|
|
"type": "field"
|
|
},
|
|
{
|
|
"outboundTag": "blocked",
|
|
"protocol": [
|
|
"bittorrent"
|
|
],
|
|
"type": "field"
|
|
}
|
|
]
|
|
},
|
|
"stats": {}
|
|
} |