Adjust cores

pull/4711/head
2dust 2023-12-22 12:13:36 +08:00
parent 655d411afe
commit 86f3ed29f9
4 changed files with 23 additions and 8 deletions

View File

@ -17,6 +17,7 @@ namespace v2rayN
public const string NUrl = @"https://github.com/2dust/v2rayN/releases"; public const string NUrl = @"https://github.com/2dust/v2rayN/releases";
public const string ClashCoreUrl = "https://github.com/Dreamacro/clash/releases"; public const string ClashCoreUrl = "https://github.com/Dreamacro/clash/releases";
public const string ClashMetaCoreUrl = "https://github.com/MetaCubeX/Clash.Meta/releases"; public const string ClashMetaCoreUrl = "https://github.com/MetaCubeX/Clash.Meta/releases";
public const string MihomoCoreUrl = "https://github.com/MetaCubeX/mihomo/releases";
public const string HysteriaCoreUrl = "https://github.com/apernet/hysteria/releases"; public const string HysteriaCoreUrl = "https://github.com/apernet/hysteria/releases";
public const string NaiveproxyCoreUrl = "https://github.com/klzgrad/naiveproxy/releases"; public const string NaiveproxyCoreUrl = "https://github.com/klzgrad/naiveproxy/releases";
public const string TuicCoreUrl = "https://github.com/EAimTY/tuic/releases"; public const string TuicCoreUrl = "https://github.com/EAimTY/tuic/releases";

View File

@ -1,4 +1,5 @@
using v2rayN.Base; using System.Runtime.Intrinsics.X86;
using v2rayN.Base;
using v2rayN.Mode; using v2rayN.Mode;
namespace v2rayN.Handler namespace v2rayN.Handler
@ -195,13 +196,13 @@ namespace v2rayN.Handler
return coreInfos!.FirstOrDefault(t => t.coreType == coreType); return coreInfos!.FirstOrDefault(t => t.coreType == coreType);
} }
public List<CoreInfo>? GetCoreInfos() public List<CoreInfo> GetCoreInfos()
{ {
if (coreInfos == null) if (coreInfos == null)
{ {
InitCoreInfo(); InitCoreInfo();
} }
return coreInfos; return coreInfos!;
} }
private void InitCoreInfo() private void InitCoreInfo()
@ -308,6 +309,18 @@ namespace v2rayN.Handler
redirectInfo = true, redirectInfo = true,
}); });
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.mihomo,
coreExes = new List<string> { $"mihomo-windows-amd64{(Avx2.X64.IsSupported ? "" : "-compatible")}", "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-windows-386", "mihomo", "clash" },
arguments = "-f config.yaml",
coreUrl = Global.MihomoCoreUrl,
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
match = "Mihomo",
redirectInfo = true,
});
coreInfos.Add(new CoreInfo coreInfos.Add(new CoreInfo
{ {
coreType = ECoreType.hysteria, coreType = ECoreType.hysteria,

View File

@ -8,6 +8,7 @@
v2fly_v5 = 4, v2fly_v5 = 4,
clash = 11, clash = 11,
clash_meta = 12, clash_meta = 12,
mihomo = 13,
hysteria = 21, hysteria = 21,
naiveproxy = 22, naiveproxy = 22,
tuic = 23, tuic = 23,

View File

@ -541,12 +541,12 @@ namespace v2rayN.Views
private void AddHelpMenuItem() private void AddHelpMenuItem()
{ {
var coreInfos = LazyConfig.Instance.GetCoreInfos(); var coreInfos = LazyConfig.Instance.GetCoreInfos();
foreach (var it in coreInfos) foreach (var it in coreInfos
.Where(t => t.coreType != ECoreType.v2fly
&& t.coreType != ECoreType.clash
&& t.coreType != ECoreType.clash_meta
&& t.coreType != ECoreType.hysteria))
{ {
if (it.coreType == ECoreType.v2fly)
{
continue;
}
var item = new MenuItem() var item = new MenuItem()
{ {
Tag = it.coreUrl.Replace(@"/releases", ""), Tag = it.coreUrl.Replace(@"/releases", ""),