diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs index d2968958..6862f728 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs @@ -50,6 +50,8 @@ this.txtlocalPort = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.cmbdomainStrategy4Freedom = new System.Windows.Forms.ComboBox(); + this.label19 = new System.Windows.Forms.Label(); this.linkDnsObjectDoc = new System.Windows.Forms.LinkLabel(); this.txtremoteDNS = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); @@ -270,12 +272,31 @@ // tabPage2 // resources.ApplyResources(this.tabPage2, "tabPage2"); + this.tabPage2.Controls.Add(this.cmbdomainStrategy4Freedom); + this.tabPage2.Controls.Add(this.label19); this.tabPage2.Controls.Add(this.linkDnsObjectDoc); this.tabPage2.Controls.Add(this.txtremoteDNS); this.tabPage2.Controls.Add(this.label14); this.tabPage2.Name = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; // + // cmbdomainStrategy4Freedom + // + resources.ApplyResources(this.cmbdomainStrategy4Freedom, "cmbdomainStrategy4Freedom"); + this.cmbdomainStrategy4Freedom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbdomainStrategy4Freedom.FormattingEnabled = true; + this.cmbdomainStrategy4Freedom.Items.AddRange(new object[] { + resources.GetString("cmbdomainStrategy4Freedom.Items"), + resources.GetString("cmbdomainStrategy4Freedom.Items1"), + resources.GetString("cmbdomainStrategy4Freedom.Items2"), + resources.GetString("cmbdomainStrategy4Freedom.Items3")}); + this.cmbdomainStrategy4Freedom.Name = "cmbdomainStrategy4Freedom"; + // + // label19 + // + resources.ApplyResources(this.label19, "label19"); + this.label19.Name = "label19"; + // // linkDnsObjectDoc // resources.ApplyResources(this.linkDnsObjectDoc, "linkDnsObjectDoc"); @@ -746,5 +767,7 @@ private System.Windows.Forms.ComboBox cmbSystemProxyAdvancedProtocol; private System.Windows.Forms.Label label18; private System.Windows.Forms.NumericUpDown numStatisticsFreshRate; + private System.Windows.Forms.ComboBox cmbdomainStrategy4Freedom; + private System.Windows.Forms.Label label19; } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs index 5d065166..7b6a898b 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs @@ -56,6 +56,7 @@ namespace v2rayN.Forms //remoteDNS txtremoteDNS.Text = config.remoteDNS; + cmbdomainStrategy4Freedom.Text = config.domainStrategy4Freedom; chkdefAllowInsecure.Checked = config.defAllowInsecure; @@ -229,6 +230,7 @@ namespace v2rayN.Forms //remoteDNS config.remoteDNS = txtremoteDNS.Text.TrimEx(); + config.domainStrategy4Freedom = cmbdomainStrategy4Freedom.Text; config.defAllowInsecure = chkdefAllowInsecure.Checked; diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.resx index d4682ccc..81c054e8 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.resx @@ -146,6 +146,9 @@ tabPage7 + + tabPage2 + tabPage7 @@ -164,8 +167,8 @@ 15, 129 - - readBufferSize + + 0 @@ -174,8 +177,8 @@ chkudpEnabled - - 45 + + 100, 20 txtpass @@ -183,15 +186,15 @@ 282, 23 - - info - downlinkCapacity mtu + + 191, 12 + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -225,12 +228,18 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 223, 398 + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Log level + + 351, 157 + groupBox1 @@ -318,14 +327,14 @@ groupBox1 - - Keep older when deduplication + + UseIP txtlocalPort - - 84, 16 + + System.Windows.Forms.Label, 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 @@ -382,7 +391,7 @@ 13 - 2 + 4 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -396,6 +405,9 @@ True + + cmbCoreType4 + 11 @@ -468,8 +480,8 @@ True - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 117, 68 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -480,21 +492,21 @@ 11 + + 15, 192 + 117, 172 Use semicolon (;) - - 75, 23 + + 281, 12 tabControl1 - - tabPage2 - 12 @@ -582,8 +594,8 @@ 94, 21 - - 4 + + 13 True @@ -624,11 +636,11 @@ 7 - - $this + + NoControl - - btnSetLoopback + + tabPage2 chkEnableSecurityProtocolTls13 @@ -687,6 +699,9 @@ 120, 16 + + $this + groupBox1 @@ -702,8 +717,8 @@ 663, 37 - - label17 + + 41 97, 21 @@ -732,9 +747,6 @@ tabPageCoreType - - Do not use proxy server for addresses beginning with - tabPageCoreType @@ -771,6 +783,9 @@ groupBox1 + + 4 + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -819,6 +834,9 @@ chkmuxEnabled + + tabPageCoreType + 0 @@ -829,10 +847,10 @@ label2 - 1 + 3 - - Automatically start at system startup + + tabPageCoreType groupBox1 @@ -846,9 +864,6 @@ System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 13 - label13 @@ -882,15 +897,24 @@ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + UseIPv6 + True 7 + + 1 + Automatic update interval of subscriptions (hours) + + label19 + Custom DNS (multiple, separated by commas (,)) @@ -927,9 +951,6 @@ 41 - - 39 - 111, 24 @@ -969,8 +990,8 @@ 102, 16 - - cmbCoreType4 + + Outbound Freedom domainStrategy groupBox2 @@ -1017,6 +1038,9 @@ NoControl + + 8, 402 + 8 @@ -1083,6 +1107,9 @@ 0, 10 + + readBufferSize + NoControl @@ -1095,9 +1122,15 @@ 397, 65 + + 42 + tabPageCoreType + + tabPage2 + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1119,9 +1152,6 @@ Core Type - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - True @@ -1131,12 +1161,15 @@ 728, 427 - - labCoreType2 + + 7 8 + + Tray right-click menu servers display limit + NoControl @@ -1224,8 +1257,8 @@ 3 - - 351, 157 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 43 @@ -1356,8 +1389,8 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 15, 192 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tabPage2 @@ -1366,7 +1399,7 @@ btnClose - 638, 356 + 638, 349 chkdefAllowInsecure @@ -1407,6 +1440,9 @@ txtKcptti + + NoControl + 23, 12 @@ -1422,6 +1458,9 @@ True + + System.Windows.Forms.ComboBox, 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 @@ -1470,8 +1509,8 @@ label4 - - 29 + + Keep older when deduplication label8 @@ -1536,8 +1575,8 @@ 12 - - Tray right-click menu servers display limit + + Automatically start at system startup congestion @@ -1647,12 +1686,18 @@ txtautoUpdateInterval + + 9 + 246, 16 tabPage1 + + labCoreType2 + 2 @@ -1716,6 +1761,9 @@ 14 + + 2 + 29 @@ -1737,6 +1785,9 @@ True + + tabPageCoreType + 37 @@ -1797,21 +1848,18 @@ 40 - - 174, 16 - 224, 29 40 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 722, 421 - - 117, 68 - 4 @@ -1845,12 +1893,12 @@ 38 - - 281, 12 - NoControl + + UseIPv4 + 20, 143 @@ -1929,6 +1977,9 @@ 204, 16 + + True + True @@ -1950,6 +2001,9 @@ 45 + + label17 + 59, 12 @@ -1977,8 +2031,8 @@ debug - - 7 + + info Core: KCP settings @@ -2016,6 +2070,9 @@ 0 + + 84, 16 + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -2052,17 +2109,14 @@ 728, 427 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 638, 20 - - tabPageCoreType + + 29 True @@ -2073,17 +2127,20 @@ 11 + + 45 + cmbprotocol - - 2 + + 174, 16 System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPageCoreType + + 39 4 @@ -2100,17 +2157,17 @@ tabPage2 - - tabPageCoreType - - - NoControl + + btnSetLoopback True - - 9 + + cmbdomainStrategy4Freedom + + + Do not use proxy server for addresses beginning with 0, 0 @@ -2121,6 +2178,9 @@ NoControl + + 75, 23 + 8, 371 @@ -2139,6 +2199,9 @@ Advanced proxy settings, protocol selection (optional) + + AsIs + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -2152,7 +2215,7 @@ 1 - 0 + 2 True diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx index 04e93138..20b1d8f5 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx @@ -121,6 +121,18 @@ 取消(&C) + + 662, 469 + + + 654, 443 + + + Core:基础设置 + + + 648, 437 + 53, 12 @@ -208,14 +220,17 @@ 本地监听端口 - - 648, 437 - - + 654, 443 - - Core:基础设置 + + Core:DNS设置 + + + 223, 413 + + + 8, 417 161, 12 @@ -223,24 +238,27 @@ 支持填写DnsObject,JSON格式 + + 638, 366 + 191, 12 自定义DNS(可多个,用逗号(,)隔开) - - 654, 443 - - - Core:DNS设置 - 654, 443 Core:KCP设置 + + 654, 443 + + + v2rayN设置 + 472, 37 @@ -316,18 +334,24 @@ 开机自动启动(可能会不成功) - - 654, 443 - - - v2rayN设置 - 654, 443 Core类型设置 + + 654, 443 + + + 系统代理设置 + + + 654, 443 + + + 例外 + 173, 12 @@ -346,30 +370,15 @@ 对于下列字符开头的地址不使用代理服务器: - - 654, 443 - - - 例外 - - - 654, 443 - - - 系统代理设置 - - - 662, 469 - - - 确定(&O) - 0, 479 662, 60 + + 确定(&O) + 662, 10 diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs index f6dbccf3..54f8c725 100644 --- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs @@ -833,6 +833,14 @@ namespace v2rayN.Handler return 0; } + //Outbound Freedom domainStrategy + if (!string.IsNullOrWhiteSpace(config.domainStrategy4Freedom)) + { + var outbound = v2rayConfig.outbounds[1]; + outbound.settings.domainStrategy = config.domainStrategy4Freedom; + outbound.settings.userLevel = 0; + } + var obj = Utils.ParseJson(config.remoteDNS); if (obj != null && obj.ContainsKey("servers")) { @@ -1481,10 +1489,13 @@ namespace v2rayN.Handler msg = ResUI.FailedGenDefaultConfiguration; return ""; } - List lstIpEndPoints = null; + List lstIpEndPoints = new List(); + List lstTcpConns = new List(); try { - lstIpEndPoints = new List(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners()); + lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners()); + lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveUdpListeners()); + lstTcpConns.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections()); } catch (Exception ex) { @@ -1525,6 +1536,10 @@ namespace v2rayN.Handler { continue; } + if (lstTcpConns != null && lstTcpConns.FindIndex(_it => _it.LocalEndPoint.Port == k) >= 0) + { + continue; + } //found port = k; httpPort = port + 1; diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 8dab69c6..02d5c4ab 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -84,6 +84,14 @@ namespace v2rayN.Mode get; set; } + /// + /// Outbound Freedom domainStrategy + /// + public string domainStrategy4Freedom + { + get; set; + } + /// /// 是否允许不安全连接 /// diff --git a/v2rayN/v2rayN/Mode/V2rayConfig.cs b/v2rayN/v2rayN/Mode/V2rayConfig.cs index 1ce64c3c..8b108d5f 100644 --- a/v2rayN/v2rayN/Mode/V2rayConfig.cs +++ b/v2rayN/v2rayN/Mode/V2rayConfig.cs @@ -224,6 +224,16 @@ namespace v2rayN.Mode /// /// public Response response { get; set; } + + /// + /// + /// + public string domainStrategy { get; set; } + + /// + /// + /// + public int? userLevel { get; set; } } public class VnextItem