mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-16 12:35:46 +00:00
Fix
This commit is contained in:
parent
584e538623
commit
0cd1e0bc87
2 changed files with 41 additions and 8 deletions
|
|
@ -1251,7 +1251,7 @@ public static class ConfigHandler
|
|||
return itemSocks;
|
||||
}
|
||||
|
||||
public static CoreConfigContext? GetPreSocksCoreConfigContext(CoreConfigContext nodeContext)
|
||||
public static async Task<CoreConfigContextBuilderResult?> GetPreSocksCoreConfigContext(CoreConfigContext nodeContext)
|
||||
{
|
||||
var config = nodeContext.AppConfig;
|
||||
var node = nodeContext.Node;
|
||||
|
|
@ -1260,7 +1260,15 @@ public static class ConfigHandler
|
|||
var preSocksItem = GetPreSocksItem(config, node, coreType);
|
||||
if (preSocksItem != null)
|
||||
{
|
||||
return nodeContext with { Node = preSocksItem, };
|
||||
var preSocksResult = await CoreConfigContextBuilder.Build(nodeContext.AppConfig, preSocksItem);
|
||||
// share protect domain
|
||||
var protectDomainList = nodeContext.ProtectDomainList ?? [];
|
||||
protectDomainList.UnionWith(preSocksResult.Context.ProtectDomainList ?? []);
|
||||
preSocksResult = preSocksResult with
|
||||
{
|
||||
Context = preSocksResult.Context with { ProtectDomainList = protectDomainList, }
|
||||
};
|
||||
return preSocksResult;
|
||||
}
|
||||
|
||||
if ((!nodeContext.IsTunEnabled)
|
||||
|
|
@ -1283,13 +1291,20 @@ public static class ConfigHandler
|
|||
{
|
||||
SsMethod = Global.None,
|
||||
});
|
||||
var preContext = nodeContext with
|
||||
var preResult = await CoreConfigContextBuilder.Build(nodeContext.AppConfig, preItem);
|
||||
// share protect domain
|
||||
var protectDomainList2 = nodeContext.ProtectDomainList ?? [];
|
||||
protectDomainList2.UnionWith(preResult.Context.ProtectDomainList ?? []);
|
||||
preResult = preResult with
|
||||
{
|
||||
Node = preItem,
|
||||
TunProtectSsPort = tunProtectSsPort,
|
||||
ProxyRelaySsPort = proxyRelaySsPort,
|
||||
Context = preResult.Context with
|
||||
{
|
||||
ProtectDomainList = protectDomainList2,
|
||||
TunProtectSsPort = tunProtectSsPort,
|
||||
ProxyRelaySsPort = proxyRelaySsPort,
|
||||
}
|
||||
};
|
||||
return preContext;
|
||||
return preResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,25 @@ public class CoreManager
|
|||
var contextMod = context;
|
||||
var node = contextMod.Node;
|
||||
var fileName = Utils.GetBinConfigPath(Global.CoreConfigFileName);
|
||||
var preContext = ConfigHandler.GetPreSocksCoreConfigContext(contextMod);
|
||||
var preResult = await ConfigHandler.GetPreSocksCoreConfigContext(contextMod);
|
||||
if (preResult is not null)
|
||||
{
|
||||
var validatorResult = preResult.ValidatorResult;
|
||||
var msgs = new List<string>([.. validatorResult.Errors, .. validatorResult.Warnings]);
|
||||
if (msgs.Count > 0)
|
||||
{
|
||||
foreach (var msg in msgs)
|
||||
{
|
||||
await UpdateFunc(false, msg);
|
||||
}
|
||||
await UpdateFunc(true, Utils.List2String(msgs.Take(10).ToList(), true));
|
||||
if (!validatorResult.Success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
var preContext = preResult?.Context;
|
||||
if (preContext is not null)
|
||||
{
|
||||
contextMod = contextMod with
|
||||
|
|
|
|||
Loading…
Reference in a new issue