mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Add Policy Group support
This commit is contained in:
parent
34327532e6
commit
9ef228db1e
2 changed files with 40 additions and 0 deletions
|
@ -15,6 +15,26 @@ public partial class CoreConfigSingboxService(Config config)
|
|||
var ret = new RetResult();
|
||||
try
|
||||
{
|
||||
if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
{
|
||||
ProfileGroupItemManager.Instance.TryGet(node.IndexId, out var profileGroupItem);
|
||||
if (profileGroupItem == null || profileGroupItem.ChildItems.IsNullOrEmpty())
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
if (node.ConfigType is EConfigType.PolicyGroup)
|
||||
{
|
||||
var childProfiles = (await Task.WhenAll(
|
||||
Utils.String2List(profileGroupItem.ChildItems)
|
||||
.Where(p => !p.IsNullOrEmpty())
|
||||
.Select(AppManager.Instance.GetProfileItem)
|
||||
)).Where(p => p != null).ToList();
|
||||
return await GenerateClientMultipleLoadConfig(childProfiles);
|
||||
}
|
||||
// TODO proxy chain
|
||||
}
|
||||
|
||||
if (node == null
|
||||
|| node.Port <= 0)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,26 @@ public partial class CoreConfigV2rayService(Config config)
|
|||
var ret = new RetResult();
|
||||
try
|
||||
{
|
||||
if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
|
||||
{
|
||||
ProfileGroupItemManager.Instance.TryGet(node.IndexId, out var profileGroupItem);
|
||||
if (profileGroupItem == null || profileGroupItem.ChildItems.IsNullOrEmpty())
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
if (node.ConfigType is EConfigType.PolicyGroup)
|
||||
{
|
||||
var childProfiles = (await Task.WhenAll(
|
||||
Utils.String2List(profileGroupItem.ChildItems)
|
||||
.Where(p => !p.IsNullOrEmpty())
|
||||
.Select(AppManager.Instance.GetProfileItem)
|
||||
)).Where(p => p != null).ToList();
|
||||
return await GenerateClientMultipleLoadConfig(childProfiles, profileGroupItem.MultipleLoad);
|
||||
}
|
||||
// TODO proxy chain
|
||||
}
|
||||
|
||||
if (node == null
|
||||
|| node.Port <= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue