Remove SagerNet clash clash_meta

pull/5829/head
2dust 2024-10-05 17:51:31 +08:00
parent b33f536dbd
commit 75d86cf883
14 changed files with 18 additions and 79 deletions

View File

@ -4,10 +4,10 @@
{ {
v2fly = 1, v2fly = 1,
Xray = 2, Xray = 2,
SagerNet = 3, //SagerNet = 3,
v2fly_v5 = 4, v2fly_v5 = 4,
clash = 11, //clash = 11,
clash_meta = 12, //clash_meta = 12,
mihomo = 13, mihomo = 13,
hysteria = 21, hysteria = 21,
naiveproxy = 22, naiveproxy = 22,

View File

@ -9,10 +9,7 @@
public const string GithubApiUrl = "https://api.github.com/repos"; public const string GithubApiUrl = "https://api.github.com/repos";
public const string V2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases"; public const string V2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases";
public const string XrayCoreUrl = "https://github.com/XTLS/Xray-core/releases"; public const string XrayCoreUrl = "https://github.com/XTLS/Xray-core/releases";
public const string SagerNetCoreUrl = "https://github.com/SagerNet/v2ray-core/releases";
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 ClashMetaCoreUrl = "https://github.com/MetaCubeX/Clash.Meta/releases";
public const string MihomoCoreUrl = "https://github.com/MetaCubeX/mihomo/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";
@ -166,7 +163,7 @@
public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" }; public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "splithttp", "h2", "quic", "grpc" }; public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "splithttp", "h2", "quic", "grpc" };
public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> CoreTypes = new() { "v2fly", "Xray", "sing_box" };//TODO public static readonly List<string> CoreTypes = new() { "v2fly", "Xray", "sing_box" };
public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" }; public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" };
public static readonly List<string> DomainStrategies = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" }; public static readonly List<string> DomainStrategies = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
public static readonly List<string> DomainStrategies4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" }; public static readonly List<string> DomainStrategies4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };

View File

@ -20,7 +20,7 @@
msg = ResUI.InitialConfiguration; msg = ResUI.InitialConfiguration;
if (node.configType == EConfigType.Custom) if (node.configType == EConfigType.Custom)
{ {
if (node.coreType is ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo) if (node.coreType is ECoreType.mihomo)
{ {
var configGenClash = new CoreConfigClash(config); var configGenClash = new CoreConfigClash(config);
return configGenClash.GenerateClientCustomConfig(node, fileName, out msg); return configGenClash.GenerateClientCustomConfig(node, fileName, out msg);

View File

@ -60,18 +60,6 @@ namespace ServiceLib.Handler
redirectInfo = true, redirectInfo = true,
}); });
_coreInfo.Add(new CoreInfo
{
coreType = ECoreType.SagerNet,
coreExes = new List<string> { "SagerNet", "v2ray" },
arguments = "run",
coreUrl = Global.SagerNetCoreUrl,
coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
match = "V2Ray",
versionArg = "version",
redirectInfo = true,
});
_coreInfo.Add(new CoreInfo _coreInfo.Add(new CoreInfo
{ {
coreType = ECoreType.v2fly_v5, coreType = ECoreType.v2fly_v5,
@ -102,30 +90,6 @@ namespace ServiceLib.Handler
redirectInfo = true, redirectInfo = true,
}); });
_coreInfo.Add(new CoreInfo
{
coreType = ECoreType.clash,
coreExes = new List<string> { "clash-windows-amd64-v3", "clash-windows-amd64", "clash-windows-386", "clash" },
arguments = "-f config.json" + PortableMode(),
coreUrl = Global.ClashCoreUrl,
coreReleaseApiUrl = Global.ClashCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
match = "v",
versionArg = "-v",
redirectInfo = true,
});
_coreInfo.Add(new CoreInfo
{
coreType = ECoreType.clash_meta,
coreExes = new List<string> { "Clash.Meta-windows-amd64-compatible", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" },
arguments = "-f config.json" + PortableMode(),
coreUrl = Global.ClashMetaCoreUrl,
coreReleaseApiUrl = Global.ClashMetaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
match = "v",
versionArg = "-v",
redirectInfo = true,
});
_coreInfo.Add(new CoreInfo _coreInfo.Add(new CoreInfo
{ {
coreType = ECoreType.mihomo, coreType = ECoreType.mihomo,
@ -133,12 +97,12 @@ namespace ServiceLib.Handler
arguments = "-f config.json" + PortableMode(), arguments = "-f config.json" + PortableMode(),
coreUrl = Global.MihomoCoreUrl, coreUrl = Global.MihomoCoreUrl,
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
coreDownloadUrl32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip", coreDownloadUrl32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
coreDownloadUrl64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip", coreDownloadUrl64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
coreDownloadUrlArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip", coreDownloadUrlArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
coreDownloadUrlLinux32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-linux-386-{0}.gz", coreDownloadUrlLinux32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-386-{0}.gz",
coreDownloadUrlLinux64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz", coreDownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
coreDownloadUrlLinuxArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz", coreDownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
match = "Mihomo", match = "Mihomo",
versionArg = "-v", versionArg = "-v",
redirectInfo = true, redirectInfo = true,

View File

@ -38,14 +38,6 @@
SQLiteHelper.Instance.CreateTable<RoutingItem>(); SQLiteHelper.Instance.CreateTable<RoutingItem>();
SQLiteHelper.Instance.CreateTable<ProfileExItem>(); SQLiteHelper.Instance.CreateTable<ProfileExItem>();
SQLiteHelper.Instance.CreateTable<DNSItem>(); SQLiteHelper.Instance.CreateTable<DNSItem>();
//TODO
//Prepare to remove the clash
SQLiteHelper.Instance.Execute($"update ProfileItem set coreType = 13 where coreType = 11");
SQLiteHelper.Instance.Execute($"update ProfileItem set coreType = 13 where coreType = 12");
//Prepare to remove the SagerNet
SQLiteHelper.Instance.Execute($"update ProfileItem set coreType = 2 where coreType = 3");
} }
#region Config #region Config

View File

@ -63,7 +63,7 @@ namespace ServiceLib.Handler.Statistics
await Task.Delay(1000); await Task.Delay(1000);
try try
{ {
if (!(_config.IsRunningCore(ECoreType.clash))) if (!(_config.IsRunningCore(ECoreType.sing_box)))
{ {
continue; continue;
} }

View File

@ -337,14 +337,11 @@ namespace ServiceLib.Handler
switch (type) switch (type)
{ {
case ECoreType.v2fly: case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray: case ECoreType.Xray:
case ECoreType.v2fly_v5: case ECoreType.v2fly_v5:
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value; version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
break; break;
case ECoreType.clash:
case ECoreType.clash_meta:
case ECoreType.mihomo: case ECoreType.mihomo:
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value; version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
break; break;
@ -379,7 +376,6 @@ namespace ServiceLib.Handler
switch (type) switch (type)
{ {
case ECoreType.v2fly: case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray: case ECoreType.Xray:
case ECoreType.v2fly_v5: case ECoreType.v2fly_v5:
{ {
@ -388,8 +384,6 @@ namespace ServiceLib.Handler
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v")); url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"));
break; break;
} }
case ECoreType.clash:
case ECoreType.clash_meta:
case ECoreType.mihomo: case ECoreType.mihomo:
{ {
curVersion = GetCoreVersion(type); curVersion = GetCoreVersion(type);

View File

@ -17,11 +17,11 @@
public bool IsRunningCore(ECoreType type) public bool IsRunningCore(ECoreType type)
{ {
if (type == ECoreType.Xray && runningCoreType is ECoreType.Xray or ECoreType.v2fly or ECoreType.v2fly_v5 or ECoreType.SagerNet) if (type == ECoreType.Xray && runningCoreType is ECoreType.Xray or ECoreType.v2fly or ECoreType.v2fly_v5)
{ {
return true; return true;
} }
if (type == ECoreType.clash && runningCoreType is ECoreType.sing_box or ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo) if (type == ECoreType.sing_box && runningCoreType is ECoreType.sing_box or ECoreType.mihomo)
{ {
return true; return true;
} }

View File

@ -83,7 +83,7 @@ namespace ServiceLib.ViewModels
Observable.Interval(TimeSpan.FromSeconds(5)) Observable.Interval(TimeSpan.FromSeconds(5))
.Subscribe(x => .Subscribe(x =>
{ {
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.clash))) if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{ {
return; return;
} }

View File

@ -439,7 +439,7 @@ namespace ServiceLib.ViewModels
Observable.Interval(TimeSpan.FromSeconds(60)) Observable.Interval(TimeSpan.FromSeconds(60))
.Subscribe(x => .Subscribe(x =>
{ {
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.clash))) if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{ {
return; return;
} }

View File

@ -731,7 +731,7 @@ namespace ServiceLib.ViewModels
{ {
ChangeSystemProxyStatusAsync(_config.systemProxyItem.sysProxyType, false); ChangeSystemProxyStatusAsync(_config.systemProxyItem.sysProxyType, false);
BlReloadEnabled = true; BlReloadEnabled = true;
ShowClashUI = _config.IsRunningCore(ECoreType.clash); ShowClashUI = _config.IsRunningCore(ECoreType.sing_box);
if (ShowClashUI) if (ShowClashUI)
{ {
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload(); Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();

View File

@ -451,8 +451,6 @@ namespace v2rayN.Desktop.Views
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(); var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo foreach (var it in coreInfo
.Where(t => t.coreType != ECoreType.v2fly .Where(t => t.coreType != ECoreType.v2fly
&& t.coreType != ECoreType.clash
&& t.coreType != ECoreType.clash_meta
&& t.coreType != ECoreType.hysteria)) && t.coreType != ECoreType.hysteria))
{ {
var item = new MenuItem() var item = new MenuItem()

View File

@ -17,10 +17,7 @@ namespace v2rayN.Views
foreach (ECoreType it in Enum.GetValues(typeof(ECoreType))) foreach (ECoreType it in Enum.GetValues(typeof(ECoreType)))
{ {
if (it == ECoreType.v2rayN) if (it == ECoreType.v2rayN)
continue; continue;
//TODO
if (it is ECoreType.clash or ECoreType.clash_meta or ECoreType.SagerNet)
continue;
cmbCoreType.Items.Add(it.ToString()); cmbCoreType.Items.Add(it.ToString());
} }
cmbCoreType.Items.Add(string.Empty); cmbCoreType.Items.Add(string.Empty);

View File

@ -493,9 +493,6 @@ namespace v2rayN.Views
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(); var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo foreach (var it in coreInfo
.Where(t => t.coreType != ECoreType.v2fly .Where(t => t.coreType != ECoreType.v2fly
&& t.coreType != ECoreType.SagerNet
&& t.coreType != ECoreType.clash
&& t.coreType != ECoreType.clash_meta
&& t.coreType != ECoreType.hysteria)) && t.coreType != ECoreType.hysteria))
{ {
var item = new MenuItem() var item = new MenuItem()