Skip to content

Commit

Permalink
Remove SagerNet clash clash_meta
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Oct 5, 2024
1 parent b33f536 commit 75d86cf
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 79 deletions.
6 changes: 3 additions & 3 deletions v2rayN/ServiceLib/Enums/ECoreType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ public enum ECoreType
{
v2fly = 1,
Xray = 2,
SagerNet = 3,
//SagerNet = 3,
v2fly_v5 = 4,
clash = 11,
clash_meta = 12,
//clash = 11,
//clash_meta = 12,
mihomo = 13,
hysteria = 21,
naiveproxy = 22,
Expand Down
5 changes: 1 addition & 4 deletions v2rayN/ServiceLib/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ public class Global
public const string GithubApiUrl = "https://api.github.com/repos";
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 SagerNetCoreUrl = "https://github.com/SagerNet/v2ray-core/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 HysteriaCoreUrl = "https://github.com/apernet/hysteria/releases";
public const string NaiveproxyCoreUrl = "https://github.com/klzgrad/naiveproxy/releases";
Expand Down Expand Up @@ -166,7 +163,7 @@ public class Global
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> 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> DomainStrategies = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
public static readonly List<string> DomainStrategies4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static int GenerateClientConfig(ProfileItem node, string? fileName, out s
msg = ResUI.InitialConfiguration;
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);
return configGenClash.GenerateClientCustomConfig(node, fileName, out msg);
Expand Down
48 changes: 6 additions & 42 deletions v2rayN/ServiceLib/Handler/CoreInfoHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@ private void InitCoreInfo()
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
{
coreType = ECoreType.v2fly_v5,
Expand Down Expand Up @@ -102,43 +90,19 @@ private void InitCoreInfo()
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
{
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.json" + PortableMode(),
coreUrl = Global.MihomoCoreUrl,
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
coreDownloadUrl32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
coreDownloadUrl64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
coreDownloadUrlArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
coreDownloadUrlLinux32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-linux-386-{0}.gz",
coreDownloadUrlLinux64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
coreDownloadUrlLinuxArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
coreDownloadUrl32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
coreDownloadUrl64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
coreDownloadUrlArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
coreDownloadUrlLinux32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-386-{0}.gz",
coreDownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
coreDownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
match = "Mihomo",
versionArg = "-v",
redirectInfo = true,
Expand Down
8 changes: 0 additions & 8 deletions v2rayN/ServiceLib/Handler/LazyConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ public LazyConfig()
SQLiteHelper.Instance.CreateTable<RoutingItem>();
SQLiteHelper.Instance.CreateTable<ProfileExItem>();
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
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/ServiceLib/Handler/Statistics/StatisticsSingbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private async void Run()
await Task.Delay(1000);
try
{
if (!(_config.IsRunningCore(ECoreType.clash)))
if (!(_config.IsRunningCore(ECoreType.sing_box)))
{
continue;
}
Expand Down
6 changes: 0 additions & 6 deletions v2rayN/ServiceLib/Handler/UpdateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,11 @@ private SemanticVersion GetCoreVersion(ECoreType type)
switch (type)
{
case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray:
case ECoreType.v2fly_v5:
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
break;

case ECoreType.clash:
case ECoreType.clash_meta:
case ECoreType.mihomo:
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
break;
Expand Down Expand Up @@ -379,7 +376,6 @@ private async Task<ResultEventArgs> ParseDownloadUrl(ECoreType type, string gitH
switch (type)
{
case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray:
case ECoreType.v2fly_v5:
{
Expand All @@ -388,8 +384,6 @@ private async Task<ResultEventArgs> ParseDownloadUrl(ECoreType type, string gitH
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"));
break;
}
case ECoreType.clash:
case ECoreType.clash_meta:
case ECoreType.mihomo:
{
curVersion = GetCoreVersion(type);
Expand Down
4 changes: 2 additions & 2 deletions v2rayN/ServiceLib/Models/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public class Config

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;
}
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;
}
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void Init()
Observable.Interval(TimeSpan.FromSeconds(5))
.Subscribe(x =>
{
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.clash)))
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public void DelayTestTask()
Observable.Interval(TimeSpan.FromSeconds(60))
.Subscribe(x =>
{
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.clash)))
if (!(AutoRefresh && _config.uiItem.showInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ public void ReloadResult()
{
ChangeSystemProxyStatusAsync(_config.systemProxyItem.sysProxyType, false);
BlReloadEnabled = true;
ShowClashUI = _config.IsRunningCore(ECoreType.clash);
ShowClashUI = _config.IsRunningCore(ECoreType.sing_box);
if (ShowClashUI)
{
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
Expand Down
2 changes: 0 additions & 2 deletions v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,6 @@ private void AddHelpMenuItem()
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo
.Where(t => t.coreType != ECoreType.v2fly
&& t.coreType != ECoreType.clash
&& t.coreType != ECoreType.clash_meta
&& t.coreType != ECoreType.hysteria))
{
var item = new MenuItem()
Expand Down
5 changes: 1 addition & 4 deletions v2rayN/v2rayN/Views/AddServer2Window.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public AddServer2Window(ProfileItem profileItem)
foreach (ECoreType it in Enum.GetValues(typeof(ECoreType)))
{
if (it == ECoreType.v2rayN)
continue;
//TODO
if (it is ECoreType.clash or ECoreType.clash_meta or ECoreType.SagerNet)
continue;
continue;
cmbCoreType.Items.Add(it.ToString());
}
cmbCoreType.Items.Add(string.Empty);
Expand Down
3 changes: 0 additions & 3 deletions v2rayN/v2rayN/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,6 @@ private void AddHelpMenuItem()
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
foreach (var it in coreInfo
.Where(t => t.coreType != ECoreType.v2fly
&& t.coreType != ECoreType.SagerNet
&& t.coreType != ECoreType.clash
&& t.coreType != ECoreType.clash_meta
&& t.coreType != ECoreType.hysteria))
{
var item = new MenuItem()
Expand Down

0 comments on commit 75d86cf

Please sign in to comment.