fix(xray): stop emitting obsolete echForceQuery (#10480)

This commit is contained in:
Miheichev Aleksandr Sergeevich
2026-11-01 13:11:17 +00:00
committed by GitHub
parent a2a8a77ff6
commit 756916978d
3 changed files with 37 additions and 6 deletions
@@ -2,6 +2,43 @@ namespace ServiceLib.Tests.CoreConfig.V2ray;
public class CoreConfigV2rayServiceTests
{
[Test]
[Arguments(null)]
[Arguments("")]
[Arguments("AGH+DQBdAAAgACBAi73MnT3WWXWj4M9MUiTygpjSPUfM/Rj3Iasve4uFQAAkAAEAAQABAAIAAQADAAIAAQACAAIAAgADAAMAAQADAAIAAwADAA5vdXRlci5lY2gudGVzdAAA")]
[Arguments("https://dns.example.com/dns-query")]
[Arguments("udp://127.0.0.1:5353")]
[Arguments("ech.example.com+https://dns.example.com/dns-query")]
public async Task GenerateClientConfigContent_Tls_ShouldPreserveEchConfigWithoutLegacyQueryOption(string? echConfigList)
{
var config = CoreConfigTestFactory.CreateConfig(ECoreType.Xray);
CoreConfigTestFactory.BindAppManagerConfig(config);
var node = CoreConfigTestFactory.CreateVmessNode(ECoreType.Xray);
node.StreamSecurity = Global.StreamSecurity;
node.Sni = "ech.example.com";
node.EchConfigList = echConfigList;
var context = CoreConfigTestFactory.CreateContext(config, node, ECoreType.Xray);
var result = new CoreConfigV2rayService(context).GenerateClientConfigContent();
await result.Success.Should().BeTrue();
var generatedConfig = JsonNode.Parse(result.Data!.ToString()!)!;
var proxy = generatedConfig["outbounds"]!.AsArray()
.First(outbound => outbound!["tag"]!.GetValue<string>() == Global.ProxyTag)!;
var tls = proxy["streamSettings"]!["tlsSettings"]!.AsObject();
await tls["serverName"]!.GetValue<string>().Should().BeEqualTo("ech.example.com");
if (string.IsNullOrEmpty(echConfigList))
{
await tls.ContainsKey("echConfigList").Should().BeFalse();
}
else
{
await tls["echConfigList"]!.GetValue<string>().Should().BeEqualTo(echConfigList);
}
await tls.ContainsKey("echForceQuery").Should().BeFalse();
}
[Test]
public async Task GenerateClientConfigContent_ShouldGenerateBasicProxyConfig()
{
@@ -343,7 +343,6 @@ public class TlsSettings4Ray
public string? pinnedPeerCertSha256 { get; set; }
public bool? disableSystemRoot { get; set; }
public string? echConfigList { get; set; }
public string? echForceQuery { get; set; }
public Sockopt4Ray? echSockopt { get; set; }
}
@@ -337,11 +337,6 @@ public partial class CoreConfigV2rayService
{
tlsSettings.serverName = Utils.String2List(host)?.First();
}
if (!tlsSettings.echConfigList.IsNullOrEmpty())
{
// For legacy xray compatibility, remove this in the future
tlsSettings.echForceQuery = "full";
}
var certs = CertPemManager.ParsePemChain(_node.Cert);
if (certs.Count > 0)
{