mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 20:09:12 +00:00
Add Policy Group support
This commit is contained in:
parent
9a43003c47
commit
a323484ee3
2 changed files with 40 additions and 0 deletions
|
@ -15,6 +15,26 @@ public partial class CoreConfigSingboxService(Config config)
|
||||||
var ret = new RetResult();
|
var ret = new RetResult();
|
||||||
try
|
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
|
if (node == null
|
||||||
|| node.Port <= 0)
|
|| node.Port <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,26 @@ public partial class CoreConfigV2rayService(Config config)
|
||||||
var ret = new RetResult();
|
var ret = new RetResult();
|
||||||
try
|
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
|
if (node == null
|
||||||
|| node.Port <= 0)
|
|| node.Port <= 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue