This commit is contained in:
DHR60 2026-03-01 11:37:23 +08:00
parent 8b486f9f50
commit cf31a975b6

View file

@ -25,14 +25,15 @@ public record CoreConfigContextBuilderAllResult(
[.. MainResult.ValidatorResult.Warnings, .. PreSocksResult?.ValidatorResult.Warnings ?? []]); [.. MainResult.ValidatorResult.Warnings, .. PreSocksResult?.ValidatorResult.Warnings ?? []]);
/// <summary> /// <summary>
/// The main context with TunProtectSsPort/ProxyRelaySsPort merged in from the /// The main context with TunProtectSsPort/ProxyRelaySsPort and ProtectDomainList merged in
/// pre-socks result (if any). Pass this to the core runner. /// from the pre-socks result (if any). Pass this to the core runner.
/// </summary> /// </summary>
public CoreConfigContext ResolvedMainContext => PreSocksResult is not null public CoreConfigContext ResolvedMainContext => PreSocksResult is not null
? MainResult.Context with ? MainResult.Context with
{ {
TunProtectSsPort = PreSocksResult.Context.TunProtectSsPort, TunProtectSsPort = PreSocksResult.Context.TunProtectSsPort,
ProxyRelaySsPort = PreSocksResult.Context.ProxyRelaySsPort, ProxyRelaySsPort = PreSocksResult.Context.ProxyRelaySsPort,
ProtectDomainList = [.. MainResult.Context.ProtectDomainList ?? [], .. PreSocksResult.Context.ProtectDomainList ?? []],
} }
: MainResult.Context; : MainResult.Context;
} }
@ -138,11 +139,12 @@ public class CoreConfigContextBuilder
if (preSocksItem != null) if (preSocksItem != null)
{ {
var preSocksResult = await Build(nodeContext.AppConfig, preSocksItem); var preSocksResult = await Build(nodeContext.AppConfig, preSocksItem);
var protectDomainList = nodeContext.ProtectDomainList ?? [];
protectDomainList.UnionWith(preSocksResult.Context.ProtectDomainList ?? []);
return preSocksResult with return preSocksResult with
{ {
Context = preSocksResult.Context with { ProtectDomainList = protectDomainList } Context = preSocksResult.Context with
{
ProtectDomainList = [.. nodeContext.ProtectDomainList ?? [], .. preSocksResult.Context.ProtectDomainList ?? []],
}
}; };
} }
@ -168,13 +170,11 @@ public class CoreConfigContextBuilder
SsMethod = Global.None, SsMethod = Global.None,
}); });
var preResult2 = await Build(nodeContext.AppConfig, preItem); var preResult2 = await Build(nodeContext.AppConfig, preItem);
var protectDomainList2 = nodeContext.ProtectDomainList ?? [];
protectDomainList2.UnionWith(preResult2.Context.ProtectDomainList ?? []);
return preResult2 with return preResult2 with
{ {
Context = preResult2.Context with Context = preResult2.Context with
{ {
ProtectDomainList = protectDomainList2, ProtectDomainList = [.. nodeContext.ProtectDomainList ?? [], .. preResult2.Context.ProtectDomainList ?? []],
TunProtectSsPort = tunProtectSsPort, TunProtectSsPort = tunProtectSsPort,
ProxyRelaySsPort = proxyRelaySsPort, ProxyRelaySsPort = proxyRelaySsPort,
} }