diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index 6b293a83..d472f40b 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -1501,6 +1501,12 @@ namespace v2rayN.Forms /// private void RefreshRoutingsMenu() { + menuRoutings.Visible = config.enableRoutingAdvanced; + if (!config.enableRoutingAdvanced) + { + return; + } + menuRoutings.DropDownItems.Clear(); List lst = new List(); diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs index 513d218e..16fa9b00 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs @@ -32,9 +32,10 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoutingSettingForm)); this.btnClose = new System.Windows.Forms.Button(); this.panel2 = new System.Windows.Forms.Panel(); + this.labRoutingTips = new System.Windows.Forms.Label(); this.btnOK = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); - this.labRoutingTips = new System.Windows.Forms.Label(); + this.chkenableRoutingAdvanced = new System.Windows.Forms.CheckBox(); this.linkLabelRoutingDoc = new System.Windows.Forms.LinkLabel(); this.cmbdomainStrategy = new System.Windows.Forms.ComboBox(); this.cmsLv = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -96,10 +97,17 @@ // panel2 // resources.ApplyResources(this.panel2, "panel2"); + this.panel2.Controls.Add(this.labRoutingTips); this.panel2.Controls.Add(this.btnClose); this.panel2.Controls.Add(this.btnOK); this.panel2.Name = "panel2"; // + // labRoutingTips + // + resources.ApplyResources(this.labRoutingTips, "labRoutingTips"); + this.labRoutingTips.ForeColor = System.Drawing.Color.Brown; + this.labRoutingTips.Name = "labRoutingTips"; + // // btnOK // resources.ApplyResources(this.btnOK, "btnOK"); @@ -110,16 +118,17 @@ // panel1 // resources.ApplyResources(this.panel1, "panel1"); - this.panel1.Controls.Add(this.labRoutingTips); + this.panel1.Controls.Add(this.chkenableRoutingAdvanced); this.panel1.Controls.Add(this.linkLabelRoutingDoc); this.panel1.Controls.Add(this.cmbdomainStrategy); this.panel1.Name = "panel1"; // - // labRoutingTips + // chkenableRoutingAdvanced // - resources.ApplyResources(this.labRoutingTips, "labRoutingTips"); - this.labRoutingTips.ForeColor = System.Drawing.Color.Brown; - this.labRoutingTips.Name = "labRoutingTips"; + resources.ApplyResources(this.chkenableRoutingAdvanced, "chkenableRoutingAdvanced"); + this.chkenableRoutingAdvanced.Name = "chkenableRoutingAdvanced"; + this.chkenableRoutingAdvanced.UseVisualStyleBackColor = true; + this.chkenableRoutingAdvanced.CheckedChanged += new System.EventHandler(this.chkenableRoutingAdvanced_CheckedChanged_1); // // linkLabelRoutingDoc // @@ -415,5 +424,6 @@ private System.Windows.Forms.TabPage tabPageRuleList; private Base.ListViewFlickerFree lvRoutings; private System.Windows.Forms.Label labRoutingTips; + private System.Windows.Forms.CheckBox chkenableRoutingAdvanced; } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.cs b/v2rayN/v2rayN/Forms/RoutingSettingForm.cs index 9066fb34..5e015af7 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.cs +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.cs @@ -21,6 +21,7 @@ namespace v2rayN.Forms ConfigHandler.InitBuiltinRouting(ref config); cmbdomainStrategy.Text = config.domainStrategy; + chkenableRoutingAdvanced.Checked = config.enableRoutingAdvanced; if (config.routings == null) { @@ -30,24 +31,25 @@ namespace v2rayN.Forms RefreshRoutingsView(); BindingLockedData(); - - } + InitUI(); + } private void tabNormal_Selecting(object sender, TabControlCancelEventArgs e) { - if (tabNormal.SelectedTab == tabPageRuleList) - { - MenuItem1.Enabled = true; - } - else - { - MenuItem1.Enabled = false; - } + //if (tabNormal.SelectedTab == tabPageRuleList) + //{ + // MenuItem1.Enabled = true; + //} + //else + //{ + // MenuItem1.Enabled = false; + //} } private void btnOK_Click(object sender, EventArgs e) { config.domainStrategy = cmbdomainStrategy.Text; + config.enableRoutingAdvanced = chkenableRoutingAdvanced.Checked; EndBindingLockedData(); if (ConfigHandler.SaveRouting(ref config) == 0) @@ -64,6 +66,31 @@ namespace v2rayN.Forms { this.DialogResult = DialogResult.Cancel; } + private void chkenableRoutingAdvanced_CheckedChanged_1(object sender, EventArgs e) + { + InitUI(); + } + private void InitUI() + { + if (chkenableRoutingAdvanced.Checked) + { + this.tabPageProxy.Parent = null; + this.tabPageDirect.Parent = null; + this.tabPageBlock.Parent = null; + this.tabPageRuleList.Parent = tabNormal; + MenuItem1.Enabled = true; + + } + else + { + this.tabPageProxy.Parent = tabNormal; + this.tabPageDirect.Parent = tabNormal; + this.tabPageBlock.Parent = tabNormal; + this.tabPageRuleList.Parent = null; + MenuItem1.Enabled = false; + } + + } #region locked @@ -94,6 +121,7 @@ namespace v2rayN.Forms lockedItem.rules[2].domain = Utils.String2List(txtBlockDomain.Text.TrimEx()); lockedItem.rules[2].ip = Utils.String2List(txtBlockIp.Text.TrimEx()); + } } #endregion @@ -136,7 +164,7 @@ namespace v2rayN.Forms { def = "√"; } - + ListViewItem lvItem = new ListViewItem(def); Utils.AddSubItem(lvItem, "remarks", item.remarks); Utils.AddSubItem(lvItem, "count", item.rules.Count.ToString()); @@ -260,5 +288,6 @@ namespace v2rayN.Forms #endregion + } } diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.resx b/v2rayN/v2rayN/Forms/RoutingSettingForm.resx index 8a7aaba4..f784cf53 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.resx +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 4 + cmbdomainStrategy @@ -124,42 +127,39 @@ 839, 505 - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 386, 485 + + + 392, 0 - + Fill - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPageRuleList - 853, 25 - - Fill - - - 441, 485 + + txtDirectIp IP - - 6, 12 + + Fill - - 0 + + panel1 447, 505 - - Bottom + + 441, 485 Edit and Function @@ -173,30 +173,27 @@ panel1 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 25 3 - - IPOnDemand - 0 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True - 25 3, 17 - - groupBox5 + + Domain System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -207,14 +204,17 @@ System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 392, 505 + + 3, 3, 3, 3 15 - - txtProxyDomain + + 0 + + + False 6, 21 @@ -225,24 +225,24 @@ 853, 673 + + 392, 0 + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 NoControl - - 3, 17 + + $this - - MenuItem1 + + 0 Routing Settings - - Fill - Remove selected @@ -252,23 +252,23 @@ IP + + 845, 511 + - 4.Pre-defined Rule Set List + Pre-defined Rule Set List - - Domain - - - 2 + + Fill - 475, 17 + 660, 17 Domain strategy - - 1 + + groupBox3 447, 505 @@ -276,44 +276,41 @@ System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 853, 60 + tabNormal - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + MenuItem1 - 0 + 1 System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 3, 3, 3, 3 - - - tabPageRuleList - tabPageBlock - - 568, 17 + + groupBox1 - - False + + IPOnDemand - - 194, 22 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - panel5 + + 318, 17 panel5 - - 0, 0 + + 95, 12 Fill @@ -321,8 +318,8 @@ Domain - - 853, 60 + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -333,11 +330,11 @@ 0 - - 4 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 386, 485 + + 75, 23 menuServer @@ -345,8 +342,11 @@ 1 - - 120, 21 + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel3 System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -354,8 +354,8 @@ panel5 - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tabPageRuleList 2 @@ -378,11 +378,8 @@ 5 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True + + NoControl txtProxyIp @@ -390,47 +387,41 @@ 845, 511 - - 386, 485 - Add - - 25 + + 15 True - - groupBox3 + + txtBlockIp - - tabPageProxy + + 0 - panel1 + panel2 - - True - - - v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + tabPageRuleList 2 - - labRoutingTips + + 3 - - 95, 12 + + chkenableRoutingAdvanced - - panel3 + + NoControl - 1 + 2 RoutingSettingForm @@ -438,17 +429,17 @@ 441, 485 - - 1 + + panel2 - - 0 + + 0, 0 0 - - tabPageDirect + + True Fill @@ -456,8 +447,8 @@ $this - - 25 + + 2 392, 505 @@ -465,8 +456,8 @@ groupBox2 - - 0 + + 194, 22 panel4 @@ -486,11 +477,8 @@ groupBox4 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 3, 3 + + 1.Proxy Domain or IP True @@ -498,50 +486,50 @@ 195, 92 + + True + btnOK 3, 3, 3, 3 + + 26 + 116, 17 - - txtBlockIp - - - NoControl - - - 0 - - - 542, 16 - - - $this - - - True - - - Left - panel4 + + 0 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 24 + + + Left + 441, 485 - - 0 + + 3, 3 3 - - 386, 485 + + 3, 17 0, 0, 0, 0 @@ -552,32 +540,26 @@ IPIfNonMatch - - 3, 17 - 853, 537 1 - - 24 + + panel1 - - Fill - - - panel2 + + 25 1 - - tabPageBlock + + 0 - - 16 + + 853, 51 0, 0 @@ -585,8 +567,8 @@ panel4 - - groupBox1 + + 194, 22 panel3 @@ -617,15 +599,18 @@ 165, 20 + + 0 + + + Fill + 4, 22 groupBox4 - - 0 - tabNormal @@ -635,8 +620,11 @@ tabNormal - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + 4, 22 Fill @@ -650,8 +638,8 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - $this + + panel2 845, 511 @@ -659,12 +647,18 @@ 3, 17 - - 4 + + v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + tabPageProxy System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + panel3 @@ -677,38 +671,44 @@ System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 216, 16 + 1 AsIs - - panel2 + + txtDirectDomain groupBox1 - - 194, 22 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + 0, 76 0 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Fill 3.Block Domain or IP - - NoControl - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 4 11 @@ -716,6 +716,9 @@ groupBox2 + + 0, 0 + 12 @@ -725,26 +728,32 @@ 7 - - True + + Enable advanced routing function - - v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + 3, 17 - - 392, 0 + + 1 + + + NoControl + + + 0 12 - - 845, 511 + + v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 19 - - 0, 0 + + 392, 505 *Set the rules, separated by commas (,); The comma in the regular is replaced by <COMMA> @@ -752,38 +761,50 @@ groupBox6 - - txtDirectDomain + + Top + + + Fill 839, 505 + + 2.Direct Domain or IP + 0, 613 - - 3 - - - 0 + + Fill tabPageDirect - - 839, 505 + + 562, 16 - - Set as active routing + + Fill - - Domain + + 3, 17 - - Left + + 120, 21 - - txtDirectIp + + 3 + + + 194, 22 + + + NoControl + + + tabPageDirect 4 @@ -806,29 +827,29 @@ 3, 3, 3, 3 - - 15 + + 6, 12 - - 0 + + 1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 3, 3, 3, 3 - - panel1 + + 3, 3 System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 3, 17 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuSetDefaultRouting - - - 3 + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -842,8 +863,8 @@ 194, 22 - - 392, 0 + + Bottom 3 @@ -860,29 +881,32 @@ 24 - - 3 + + tabPageBlock 0 + + 3, 17 + menuRemove - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Left - - Fill + + labRoutingTips - - NoControl + + txtProxyDomain - - 2.Direct Domain or IP + + Domain - - 4, 22 + + groupBox5 0 @@ -896,24 +920,27 @@ 4, 22 - - 3, 3 + + Set as active routing 392, 505 - - 194, 22 + + 0, 0 - - Fill + + 0 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0 75, 23 + + 5, 22 + Fill @@ -923,11 +950,14 @@ 2 - - 0 + + 16 - - 1.Proxy Domain or IP + + panel5 + + + 3 groupBox5 @@ -938,23 +968,23 @@ 24 - - Fill - - - 0, 0 + + menuSetDefaultRouting IP - - 75, 23 + + 839, 505 - - 3, 17 + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0, 76 + + 386, 485 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 3, 3 @@ -965,8 +995,8 @@ 447, 505 - - Fill + + 386, 485 menuAdd @@ -977,21 +1007,18 @@ System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 299, 21 + + 753, 17 System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 853, 51 + + 0 - - Top + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - zh-Hans - True diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx index 5c043970..a5b85f29 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.zh-Hans.resx @@ -117,25 +117,37 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 691, 17 + 取消(&C) - - 确定(&O) - - - - 0, 545 - - - 817, 60 - 518, 16 *设置的路由规则,用逗号(,)分隔;正则中的逗号用<COMMA>替代 + + 598, 17 + + + 确定(&O) + + + 0, 545 + + + 817, 60 + + + 120, 16 + + + 启用路由高级功能 + 77, 12 @@ -268,7 +280,7 @@ 809, 443 - 4.预定义规则集列表 + 预定义规则集列表 817, 469 diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 0eaf0665..5fbf1fdc 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -1,4 +1,6 @@  +using System.Collections.Generic; + namespace v2rayN { class Global @@ -190,6 +192,8 @@ namespace v2rayN public const string IEProxyExceptions = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*"; public const string RoutingRuleComma = ""; + + public static readonly IEnumerable ssSecuritys = new HashSet { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" }; #endregion #region 全局变量 diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 38b6d623..0fccf551 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -528,8 +528,7 @@ namespace v2rayN.Handler vmessItem.id = vmessItem.id.TrimEx(); vmessItem.security = vmessItem.security.TrimEx(); - var securitys = new HashSet() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" }; - if (!securitys.Contains(vmessItem.security)) + if (!Global.ssSecuritys.Contains(vmessItem.security)) { return -1; } diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs index 3f2ba417..a6a35459 100644 --- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs @@ -190,19 +190,32 @@ namespace v2rayN.Handler { v2rayConfig.routing.domainStrategy = config.domainStrategy; - var lockedItem = ConfigHandler.GetLockedRoutingItem(ref config); - if (lockedItem != null) + if (config.enableRoutingAdvanced) { - foreach (var item in lockedItem.rules) + if (config.routings != null && config.routingIndex < config.routings.Count) { - routingUserRule(item, ref v2rayConfig); + foreach (var item in config.routings[config.routingIndex].rules) + { + routingUserRule(item, ref v2rayConfig); + } } } - if (config.routings != null && config.routingIndex < config.routings.Count) + else { - foreach (var item in config.routings[config.routingIndex].rules) + var lockedItem = ConfigHandler.GetLockedRoutingItem(ref config); + if (lockedItem != null) { - routingUserRule(item, ref v2rayConfig); + foreach (var item in lockedItem.rules) + { + routingUserRule(item, ref v2rayConfig); + } + //Extra to bypass the mainland + string result = Utils.GetEmbedText(Global.CustomRoutingFileName + "white"); + var lstRules = Utils.FromJson>(result); + foreach (var item in lstRules) + { + routingUserRule(item, ref v2rayConfig); + } } } } @@ -378,7 +391,15 @@ namespace v2rayN.Handler serversItem.address = config.address(); serversItem.port = config.port(); serversItem.password = config.id(); - serversItem.method = config.security(); + if (Global.ssSecuritys.Contains(config.security())) + { + serversItem.method = config.security(); + } + else + { + serversItem.method = "none"; + } + serversItem.ota = false; serversItem.level = 1; diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 552b35fb..a7733912 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -169,7 +169,11 @@ namespace v2rayN.Mode { get; set; } - + public bool enableRoutingAdvanced + { + get; set; + } + public ECoreType coreType { get; set; diff --git a/v2rayN/v2rayN/Properties/AssemblyInfo.cs b/v2rayN/v2rayN/Properties/AssemblyInfo.cs index d26a2167..1df9cdb0 100644 --- a/v2rayN/v2rayN/Properties/AssemblyInfo.cs +++ b/v2rayN/v2rayN/Properties/AssemblyInfo.cs @@ -32,4 +32,4 @@ using System.Runtime.InteropServices; // 方法是按如下所示使用“*”: //[assembly: AssemblyVersion("1.0.*")] //[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("4.9")] +[assembly: AssemblyFileVersion("4.10")] diff --git a/v2rayN/v2rayN/Sample/custom_routing_locked b/v2rayN/v2rayN/Sample/custom_routing_locked index b4636131..018ee608 100644 --- a/v2rayN/v2rayN/Sample/custom_routing_locked +++ b/v2rayN/v2rayN/Sample/custom_routing_locked @@ -8,8 +8,8 @@ { "outboundTag": "direct", "domain": [ - "domain:example.com", - "domain:example2.com" + "domain:example-example.com", + "domain:example-example2.com" ] }, { diff --git a/v2rayN/v2rayN/Sample/custom_routing_white b/v2rayN/v2rayN/Sample/custom_routing_white index 61c48382..a708ae0d 100644 --- a/v2rayN/v2rayN/Sample/custom_routing_white +++ b/v2rayN/v2rayN/Sample/custom_routing_white @@ -2,8 +2,8 @@ { "outboundTag": "direct", "domain": [ - "domain:example.com", - "domain:example2.com" + "domain:example-example.com", + "domain:example-example2.com" ] }, {