From ae6b3ef7fb7896a5c3f8a95e250614ab8996c380 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sat, 30 Jul 2022 20:27:27 +0800 Subject: [PATCH] DomainMatcher can be set to empty --- .../Forms/RoutingSettingForm.Designer.cs | 15 +- v2rayN/v2rayN/Forms/RoutingSettingForm.cs | 1 + v2rayN/v2rayN/Forms/RoutingSettingForm.resx | 1132 +++++++---------- v2rayN/v2rayN/Global.cs | 1 + v2rayN/v2rayN/Handler/ConfigHandler.cs | 8 +- v2rayN/v2rayN/Handler/V2rayConfigHandler.cs | 2 +- 6 files changed, 444 insertions(+), 715 deletions(-) diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs index 5deebb1a..d9813d1b 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.Designer.cs @@ -45,6 +45,7 @@ this.menuRemove = new System.Windows.Forms.ToolStripMenuItem(); this.menuSelectAll = new System.Windows.Forms.ToolStripMenuItem(); this.menuSetDefaultRouting = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.menuImportAdvancedRules = new System.Windows.Forms.ToolStripMenuItem(); this.MenuItemAdvanced = new System.Windows.Forms.ToolStripMenuItem(); this.menuServer = new System.Windows.Forms.MenuStrip(); @@ -71,7 +72,6 @@ this.txtBlockDomain = new System.Windows.Forms.TextBox(); this.tabPageRuleList = new System.Windows.Forms.TabPage(); this.lvRoutings = new v2rayN.Base.ListViewFlickerFree(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.panel2.SuspendLayout(); this.panel1.SuspendLayout(); this.cmsLv.SuspendLayout(); @@ -135,9 +135,6 @@ // this.cmbdomainMatcher.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbdomainMatcher.FormattingEnabled = true; - this.cmbdomainMatcher.Items.AddRange(new object[] { - resources.GetString("cmbdomainMatcher.Items"), - resources.GetString("cmbdomainMatcher.Items1")}); resources.ApplyResources(this.cmbdomainMatcher, "cmbdomainMatcher"); this.cmbdomainMatcher.Name = "cmbdomainMatcher"; // @@ -209,6 +206,11 @@ resources.ApplyResources(this.menuSetDefaultRouting, "menuSetDefaultRouting"); this.menuSetDefaultRouting.Click += new System.EventHandler(this.menuSetDefaultRouting_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); + // // menuImportAdvancedRules // this.menuImportAdvancedRules.Name = "menuImportAdvancedRules"; @@ -390,11 +392,6 @@ this.lvRoutings.View = System.Windows.Forms.View.Details; this.lvRoutings.DoubleClick += new System.EventHandler(this.lvRoutings_DoubleClick); // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); - // // RoutingSettingForm // resources.ApplyResources(this, "$this"); diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.cs b/v2rayN/v2rayN/Forms/RoutingSettingForm.cs index 13bc1e59..07eef770 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.cs +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.cs @@ -20,6 +20,7 @@ namespace v2rayN.Forms private void RoutingSettingForm_Load(object sender, EventArgs e) { ConfigHandler.InitBuiltinRouting(ref config); + cmbdomainMatcher.Items.AddRange(Global.domainMatchers.ToArray()); cmbdomainStrategy.Text = config.domainStrategy; chkenableRoutingAdvanced.Checked = config.enableRoutingAdvanced; diff --git a/v2rayN/v2rayN/Forms/RoutingSettingForm.resx b/v2rayN/v2rayN/Forms/RoutingSettingForm.resx index c3346803..98640e3f 100644 --- a/v2rayN/v2rayN/Forms/RoutingSettingForm.resx +++ b/v2rayN/v2rayN/Forms/RoutingSettingForm.resx @@ -147,54 +147,6 @@ 1 - - labRoutingTips - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel2 - - - 0 - - - btnOK - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel2 - - - 2 - - - Bottom - - - 0, 613 - - - 853, 60 - - - 7 - - - panel2 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - NoControl @@ -249,95 +201,29 @@ 2 - - cmbdomainMatcher + + Bottom - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0, 613 - - panel1 + + 853, 60 - - 0 + + 7 - - label6 + + panel2 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 1 - - - chkenableRoutingAdvanced - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 2 - - - linkLabelRoutingDoc - - - System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 3 - - - cmbdomainStrategy - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 4 - - - Top - - - 0, 25 - - - 853, 51 - - - 11 - - - panel1 - - + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 2 - - - linear - - - mph + + 3 681, 17 @@ -483,6 +369,30 @@ 4 + + Top + + + 0, 25 + + + 853, 51 + + + 11 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + 17, 17 @@ -526,7 +436,7 @@ Advanced Function - 213, 142 + 213, 120 cmsLv @@ -537,6 +447,18 @@ 139, 17 + + 185, 22 + + + Import Basic Rules + + + 102, 21 + + + Basic Function + 0, 0 @@ -558,17 +480,131 @@ 4 - - 102, 21 + + Fill - - Basic Function + + 3, 17 - - 185, 22 + + True - - Import Basic Rules + + Vertical + + + 441, 485 + + + 25 + + + txtProxyIp + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox5 + + + 0 + + + Fill + + + 392, 0 + + + 447, 505 + + + 4 + + + IP + + + groupBox5 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel5 + + + 0 + + + Fill + + + 3, 17 + + + True + + + Vertical + + + 386, 485 + + + 24 + + + txtProxyDomain + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox6 + + + 0 + + + Left + + + 0, 0 + + + 392, 505 + + + 3 + + + Domain + + + groupBox6 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel5 + + + 1 + + + Fill + + + 3, 3 + + + 839, 505 + + + 12 panel5 @@ -609,6 +645,132 @@ 0 + + Fill + + + 3, 17 + + + True + + + Vertical + + + 441, 485 + + + 25 + + + txtDirectIp + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox3 + + + 0 + + + Fill + + + 392, 0 + + + 447, 505 + + + 4 + + + IP + + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel4 + + + 0 + + + Fill + + + 3, 17 + + + True + + + Vertical + + + 386, 485 + + + 24 + + + txtDirectDomain + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox4 + + + 0 + + + Left + + + 0, 0 + + + 392, 505 + + + 3 + + + Domain + + + groupBox4 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel4 + + + 1 + + + Fill + + + 3, 3 + + + 839, 505 + + + 12 + panel4 @@ -648,6 +810,132 @@ 1 + + Fill + + + 3, 17 + + + True + + + Vertical + + + 441, 485 + + + 25 + + + txtBlockIp + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 0 + + + Fill + + + 392, 0 + + + 447, 505 + + + 4 + + + IP + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel3 + + + 0 + + + Fill + + + 3, 17 + + + True + + + Vertical + + + 386, 485 + + + 24 + + + txtBlockDomain + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + Left + + + 0, 0 + + + 392, 505 + + + 3 + + + Domain + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel3 + + + 1 + + + Fill + + + 3, 3 + + + 839, 505 + + + 12 + panel3 @@ -779,564 +1067,6 @@ 1 - - groupBox5 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel5 - - - 0 - - - groupBox6 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel5 - - - 1 - - - Fill - - - 3, 3 - - - 839, 505 - - - 12 - - - panel5 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageProxy - - - 0 - - - txtProxyIp - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox5 - - - 0 - - - Fill - - - 392, 0 - - - 447, 505 - - - 4 - - - IP - - - groupBox5 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel5 - - - 0 - - - Fill - - - 3, 17 - - - True - - - Vertical - - - 441, 485 - - - 25 - - - txtProxyIp - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox5 - - - 0 - - - txtProxyDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox6 - - - 0 - - - Left - - - 0, 0 - - - 392, 505 - - - 3 - - - Domain - - - groupBox6 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel5 - - - 1 - - - Fill - - - 3, 17 - - - True - - - Vertical - - - 386, 485 - - - 24 - - - txtProxyDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox6 - - - 0 - - - groupBox3 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel4 - - - 0 - - - groupBox4 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel4 - - - 1 - - - Fill - - - 3, 3 - - - 839, 505 - - - 12 - - - panel4 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageDirect - - - 0 - - - txtDirectIp - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox3 - - - 0 - - - Fill - - - 392, 0 - - - 447, 505 - - - 4 - - - IP - - - groupBox3 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel4 - - - 0 - - - Fill - - - 3, 17 - - - True - - - Vertical - - - 441, 485 - - - 25 - - - txtDirectIp - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox3 - - - 0 - - - txtDirectDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox4 - - - 0 - - - Left - - - 0, 0 - - - 392, 505 - - - 3 - - - Domain - - - groupBox4 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel4 - - - 1 - - - Fill - - - 3, 17 - - - True - - - Vertical - - - 386, 485 - - - 24 - - - txtDirectDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox4 - - - 0 - - - groupBox2 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel3 - - - 0 - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel3 - - - 1 - - - Fill - - - 3, 3 - - - 839, 505 - - - 12 - - - panel3 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPageBlock - - - 0 - - - txtBlockIp - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox2 - - - 0 - - - Fill - - - 392, 0 - - - 447, 505 - - - 4 - - - IP - - - groupBox2 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel3 - - - 0 - - - Fill - - - 3, 17 - - - True - - - Vertical - - - 441, 485 - - - 25 - - - txtBlockIp - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox2 - - - 0 - - - txtBlockDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 0 - - - Left - - - 0, 0 - - - 392, 505 - - - 3 - - - Domain - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel3 - - - 1 - - - Fill - - - 3, 17 - - - True - - - Vertical - - - 386, 485 - - - 24 - - - txtBlockDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 0 - True @@ -1373,6 +1103,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + toolStripSeparator1 + + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + menuImportAdvancedRules @@ -1397,12 +1133,6 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - toolStripSeparator1 - - - System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - RoutingSettingForm diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index feb36602..270a75cd 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -214,6 +214,7 @@ namespace v2rayN public static readonly List networks = new List { "tcp", "kcp", "ws", "h2", "quic", "grpc" }; public static readonly List kcpHeaderTypes = new List { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; public static readonly List coreTypes = new List { "v2fly", "SagerNet", "Xray" }; + public static readonly List domainMatchers = new List { "linear", "mph", "" }; public const string GrpcgunMode = "gun"; public const string GrpcmultiMode = "multi"; diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 9b0f1d55..b0e5de74 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -95,10 +95,10 @@ namespace v2rayN.Handler { config.domainStrategy = "IPIfNonMatch"; } - if (Utils.IsNullOrEmpty(config.domainMatcher)) - { - config.domainMatcher = "linear"; - } + //if (Utils.IsNullOrEmpty(config.domainMatcher)) + //{ + // config.domainMatcher = "linear"; + //} //kcp if (config.kcpItem == null) diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs index bd89f191..893350ce 100644 --- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs @@ -200,7 +200,7 @@ namespace v2rayN.Handler && v2rayConfig.routing.rules != null) { v2rayConfig.routing.domainStrategy = config.domainStrategy; - v2rayConfig.routing.domainMatcher = config.domainMatcher; + v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(config.domainMatcher) ? null : config.domainMatcher; if (config.enableRoutingAdvanced) {