From 90289120d37c24e2fd678d08e08535562481a000 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 13 Apr 2022 09:21:40 +0800 Subject: [PATCH] add clash.meta core --- v2rayN/v2rayN/Forms/AddServer2Form.cs | 1 + v2rayN/v2rayN/Global.cs | 1 + v2rayN/v2rayN/Handler/LazyConfig.cs | 9 +++++++++ v2rayN/v2rayN/Handler/V2rayConfigHandler.cs | 1 + v2rayN/v2rayN/Mode/ECoreType.cs | 1 + 5 files changed, 13 insertions(+) diff --git a/v2rayN/v2rayN/Forms/AddServer2Form.cs b/v2rayN/v2rayN/Forms/AddServer2Form.cs index 0d65b972..9ca7e2ff 100644 --- a/v2rayN/v2rayN/Forms/AddServer2Form.cs +++ b/v2rayN/v2rayN/Forms/AddServer2Form.cs @@ -20,6 +20,7 @@ namespace v2rayN.Forms { cmbCoreType.Items.AddRange(Global.coreTypes.ToArray()); cmbCoreType.Items.Add("clash"); + cmbCoreType.Items.Add("clash_meta"); cmbCoreType.Items.Add("hysteria"); cmbCoreType.Items.Add(string.Empty); diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index ea3e6803..a7fa67ae 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -15,6 +15,7 @@ namespace v2rayN public const string xrayCoreUrl = "https://github.com/XTLS/Xray-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 hysteriaCoreUrl = "https://github.com/HyNetwork/hysteria/releases"; diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index 98b65c51..7b523757 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -92,6 +92,15 @@ namespace v2rayN.Handler coreUrl = Global.clashCoreUrl }); + coreInfos.Add(new CoreInfo + { + coreType = ECoreType.clash_meta, + coreExes = new List { "Clash.Meta-windows-amd64v1", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" }, + arguments = "-f config.yaml", + coreUrl = Global.clashMetaCoreUrl, + match = "Clash Meta" + }); + coreInfos.Add(new CoreInfo { coreType = ECoreType.hysteria, diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs index 2f1eb59a..45b214d3 100644 --- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs @@ -957,6 +957,7 @@ namespace v2rayN.Handler case ECoreType.Xray: break; case ECoreType.clash: + case ECoreType.clash_meta: fileContent.Add($"port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundHttp2)}"); fileContent.Add($"socks-port: {LazyConfig.Instance.GetConfig().GetLocalPort(Global.InboundSocks)}"); break; diff --git a/v2rayN/v2rayN/Mode/ECoreType.cs b/v2rayN/v2rayN/Mode/ECoreType.cs index be245303..c714876d 100644 --- a/v2rayN/v2rayN/Mode/ECoreType.cs +++ b/v2rayN/v2rayN/Mode/ECoreType.cs @@ -6,6 +6,7 @@ namespace v2rayN.Mode v2fly = 1, Xray = 2, clash = 11, + clash_meta = 12, hysteria = 21, v2rayN = 99 }