diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 2cea5cfb..70f7993d 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -1180,7 +1180,7 @@ namespace v2rayN.Handler var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.yaml"); File.WriteAllText(fileName, clipboardData); - profileItem.coreType = ECoreType.clash; + profileItem.coreType = ECoreType.mihomo; profileItem.address = fileName; profileItem.remarks = "clash_custom"; } diff --git a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs index 2042f588..00f4e9ec 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs @@ -119,6 +119,7 @@ namespace v2rayN.Handler case ECoreType.clash: case ECoreType.clash_meta: + case ECoreType.mihomo: //remove the original var indexPort = fileContent.FindIndex(t => t.Contains("port:")); if (indexPort >= 0) diff --git a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs index 19e3c14c..d1e73c4e 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs @@ -6,7 +6,6 @@ namespace v2rayN.Handler { internal class CoreConfigSingbox { - private string SampleClient = Global.SingboxSampleClient; private Config _config; public CoreConfigSingbox(Config config) @@ -28,7 +27,7 @@ namespace v2rayN.Handler msg = ResUI.InitialConfiguration; - string result = Utils.GetEmbedText(SampleClient); + string result = Utils.GetEmbedText(Global.SingboxSampleClient); if (Utils.IsNullOrEmpty(result)) { msg = ResUI.FailedGetDefaultConfiguration; @@ -42,17 +41,17 @@ namespace v2rayN.Handler return -1; } - log(singboxConfig); + GenLog(singboxConfig); - inbound(singboxConfig); + GenInbounds(singboxConfig); - outbound(node, singboxConfig); + GenOutbounds(node, singboxConfig); - routing(singboxConfig); + GenRouting(singboxConfig); - dns(node, singboxConfig); + GenDns(node, singboxConfig); - statistic(singboxConfig); + GenStatistic(singboxConfig); msg = string.Format(ResUI.SuccessfulConfiguration, ""); } @@ -65,7 +64,7 @@ namespace v2rayN.Handler return 0; } - private int log(SingboxConfig singboxConfig) + private int GenLog(SingboxConfig singboxConfig) { try { @@ -103,7 +102,7 @@ namespace v2rayN.Handler #region inbound private - private int inbound(SingboxConfig singboxConfig) + private int GenInbounds(SingboxConfig singboxConfig) { try { @@ -203,7 +202,7 @@ namespace v2rayN.Handler #region outbound private - private int outbound(ProfileItem node, SingboxConfig singboxConfig) + private int GenOutbounds(ProfileItem node, SingboxConfig singboxConfig) { try { @@ -235,7 +234,7 @@ namespace v2rayN.Handler outbound.security = Global.DefaultSecurity; } - outboundMux(node, outbound); + GenOutboundMux(node, outbound); } else if (node.configType == EConfigType.Shadowsocks) { @@ -244,7 +243,7 @@ namespace v2rayN.Handler outbound.method = LazyConfig.Instance.GetShadowsocksSecuritys(node).Contains(node.security) ? node.security : "none"; outbound.password = node.id; - outboundMux(node, outbound); + GenOutboundMux(node, outbound); } else if (node.configType == EConfigType.Socks) { @@ -268,7 +267,7 @@ namespace v2rayN.Handler if (Utils.IsNullOrEmpty(node.flow)) { - outboundMux(node, outbound); + GenOutboundMux(node, outbound); } else { @@ -281,7 +280,7 @@ namespace v2rayN.Handler outbound.password = node.id; - outboundMux(node, outbound); + GenOutboundMux(node, outbound); } else if (node.configType == EConfigType.Hysteria2) { @@ -292,7 +291,7 @@ namespace v2rayN.Handler outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null; outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null; - outboundMux(node, outbound); + GenOutboundMux(node, outbound); } else if (node.configType == EConfigType.Tuic) { @@ -302,12 +301,12 @@ namespace v2rayN.Handler outbound.password = node.security; outbound.congestion_control = node.headerType; - outboundMux(node, outbound); + GenOutboundMux(node, outbound); } - outboundTls(node, outbound); + GenOutboundTls(node, outbound); - outboundTransport(node, outbound); + GenOutboundTransport(node, outbound); } catch (Exception ex) { @@ -316,7 +315,7 @@ namespace v2rayN.Handler return 0; } - private int outboundMux(ProfileItem node, Outbound4Sbox outbound) + private int GenOutboundMux(ProfileItem node, Outbound4Sbox outbound) { try { @@ -341,7 +340,7 @@ namespace v2rayN.Handler return 0; } - private int outboundTls(ProfileItem node, Outbound4Sbox outbound) + private int GenOutboundTls(ProfileItem node, Outbound4Sbox outbound) { try { @@ -391,7 +390,7 @@ namespace v2rayN.Handler return 0; } - private int outboundTransport(ProfileItem node, Outbound4Sbox outbound) + private int GenOutboundTransport(ProfileItem node, Outbound4Sbox outbound) { try { @@ -447,7 +446,7 @@ namespace v2rayN.Handler #region routing rule private - private int routing(SingboxConfig singboxConfig) + private int GenRouting(SingboxConfig singboxConfig) { try { @@ -458,7 +457,7 @@ namespace v2rayN.Handler var tunRules = Utils.FromJson>(Utils.GetEmbedText(Global.TunSingboxRulesFileName)); singboxConfig.route.rules.AddRange(tunRules); - routingDirectExe(out List lstDnsExe, out List lstDirectExe); + GenRoutingDirectExe(out List lstDnsExe, out List lstDirectExe); singboxConfig.route.rules.Add(new() { port = new() { 53 }, @@ -483,7 +482,7 @@ namespace v2rayN.Handler { if (item.enabled) { - routingUserRule(item, singboxConfig.route.rules); + GenRoutingUserRule(item, singboxConfig.route.rules); } } } @@ -496,7 +495,7 @@ namespace v2rayN.Handler var rules = Utils.FromJson>(lockedItem.ruleSet); foreach (var item in rules!) { - routingUserRule(item, singboxConfig.route.rules); + GenRoutingUserRule(item, singboxConfig.route.rules); } } } @@ -508,7 +507,7 @@ namespace v2rayN.Handler return 0; } - private void routingDirectExe(out List lstDnsExe, out List lstDirectExe) + private void GenRoutingDirectExe(out List lstDnsExe, out List lstDirectExe) { lstDnsExe = new(); lstDirectExe = new(); @@ -534,7 +533,7 @@ namespace v2rayN.Handler } } - private int routingUserRule(RulesItem item, List rules) + private int GenRoutingUserRule(RulesItem item, List rules) { try { @@ -575,7 +574,7 @@ namespace v2rayN.Handler { foreach (var it in item.domain) { - parseV2Domain(it, rule); + ParseV2Domain(it, rule); } rules.Add(rule); hasDomainIp = true; @@ -585,7 +584,7 @@ namespace v2rayN.Handler { foreach (var it in item.ip) { - parseV2Address(it, rule2); + ParseV2Address(it, rule2); } rules.Add(rule2); hasDomainIp = true; @@ -610,7 +609,7 @@ namespace v2rayN.Handler return 0; } - private void parseV2Domain(string domain, Rule4Sbox rule) + private void ParseV2Domain(string domain, Rule4Sbox rule) { if (domain.StartsWith("ext:") || domain.StartsWith("ext-domain:")) { @@ -650,7 +649,7 @@ namespace v2rayN.Handler } } - private void parseV2Address(string address, Rule4Sbox rule) + private void ParseV2Address(string address, Rule4Sbox rule) { if (address.StartsWith("ext:") || address.StartsWith("ext-ip:")) { @@ -676,7 +675,7 @@ namespace v2rayN.Handler #region dns private - private int dns(ProfileItem node, SingboxConfig singboxConfig) + private int GenDns(ProfileItem node, SingboxConfig singboxConfig) { try { @@ -734,7 +733,7 @@ namespace v2rayN.Handler #endregion dns private - private int statistic(SingboxConfig singboxConfig) + private int GenStatistic(SingboxConfig singboxConfig) { if (_config.guiItem.enableStatistics) { diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index adc922c8..0902d880 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -148,7 +148,7 @@ namespace v2rayN.ViewModels //CheckUpdate public ReactiveCommand CheckUpdateNCmd { get; } - public ReactiveCommand CheckUpdateV2flyCoreCmd { get; } + //public ReactiveCommand CheckUpdateV2flyCoreCmd { get; } //public ReactiveCommand CheckUpdateSagerNetCoreCmd { get; } public ReactiveCommand CheckUpdateXrayCoreCmd { get; } @@ -509,10 +509,10 @@ namespace v2rayN.ViewModels { CheckUpdateN(); }); - CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() => - { - CheckUpdateCore(ECoreType.v2fly_v5); - }); + //CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() => + //{ + // CheckUpdateCore(ECoreType.v2fly_v5); + //}); //CheckUpdateSagerNetCoreCmd = ReactiveCommand.Create(() => //{ // CheckUpdateCore(ECoreType.SagerNet); diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index 6484de4a..0ae5dcb4 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -1,17 +1,17 @@ - - diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index d6598073..0d1944f7 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -140,7 +140,7 @@ namespace v2rayN.Views //checkupdate this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables); - this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables); + //this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables); //this.BindCommand(ViewModel, vm => vm.CheckUpdateSagerNetCoreCmd, v => v.menuCheckUpdateSagerNetCore).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables); //this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);