diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index 0bcd9fea..2af2b554 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -435,13 +435,6 @@ namespace v2rayN.Forms //qrCodeControl.showQRCode(index, config); } - private void DisplayToolStatus() - { - toolSslInboundInfo.Text = $"{Global.InboundSocks} {Global.Loopback}:{config.inbound[0].localPort} | " - + $"{ Global.InboundHttp} { Global.Loopback}:{Global.httpPort}"; - - notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon); - } private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (!Utils.IsNullOrEmpty(e.ClickedItem.Text)) @@ -1401,6 +1394,23 @@ namespace v2rayN.Forms DisplayToolStatus(); } + private void DisplayToolStatus() + { + StringBuilder sb = new StringBuilder(); + sb.Append($"{Global.InboundSocks} {Global.Loopback}:{config.GetLocalPort(Global.InboundSocks)}"); + sb.Append(" | "); + sb.Append($"{Global.InboundHttp} {Global.Loopback}:{config.GetLocalPort(Global.InboundHttp)}"); + + if (config.sysProxyType == ESysProxyType.ForcedChange) + { + sb.Append(" | "); + sb.Append($"{ResUI.SystemProxy} {Global.Loopback}:{config.GetLocalPort(Global.InboundHttp2)}"); + } + + toolSslInboundInfo.Text = sb.ToString(); + + notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon); + } #endregion diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs index cba25aca..ce14fcc0 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs @@ -33,15 +33,14 @@ this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label16 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.txtpass = new System.Windows.Forms.TextBox(); + this.txtuser = new System.Windows.Forms.TextBox(); this.chkdefAllowInsecure = new System.Windows.Forms.CheckBox(); - this.chksniffingEnabled2 = new System.Windows.Forms.CheckBox(); + this.chkAllowLANConn = new System.Windows.Forms.CheckBox(); this.chksniffingEnabled = new System.Windows.Forms.CheckBox(); this.chkmuxEnabled = new System.Windows.Forms.CheckBox(); - this.chkAllowIn2 = new System.Windows.Forms.CheckBox(); - this.chkudpEnabled2 = new System.Windows.Forms.CheckBox(); - this.cmbprotocol2 = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtlocalPort2 = new System.Windows.Forms.TextBox(); this.cmbprotocol = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.chkudpEnabled = new System.Windows.Forms.CheckBox(); @@ -79,7 +78,6 @@ this.cbFreshrate = new System.Windows.Forms.ComboBox(); this.lbFreshrate = new System.Windows.Forms.Label(); this.chkEnableStatistics = new System.Windows.Forms.CheckBox(); - this.chkAllowLANConn = new System.Windows.Forms.CheckBox(); this.chkAutoRun = new System.Windows.Forms.CheckBox(); this.tabPageCoreType = new System.Windows.Forms.TabPage(); this.cmbCoreType6 = new System.Windows.Forms.ComboBox(); @@ -143,15 +141,14 @@ // // groupBox1 // + this.groupBox1.Controls.Add(this.label16); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.txtpass); + this.groupBox1.Controls.Add(this.txtuser); this.groupBox1.Controls.Add(this.chkdefAllowInsecure); - this.groupBox1.Controls.Add(this.chksniffingEnabled2); + this.groupBox1.Controls.Add(this.chkAllowLANConn); this.groupBox1.Controls.Add(this.chksniffingEnabled); this.groupBox1.Controls.Add(this.chkmuxEnabled); - this.groupBox1.Controls.Add(this.chkAllowIn2); - this.groupBox1.Controls.Add(this.chkudpEnabled2); - this.groupBox1.Controls.Add(this.cmbprotocol2); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.txtlocalPort2); this.groupBox1.Controls.Add(this.cmbprotocol); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.chkudpEnabled); @@ -164,17 +161,37 @@ this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // + // label16 + // + resources.ApplyResources(this.label16, "label16"); + this.label16.Name = "label16"; + // + // label4 + // + resources.ApplyResources(this.label4, "label4"); + this.label4.Name = "label4"; + // + // txtpass + // + resources.ApplyResources(this.txtpass, "txtpass"); + this.txtpass.Name = "txtpass"; + // + // txtuser + // + resources.ApplyResources(this.txtuser, "txtuser"); + this.txtuser.Name = "txtuser"; + // // chkdefAllowInsecure // resources.ApplyResources(this.chkdefAllowInsecure, "chkdefAllowInsecure"); this.chkdefAllowInsecure.Name = "chkdefAllowInsecure"; this.chkdefAllowInsecure.UseVisualStyleBackColor = true; // - // chksniffingEnabled2 + // chkAllowLANConn // - resources.ApplyResources(this.chksniffingEnabled2, "chksniffingEnabled2"); - this.chksniffingEnabled2.Name = "chksniffingEnabled2"; - this.chksniffingEnabled2.UseVisualStyleBackColor = true; + resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn"); + this.chkAllowLANConn.Name = "chkAllowLANConn"; + this.chkAllowLANConn.UseVisualStyleBackColor = true; // // chksniffingEnabled // @@ -188,39 +205,6 @@ this.chkmuxEnabled.Name = "chkmuxEnabled"; this.chkmuxEnabled.UseVisualStyleBackColor = true; // - // chkAllowIn2 - // - resources.ApplyResources(this.chkAllowIn2, "chkAllowIn2"); - this.chkAllowIn2.Name = "chkAllowIn2"; - this.chkAllowIn2.UseVisualStyleBackColor = true; - this.chkAllowIn2.CheckedChanged += new System.EventHandler(this.chkAllowIn2_CheckedChanged); - // - // chkudpEnabled2 - // - resources.ApplyResources(this.chkudpEnabled2, "chkudpEnabled2"); - this.chkudpEnabled2.Name = "chkudpEnabled2"; - this.chkudpEnabled2.UseVisualStyleBackColor = true; - // - // cmbprotocol2 - // - this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbprotocol2.FormattingEnabled = true; - this.cmbprotocol2.Items.AddRange(new object[] { - resources.GetString("cmbprotocol2.Items"), - resources.GetString("cmbprotocol2.Items1")}); - resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2"); - this.cmbprotocol2.Name = "cmbprotocol2"; - // - // label3 - // - resources.ApplyResources(this.label3, "label3"); - this.label3.Name = "label3"; - // - // txtlocalPort2 - // - resources.ApplyResources(this.txtlocalPort2, "txtlocalPort2"); - this.txtlocalPort2.Name = "txtlocalPort2"; - // // cmbprotocol // this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -399,7 +383,6 @@ this.tabPage7.Controls.Add(this.cbFreshrate); this.tabPage7.Controls.Add(this.lbFreshrate); this.tabPage7.Controls.Add(this.chkEnableStatistics); - this.tabPage7.Controls.Add(this.chkAllowLANConn); this.tabPage7.Controls.Add(this.chkAutoRun); resources.ApplyResources(this.tabPage7, "tabPage7"); this.tabPage7.Name = "tabPage7"; @@ -464,12 +447,6 @@ this.chkEnableStatistics.Name = "chkEnableStatistics"; this.chkEnableStatistics.UseVisualStyleBackColor = true; // - // chkAllowLANConn - // - resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn"); - this.chkAllowLANConn.Name = "chkAllowLANConn"; - this.chkAllowLANConn.UseVisualStyleBackColor = true; - // // chkAutoRun // resources.ApplyResources(this.chkAutoRun, "chkAutoRun"); @@ -664,11 +641,6 @@ private System.Windows.Forms.Panel panel2; private System.Windows.Forms.ComboBox cmbprotocol; private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox cmbprotocol2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtlocalPort2; - private System.Windows.Forms.CheckBox chkudpEnabled2; - private System.Windows.Forms.CheckBox chkAllowIn2; private System.Windows.Forms.CheckBox chkmuxEnabled; private System.Windows.Forms.TabPage tabPage6; private System.Windows.Forms.TextBox txtKcpmtu; @@ -688,7 +660,6 @@ private System.Windows.Forms.CheckBox chkAutoRun; private System.Windows.Forms.CheckBox chkAllowLANConn; private System.Windows.Forms.CheckBox chksniffingEnabled; - private System.Windows.Forms.CheckBox chksniffingEnabled2; private System.Windows.Forms.CheckBox chkEnableStatistics; private System.Windows.Forms.ComboBox cbFreshrate; private System.Windows.Forms.Label lbFreshrate; @@ -722,5 +693,9 @@ private System.Windows.Forms.Label labCoreType3; private System.Windows.Forms.ComboBox cmbCoreType2; private System.Windows.Forms.Label labCoreType2; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtpass; + private System.Windows.Forms.TextBox txtuser; } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs index fc53d7f9..c3ec5c6b 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs @@ -46,23 +46,10 @@ namespace v2rayN.Forms cmbprotocol.Text = config.inbound[0].protocol.ToString(); chkudpEnabled.Checked = config.inbound[0].udpEnabled; chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled; + chkAllowLANConn.Checked = config.inbound[0].allowLANConn; + txtuser.Text = config.inbound[0].user; + txtpass.Text = config.inbound[0].pass; - txtlocalPort2.Text = $"{config.inbound[0].localPort + 1}"; - cmbprotocol2.Text = Global.InboundHttp; - - if (config.inbound.Count > 1) - { - txtlocalPort2.Text = config.inbound[1].localPort.ToString(); - cmbprotocol2.Text = config.inbound[1].protocol.ToString(); - chkudpEnabled2.Checked = config.inbound[1].udpEnabled; - chksniffingEnabled2.Checked = config.inbound[1].sniffingEnabled; - chkAllowIn2.Checked = true; - } - else - { - chkAllowIn2.Checked = false; - } - chkAllowIn2State(); } //remoteDNS @@ -96,7 +83,6 @@ namespace v2rayN.Forms //开机自动启动 chkAutoRun.Checked = Utils.IsAutoRun(); - chkAllowLANConn.Checked = config.allowLANConn; chkEnableStatistics.Checked = config.enableStatistics; chkKeepOlderDedupl.Checked = config.keepOlderDedupl; @@ -210,6 +196,7 @@ namespace v2rayN.Forms string protocol = cmbprotocol.Text.TrimEx(); bool udpEnabled = chkudpEnabled.Checked; bool sniffingEnabled = chksniffingEnabled.Checked; + bool allowLANConn = chkAllowLANConn.Checked; if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort)) { UI.Show(ResUI.FillLocalListeningPort); @@ -239,41 +226,16 @@ namespace v2rayN.Forms config.inbound[0].protocol = protocol; config.inbound[0].udpEnabled = udpEnabled; config.inbound[0].sniffingEnabled = sniffingEnabled; + config.inbound[0].allowLANConn = allowLANConn; + config.inbound[0].user = txtuser.Text; + config.inbound[0].pass = txtpass.Text; - //本地监听2 - string localPort2 = txtlocalPort2.Text.TrimEx(); - string protocol2 = cmbprotocol2.Text.TrimEx(); - bool udpEnabled2 = chkudpEnabled2.Checked; - bool sniffingEnabled2 = chksniffingEnabled2.Checked; - if (chkAllowIn2.Checked) + if (config.inbound.Count > 1) { - if (Utils.IsNullOrEmpty(localPort2) || !Utils.IsNumberic(localPort2)) - { - UI.Show(ResUI.FillLocalListeningPort); - return -1; - } - if (Utils.IsNullOrEmpty(protocol2)) - { - UI.Show(ResUI.PleaseSelectProtocol); - return -1; - } - if (config.inbound.Count < 2) - { - config.inbound.Add(new Mode.InItem()); - } - config.inbound[1].localPort = Utils.ToInt(localPort2); - config.inbound[1].protocol = protocol2; - config.inbound[1].udpEnabled = udpEnabled2; - config.inbound[1].sniffingEnabled = sniffingEnabled2; - } - else - { - if (config.inbound.Count > 1) - { - config.inbound.RemoveAt(1); - } + config.inbound.RemoveAt(1); } + //日志 config.logEnabled = logEnabled; config.loglevel = loglevel; @@ -336,8 +298,6 @@ namespace v2rayN.Forms //开机自动启动 Utils.SetAutoRun(chkAutoRun.Checked); - config.allowLANConn = chkAllowLANConn.Checked; - bool lastEnableStatistics = config.enableStatistics; config.enableStatistics = chkEnableStatistics.Checked; config.statisticsFreshRate = (int)cbFreshrate.SelectedValue; @@ -367,17 +327,6 @@ namespace v2rayN.Forms this.DialogResult = DialogResult.Cancel; } - private void chkAllowIn2_CheckedChanged(object sender, EventArgs e) - { - chkAllowIn2State(); - } - private void chkAllowIn2State() - { - bool blAllow2 = chkAllowIn2.Checked; - txtlocalPort2.Enabled = - cmbprotocol2.Enabled = - chkudpEnabled2.Enabled = blAllow2; - } private void linkDnsObjectDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { @@ -388,5 +337,6 @@ namespace v2rayN.Forms { Process.Start(Utils.GetPath("EnableLoopback.exe")); } + } } diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.resx index ae888117..f9f9c72d 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.resx @@ -143,10 +143,112 @@ 0 - + True + + NoControl + + + 397, 65 + + + 59, 12 + + + 39 + + + Auth pass + + + label16 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + True + + + NoControl + + + 224, 65 + + + 59, 12 + + + 38 + + + Auth user + + + label4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + 496, 61 + + + 120, 21 + + + 37 + + + txtpass + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + 285, 61 + + + 97, 21 + + + 36 + + + txtuser + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 3 + + + True + NoControl @@ -172,40 +274,34 @@ groupBox1 - 0 + 4 - + True - - NoControl + + 15, 63 - - 468, 60 + + 204, 16 - - 120, 16 + + 29 - - 32 + + Allow connections from the LAN - - Turn on Sniffing + + chkAllowLANConn - - False - - - chksniffingEnabled2 - - + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + groupBox1 - - 1 + + 5 True @@ -214,7 +310,7 @@ NoControl - 468, 27 + 496, 27 120, 16 @@ -235,7 +331,7 @@ groupBox1 - 2 + 6 True @@ -262,152 +358,8 @@ groupBox1 - 3 - - - True - - - 15, 63 - - - 120, 16 - - - 19 - - - listening port 2 - - - False - - - chkAllowIn2 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 4 - - - True - - - 369, 62 - - - 84, 16 - - - 18 - - - Enable UDP - - - False - - - chkudpEnabled2 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 5 - - - socks - - - http - - - 257, 60 - - - 97, 20 - - - 17 - - - False - - - cmbprotocol2 - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 6 - - - True - - - 206, 64 - - - 53, 12 - - - 16 - - - protocol - - - False - - - label3 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - 7 - - 124, 60 - - - 78, 21 - - - 14 - - - False - - - txtlocalPort2 - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - groupBox1 - - - 8 - False @@ -418,7 +370,7 @@ http - 257, 25 + 285, 25 97, 20 @@ -436,13 +388,13 @@ groupBox1 - 9 + 8 True - 206, 29 + 224, 29 53, 12 @@ -463,13 +415,13 @@ groupBox1 - 10 + 9 True - 369, 27 + 397, 27 84, 16 @@ -490,7 +442,7 @@ groupBox1 - 11 + 10 True @@ -517,7 +469,7 @@ groupBox1 - 12 + 11 debug @@ -553,7 +505,7 @@ groupBox1 - 13 + 12 True @@ -580,7 +532,7 @@ groupBox1 - 14 + 13 124, 25 @@ -601,7 +553,7 @@ groupBox1 - 15 + 14 True @@ -628,7 +580,7 @@ groupBox1 - 16 + 15 Fill @@ -681,6 +633,639 @@ 0 + + linkDnsObjectDoc + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage2 + + + 0 + + + txtremoteDNS + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage2 + + + 1 + + + label14 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage2 + + + 2 + + + 4, 22 + + + 728, 427 + + + 4 + + + Core: DNS settings + + + tabPage2 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl1 + + + 1 + + + chkKcpcongestion + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 0 + + + txtKcpwriteBufferSize + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 1 + + + label10 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 2 + + + txtKcpreadBufferSize + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 3 + + + label11 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 4 + + + txtKcpdownlinkCapacity + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 5 + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 6 + + + txtKcpuplinkCapacity + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 7 + + + label9 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 8 + + + txtKcptti + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 9 + + + label7 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 10 + + + txtKcpmtu + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 11 + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage6 + + + 12 + + + 4, 22 + + + 3, 3, 3, 3 + + + 728, 427 + + + 2 + + + Core: KCP settings + + + tabPage6 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl1 + + + 2 + + + chkEnableSecurityProtocolTls13 + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 0 + + + chkEnableAutoAdjustMainLvColWidth + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 1 + + + btnSetLoopback + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 2 + + + txtautoUpdateInterval + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 3 + + + label15 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 4 + + + chkIgnoreGeoUpdateCore + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 5 + + + chkKeepOlderDedupl + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 6 + + + cbFreshrate + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 7 + + + lbFreshrate + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 8 + + + chkEnableStatistics + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 9 + + + chkAutoRun + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage7 + + + 10 + + + 4, 22 + + + 3, 3, 3, 3 + + + 728, 427 + + + 3 + + + v2rayN settings + + + tabPage7 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl1 + + + 3 + + + cmbCoreType6 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 0 + + + labCoreType6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 1 + + + cmbCoreType5 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 2 + + + labCoreType5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 3 + + + cmbCoreType4 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 4 + + + labCoreType4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 5 + + + cmbCoreType3 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 6 + + + labCoreType3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 7 + + + cmbCoreType2 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 8 + + + labCoreType2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 9 + + + cmbCoreType1 + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 10 + + + labCoreType1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPageCoreType + + + 11 + + + 4, 22 + + + 3, 3, 3, 3 + + + 728, 427 + + + 6 + + + CoreType settings + + + tabPageCoreType + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl1 + + + 4 + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage3 + + + 0 + + + 4, 22 + + + 728, 427 + + + 5 + + + System proxy settings + + + tabPage3 + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabControl1 + + + 5 + + + Fill + + + 0, 10 + + + 736, 453 + + + 10 + + + tabControl1 + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + True @@ -771,30 +1356,6 @@ 2 - - 4, 22 - - - 728, 427 - - - 4 - - - Core: DNS settings - - - tabPage2 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl1 - - - 1 - True @@ -1110,35 +1671,8 @@ 12 - - 4, 22 - - - 3, 3, 3, 3 - - - 728, 427 - - - 2 - - - Core: KCP settings - - - tabPage6 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl1 - - - 2 - - 15, 211 + 15, 187 506, 16 @@ -1168,7 +1702,7 @@ NoControl - 15, 189 + 15, 165 390, 16 @@ -1219,7 +1753,7 @@ 2 - 325, 156 + 325, 132 97, 21 @@ -1246,7 +1780,7 @@ NoControl - 30, 162 + 30, 138 239, 12 @@ -1276,7 +1810,7 @@ NoControl - 15, 132 + 15, 108 234, 16 @@ -1306,7 +1840,7 @@ NoControl - 15, 108 + 15, 84 198, 16 @@ -1330,7 +1864,7 @@ 6 - 161, 84 + 161, 60 58, 20 @@ -1357,7 +1891,7 @@ NoControl - 30, 88 + 30, 64 125, 12 @@ -1387,7 +1921,7 @@ NoControl - 15, 64 + 15, 40 576, 16 @@ -1410,33 +1944,6 @@ 9 - - True - - - 15, 40 - - - 204, 16 - - - 29 - - - Allow connections from the LAN - - - chkAllowLANConn - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage7 - - - 10 - True @@ -1462,34 +1969,7 @@ tabPage7 - 11 - - - 4, 22 - - - 3, 3, 3, 3 - - - 728, 427 - - - 3 - - - v2rayN settings - - - tabPage7 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl1 - - - 3 + 10 117, 172 @@ -1797,32 +2277,68 @@ 11 - - 4, 22 + + label13 - - 3, 3, 3, 3 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + groupBox2 + + + 0 + + + label12 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 1 + + + txtsystemProxyExceptions + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox2 + + + 2 + + + Fill + + + 0, 0 + + 728, 427 - - 6 + + 42 - - CoreType settings + + Exception - - tabPageCoreType + + groupBox2 - - System.Windows.Forms.TabPage, 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 - - tabControl1 + + tabPage3 - - 4 + + 0 True @@ -1911,93 +2427,6 @@ 2 - - Fill - - - 0, 0 - - - 728, 427 - - - 42 - - - Exception - - - groupBox2 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage3 - - - 0 - - - 4, 22 - - - 728, 427 - - - 5 - - - System proxy settings - - - tabPage3 - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabControl1 - - - 5 - - - Fill - - - 0, 10 - - - 736, 453 - - - 10 - - - tabControl1 - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - - - 267, 16 - - - 75, 23 - - - 8 - - - &OK - btnOK @@ -2034,6 +2463,30 @@ 1 + + 267, 16 + + + 75, 23 + + + 8 + + + &OK + + + btnOK + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 1 + Top diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx index 2d09cab8..e2b9ac60 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx @@ -121,48 +121,96 @@ 取消(&C) + + 53, 12 + + + 认证密码 + + + 219, 65 + + + 65, 12 + + + 认证用户名 + + + 15, 208 + 324, 16 传输层安全选tls时,默认跳过证书验证(allowInsecure) + + 468, 117 + 96, 16 开启流量探测 + + 144, 16 + + + 允许来自局域网的连接 + 96, 16 开启流量探测 + + 15, 145 + 114, 16 开启Mux多路复用 + + 15, 120 + 102, 16 本地监听端口2 + + 369, 119 + 66, 16 开启UDP + + 257, 117 + + + 206, 121 + 29, 12 协议 + + 124, 117 + + + 219, 29 + 29, 12 @@ -175,12 +223,21 @@ 开启UDP + + 15, 176 + 156, 16 记录本地日志(默认关闭) + + 257, 174 + + + 193, 178 + 53, 12 @@ -253,12 +310,6 @@ 更新Core时忽略Geo文件 - - 53, 12 - - - Core类型 - 156, 16 @@ -277,12 +328,6 @@ 启用统计(实时网速显示和使用流量显示,需要重启v2rayN客户端) - - 144, 16 - - - 允许来自局域网的连接 - 180, 16 @@ -295,6 +340,12 @@ v2rayN设置 + + 654, 443 + + + Core类型设置 + 95, 12 @@ -328,13 +379,16 @@ 0, 479 + + 662, 60 + + + 662, 10 + 662, 539 参数设置 - - Core类型设置 - \ No newline at end of file diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 710649d8..ea3e6803 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -111,6 +111,7 @@ namespace v2rayN public const string InboundSocks = "socks"; public const string InboundHttp = "http"; + public const string InboundHttp2 = "http2"; public const string Loopback = "127.0.0.1"; public const string InboundAPITagName = "api"; public const string InboundAPIProtocal = "dokodemo-door"; @@ -219,31 +220,6 @@ namespace v2rayN get; set; } - /// - /// 是否开启全局代理(http) - /// - public static bool sysAgent - { - get; set; - } - - /// - /// socks端口 - /// - public static int socksPort - { - get; set; - } - - /// - /// http端口 - /// - public static int httpPort - { - get; set; - } - - /// /// /// diff --git a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs index 1b299216..c1ea28cf 100644 --- a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs +++ b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs @@ -169,7 +169,7 @@ namespace v2rayN.Handler { try { - int httpPort = _config.GetLocalPort(Global.InboundHttp); + int httpPort = _config.GetLocalPort(Global.InboundHttp2); Task t = Task.Run(() => { diff --git a/v2rayN/v2rayN/Handler/SysProxyHandle.cs b/v2rayN/v2rayN/Handler/SysProxyHandle.cs index 0dc19e72..326b2f78 100644 --- a/v2rayN/v2rayN/Handler/SysProxyHandle.cs +++ b/v2rayN/v2rayN/Handler/SysProxyHandle.cs @@ -59,8 +59,7 @@ namespace v2rayN.Handler try { - Global.httpPort = config.GetLocalPort(Global.InboundHttp); - int port = Global.httpPort; + int port = config.GetLocalPort(Global.InboundHttp2); if (port <= 0) { return false; diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 894a6acf..8e318d04 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -232,7 +232,7 @@ namespace v2rayN.Handler _updateFunc(false, args.GetException().Message); }; - WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp)) : null; + WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp2)) : null; downloadHandle3.WebDownloadString(url, webProxy, userAgent); _updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}"); @@ -304,7 +304,7 @@ namespace v2rayN.Handler }; if (httpProxyTest() > 0) { - int httpPort = _config.GetLocalPort(Global.InboundHttp); + int httpPort = _config.GetLocalPort(Global.InboundHttp2); WebProxy webProxy = new WebProxy(Global.Loopback, httpPort); webRequestHandler.Proxy = webProxy; } @@ -460,7 +460,7 @@ namespace v2rayN.Handler { if (httpProxyTest() > 0) { - int httpPort = _config.GetLocalPort(Global.InboundHttp); + int httpPort = _config.GetLocalPort(Global.InboundHttp2); WebProxy webProxy = new WebProxy(Global.Loopback, httpPort); downloadHandle.DownloadFileAsync(url, webProxy, 600); } diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs index ca31c4ec..74610cf3 100644 --- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs @@ -150,7 +150,7 @@ namespace v2rayN.Handler inbound.tag = Global.InboundSocks; inbound.port = config.inbound[0].localPort; inbound.protocol = config.inbound[0].protocol; - if (config.allowLANConn) + if (config.inbound[0].allowLANConn) { inbound.listen = "0.0.0.0"; } @@ -170,6 +170,24 @@ namespace v2rayN.Handler inbound2.listen = inbound.listen; inbound2.settings.allowTransparent = false; inbound2.sniffing.enabled = inbound.sniffing.enabled; + + //auth + if (!Utils.IsNullOrEmpty(config.inbound[0].user) && !Utils.IsNullOrEmpty(config.inbound[0].pass)) + { + inbound.settings.auth = "password"; + inbound.settings.accounts = new List { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } }; + inbound2.settings.auth = "password"; + inbound2.settings.accounts = new List { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } }; + } + + //http Loopback + Inbounds inbound3 = v2rayConfig.inbounds[2]; + inbound3.tag = Global.InboundHttp2; + inbound3.port = config.GetLocalPort(Global.InboundHttp2); + inbound3.protocol = Global.InboundHttp; + inbound3.listen = Global.Loopback; + inbound3.settings.allowTransparent = false; + inbound3.sniffing.enabled = inbound.sniffing.enabled; } catch { diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 596f96b9..40236fcf 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -52,14 +52,6 @@ namespace v2rayN.Mode get; set; } - /// - /// 允许来自局域网的连接 - /// - public bool allowLANConn - { - get; set; - } - /// /// 启用实时网速和流量统计 /// @@ -220,7 +212,10 @@ namespace v2rayN.Mode { return GetLocalPort(Global.InboundSocks) + 1; } - + else if (protocol == Global.InboundHttp2) + { + return GetLocalPort(Global.InboundSocks) + 2; + } else if (protocol == "speedtest") { return GetLocalPort(Global.InboundSocks) + 103; @@ -581,6 +576,13 @@ namespace v2rayN.Mode /// 开启流量探测 /// public bool sniffingEnabled { get; set; } = true; + + public bool allowLANConn { get; set; } + + public string user { get; set; } + + public string pass { get; set; } + } [Serializable] diff --git a/v2rayN/v2rayN/Mode/V2rayConfig.cs b/v2rayN/v2rayN/Mode/V2rayConfig.cs index 4703ec21..1ce64c3c 100644 --- a/v2rayN/v2rayN/Mode/V2rayConfig.cs +++ b/v2rayN/v2rayN/Mode/V2rayConfig.cs @@ -141,6 +141,7 @@ namespace v2rayN.Mode public bool allowTransparent { get; set; } + public List accounts { get; set; } } public class UsersItem @@ -540,4 +541,15 @@ namespace v2rayN.Mode public bool multiMode { get; set; } } + public class AccountsItem + { + /// + /// + /// + public string user { get; set; } + /// + /// + /// + public string pass { get; set; } + } } diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index e202e71b..21b9cfe5 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -934,6 +934,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 System proxy 的本地化字符串。 + /// + internal static string SystemProxy { + get { + return ResourceManager.GetString("SystemProxy", resourceCulture); + } + } + /// /// 查找类似 The ping of current service: {0} 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index 6077e7eb..66b70aee 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -454,4 +454,7 @@ Please browse to import server configuration + + System proxy + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index 6ad22fc8..80229395 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -454,4 +454,7 @@ 请浏览导入服务器配置 + + 系统代理 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Sample/SampleClientConfig.txt b/v2rayN/v2rayN/Sample/SampleClientConfig.txt index 0d2b2537..a33d9bd6 100644 --- a/v2rayN/v2rayN/Sample/SampleClientConfig.txt +++ b/v2rayN/v2rayN/Sample/SampleClientConfig.txt @@ -24,7 +24,23 @@ { "tag": "tag2", "port": 10809, - "protocol": "socks", + "protocol": "http", + "listen": "127.0.0.1", + "settings": { + "allowTransparent": false + }, + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ] + } + }, + { + "tag": "tag3", + "port": 10809, + "protocol": "http", "listen": "127.0.0.1", "settings": { "allowTransparent": false