mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 21:23:04 +00:00
Compare commits
4 commits
180cf485bd
...
9b784ab9c7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b784ab9c7 | ||
|
|
0075939a73 | ||
|
|
e9a6411698 | ||
|
|
6d35abe7ca |
7 changed files with 47 additions and 11 deletions
|
|
@ -99,7 +99,12 @@ public static class CoreConfigHandler
|
|||
var nodes = await AppManager.Instance.GetProfileItemsByIndexIds(ids);
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
await FillNodeContext(context, node, false);
|
||||
var actNode = await FillNodeContext(context, node, true);
|
||||
if (node.IndexId == actNode.IndexId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
context.ServerTestItemMap[node.IndexId] = actNode.IndexId;
|
||||
}
|
||||
if (coreType == ECoreType.sing_box)
|
||||
{
|
||||
|
|
@ -170,7 +175,8 @@ public static class CoreConfigHandler
|
|||
var ruleOutboundNode = await AppManager.Instance.GetProfileItemViaRemarks(ruleItem.OutboundTag);
|
||||
if (ruleOutboundNode != null)
|
||||
{
|
||||
await FillNodeContext(context, ruleOutboundNode);
|
||||
var ruleOutboundNodeAct = await FillNodeContext(context, ruleOutboundNode, false);
|
||||
context.AllProxiesMap[$"remark:{ruleItem.OutboundTag}"] = ruleOutboundNodeAct;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,9 +96,34 @@ public class GroupProfileManager
|
|||
return [];
|
||||
}
|
||||
var childProfileIds = Utils.String2List(extra.ChildItems)
|
||||
?.Where(p => !string.IsNullOrEmpty(p)) ?? [];
|
||||
?.Where(p => !string.IsNullOrEmpty(p))
|
||||
.ToList() ?? [];
|
||||
if (childProfileIds.Count == 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
var childProfiles = await AppManager.Instance.GetProfileItemsByIndexIds(childProfileIds);
|
||||
return childProfiles ?? [];
|
||||
if (childProfiles == null || childProfiles.Count == 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
var profileMap = childProfiles
|
||||
.Where(p => p != null && !p.IndexId.IsNullOrEmpty())
|
||||
.GroupBy(p => p!.IndexId!)
|
||||
.ToDictionary(g => g.Key, g => g.First());
|
||||
|
||||
var ordered = new List<ProfileItem>(childProfileIds.Count);
|
||||
foreach (var id in childProfileIds)
|
||||
{
|
||||
if (id != null && profileMap.TryGetValue(id, out var item) && item != null)
|
||||
{
|
||||
ordered.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return ordered;
|
||||
}
|
||||
|
||||
private static async Task<List<ProfileItem>> GetSubChildProfileItems(ProtocolExtraItem? extra)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ public record CoreConfigContext
|
|||
public Config AppConfig { get; init; } = new();
|
||||
public FullConfigTemplateItem? FullConfigTemplate { get; init; } = new();
|
||||
|
||||
// Test ServerTestItem Map
|
||||
public Dictionary<string, string> ServerTestItemMap { get; init; } = new();
|
||||
|
||||
// TUN Compatibility
|
||||
public bool IsTunEnabled { get; init; } = false;
|
||||
public HashSet<string> ProtectDomainList { get; init; } = new();
|
||||
|
|
|
|||
|
|
@ -122,8 +122,9 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
var item = context.AllProxiesMap.GetValueOrDefault(it.IndexId);
|
||||
if (item is null || item.IsComplex() || !item.IsValid())
|
||||
var actIndexId = context.ServerTestItemMap.GetValueOrDefault(it.IndexId, it.IndexId);
|
||||
var item = context.AllProxiesMap.GetValueOrDefault(actIndexId);
|
||||
if (item is null || item.ConfigType is EConfigType.Custom || !item.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -413,8 +413,8 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
|
||||
var tag = $"{node.IndexId}-{Global.ProxyTag}";
|
||||
if (_coreConfig.outbounds.Any(o => o.tag == tag)
|
||||
|| (_coreConfig.endpoints != null && _coreConfig.endpoints.Any(e => e.tag == tag)))
|
||||
if (_coreConfig.outbounds.Any(o => o.tag.StartsWith(tag))
|
||||
|| (_coreConfig.endpoints != null && _coreConfig.endpoints.Any(e => e.tag.StartsWith(tag))))
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,8 +120,9 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
var item = context.AllProxiesMap.GetValueOrDefault(it.IndexId);
|
||||
if (item is null || item.IsComplex() || !item.IsValid())
|
||||
var actIndexId = context.ServerTestItemMap.GetValueOrDefault(it.IndexId, it.IndexId);
|
||||
var item = context.AllProxiesMap.GetValueOrDefault(actIndexId);
|
||||
if (item is null || item.ConfigType is EConfigType.Custom || !item.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
|
||||
var tag = $"{node.IndexId}-{Global.ProxyTag}";
|
||||
if (_coreConfig.outbounds.Any(p => p.tag == tag))
|
||||
if (_coreConfig.outbounds.Any(p => p.tag.StartsWith(tag)))
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue