diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs index 7ccbdfe3..052f42fe 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs @@ -98,13 +98,14 @@ this.labCoreType1 = new System.Windows.Forms.Label(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label18 = new System.Windows.Forms.Label(); + this.cmbSystemProxyAdvancedProtocol = new System.Windows.Forms.ComboBox(); this.label13 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.txtsystemProxyExceptions = new System.Windows.Forms.TextBox(); this.panel2 = new System.Windows.Forms.Panel(); this.btnOK = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); - this.chkEnableSystemProxyAdvanced = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -581,7 +582,8 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.chkEnableSystemProxyAdvanced); + this.groupBox2.Controls.Add(this.label18); + this.groupBox2.Controls.Add(this.cmbSystemProxyAdvancedProtocol); this.groupBox2.Controls.Add(this.label13); this.groupBox2.Controls.Add(this.label12); this.groupBox2.Controls.Add(this.txtsystemProxyExceptions); @@ -589,6 +591,17 @@ this.groupBox2.Name = "groupBox2"; this.groupBox2.TabStop = false; // + // label18 + // + resources.ApplyResources(this.label18, "label18"); + this.label18.Name = "label18"; + // + // cmbSystemProxyAdvancedProtocol + // + this.cmbSystemProxyAdvancedProtocol.FormattingEnabled = true; + resources.ApplyResources(this.cmbSystemProxyAdvancedProtocol, "cmbSystemProxyAdvancedProtocol"); + this.cmbSystemProxyAdvancedProtocol.Name = "cmbSystemProxyAdvancedProtocol"; + // // label13 // resources.ApplyResources(this.label13, "label13"); @@ -623,12 +636,6 @@ resources.ApplyResources(this.panel1, "panel1"); this.panel1.Name = "panel1"; // - // chkEnableSystemProxyAdvanced - // - resources.ApplyResources(this.chkEnableSystemProxyAdvanced, "chkEnableSystemProxyAdvanced"); - this.chkEnableSystemProxyAdvanced.Name = "chkEnableSystemProxyAdvanced"; - this.chkEnableSystemProxyAdvanced.UseVisualStyleBackColor = true; - // // OptionSettingForm // resources.ApplyResources(this, "$this"); @@ -737,6 +744,7 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txttrayMenuServersLimit; private System.Windows.Forms.Label label17; - private System.Windows.Forms.CheckBox chkEnableSystemProxyAdvanced; + private System.Windows.Forms.ComboBox cmbSystemProxyAdvancedProtocol; + private System.Windows.Forms.Label label18; } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs index e9b3a19e..70ae449d 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs @@ -18,6 +18,8 @@ namespace v2rayN.Forms private void OptionSettingForm_Load(object sender, EventArgs e) { + cmbSystemProxyAdvancedProtocol.Items.AddRange(Global.IEProxyProtocols.ToArray()); + InitBase(); InitKCP(); @@ -59,7 +61,7 @@ namespace v2rayN.Forms txtsystemProxyExceptions.Text = config.systemProxyExceptions; - chkEnableSystemProxyAdvanced.Checked = config.enableSystemProxyAdvanced; + cmbSystemProxyAdvancedProtocol.Text = config.systemProxyAdvancedProtocol; } @@ -255,7 +257,7 @@ namespace v2rayN.Forms config.systemProxyExceptions = txtsystemProxyExceptions.Text.TrimEx(); - config.enableSystemProxyAdvanced = chkEnableSystemProxyAdvanced.Checked; + config.systemProxyAdvancedProtocol = cmbSystemProxyAdvancedProtocol.Text.TrimEx(); return 0; } diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.resx index 90bb3562..deaae1d2 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.resx @@ -1851,33 +1851,57 @@ 4 - + + True + + NoControl - - 8, 328 + + 8, 346 - - 502, 16 + + 329, 12 - - 43 + + 45 - - Enable system proxy advanced settings, use socks protocol + + Advanced proxy settings, protocol selection (optional) - - chkEnableSystemProxyAdvanced + + label18 - - System.Windows.Forms.CheckBox, 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 - + groupBox2 - + 0 + + 8, 371 + + + 638, 20 + + + 44 + + + cmbSystemProxyAdvancedProtocol + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 1 + True @@ -1906,7 +1930,7 @@ groupBox2 - 1 + 2 True @@ -1936,7 +1960,7 @@ groupBox2 - 2 + 3 8, 52 @@ -1963,7 +1987,7 @@ groupBox2 - 3 + 4 Fill diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx index 55784aa4..5f82648b 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx @@ -373,7 +373,7 @@ 参数设置 - - 开启系统代理高级设置, 使用socks协议 + + 高级代理设置, 协议选择(可选) \ No newline at end of file diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index c0547e46..470412ed 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -199,6 +199,13 @@ namespace v2rayN public const string StatisticLogOverall = "StatisticLogOverall.json"; 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 static readonly List IEProxyProtocols = new List { + "{ip}:{http_port}", + "socks={ip}:{socks_port}", + "http={ip}:{http_port};https={ip}:{http_port};ftp={ip}:{http_port};socks={ip}:{socks_port}", + "http=http://{ip}:{http_port};https=http://{ip}:{http_port}", + "" + }; public const string RoutingRuleComma = ""; diff --git a/v2rayN/v2rayN/Handler/SysProxyHandle.cs b/v2rayN/v2rayN/Handler/SysProxyHandle.cs index 2ade5267..815580ae 100644 --- a/v2rayN/v2rayN/Handler/SysProxyHandle.cs +++ b/v2rayN/v2rayN/Handler/SysProxyHandle.cs @@ -70,13 +70,16 @@ namespace v2rayN.Handler var strExceptions = $"{config.constItem.defIEProxyExceptions};{config.systemProxyExceptions}"; var strProxy = string.Empty; - if (config.enableSystemProxyAdvanced) + if (Utils.IsNullOrEmpty(config.systemProxyAdvancedProtocol)) { - strProxy = $"socks={Global.Loopback}:{portSocks}"; + strProxy = $"{Global.Loopback}:{port}"; } else { - strProxy = $"{Global.Loopback}:{port}"; + strProxy = config.systemProxyAdvancedProtocol + .Replace("{ip}", Global.Loopback) + .Replace("{http_port}", port.ToString()) + .Replace("{socks_port}", portSocks.ToString()); } SetIEProxy(true, strProxy, strExceptions); } diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 07f51647..4b913a89 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -124,8 +124,8 @@ namespace v2rayN.Mode { get; set; } - public bool enableSystemProxyAdvanced { get; set; } - + public string systemProxyAdvancedProtocol { get; set; } + public int autoUpdateInterval { get; set; } = 0; public int autoUpdateSubInterval { get; set; } = 0;