Add hy2 ech support (#9954)

This commit is contained in:
DHR60
2026-08-14 02:22:31 +00:00
committed by GitHub
parent b6cc3913ac
commit fb7033aab5

View File

@@ -1,5 +1,3 @@
using System.Collections.Specialized;
namespace ServiceLib.Handler.Fmt;
public class Hysteria2Fmt : BaseFmt
@@ -178,6 +176,7 @@ public class Hysteria2Fmt : BaseFmt
// and the value is restored when generating configurations.
item.AllowInsecure = Global.StringTrue;
}
item.EchConfigList = GetQueryDecoded(query, "ech");
item.SetProtocolExtra(item.GetProtocolExtra() with
{
Ports = GetQueryDecoded(query, "mport"),
@@ -220,6 +219,10 @@ public class Hysteria2Fmt : BaseFmt
var sha = item.CertSha;
dicQuery.Add("pinSHA256", Utils.UrlEncode(sha));
}
if (!item.EchConfigList.IsNullOrEmpty())
{
dicQuery.Add("ech", Utils.UrlEncode(item.EchConfigList));
}
var protocolExtraItem = item.GetProtocolExtra();
var isGecko = !protocolExtraItem.GeckoMinPacketSize.IsNullOrEmpty() || !protocolExtraItem.GeckoMaxPacketSize.IsNullOrEmpty();
if (!protocolExtraItem.SalamanderPass.IsNullOrEmpty())