添加端口转发功能

This commit is contained in:
2812555492@qq.com 2022-07-03 17:38:45 +08:00
parent 069d47f01b
commit 9284381798
8 changed files with 2932 additions and 1909 deletions

View file

@ -103,6 +103,22 @@
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.txtsystemProxyExceptions = new System.Windows.Forms.TextBox(); this.txtsystemProxyExceptions = new System.Windows.Forms.TextBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.portForwardingNetworkLabel = new System.Windows.Forms.Label();
this.portForwardingNetworkComboBox = new System.Windows.Forms.ComboBox();
this.portForwardingDstPortLabel = new System.Windows.Forms.Label();
this.portForwardingDstPortTextBox = new System.Windows.Forms.TextBox();
this.portForwardingDstHostLabel = new System.Windows.Forms.Label();
this.portForwardingLocalPortLabel = new System.Windows.Forms.Label();
this.portForwardingLocalIpLabel = new System.Windows.Forms.Label();
this.portForwardingTagLabel = new System.Windows.Forms.Label();
this.portForwardingRemoveButton = new System.Windows.Forms.Button();
this.portForwardingAddButton = new System.Windows.Forms.Button();
this.portForwardingDstHostTextBox = new System.Windows.Forms.TextBox();
this.portForwardingLocalPortTextBox = new System.Windows.Forms.TextBox();
this.portForwardingLocalIpTextBox = new System.Windows.Forms.TextBox();
this.portForwardingTagTextBox = new System.Windows.Forms.TextBox();
this.tsbPortForwardingCheckListBox = new System.Windows.Forms.CheckedListBox();
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
@ -116,39 +132,40 @@
this.tabPageCoreType.SuspendLayout(); this.tabPageCoreType.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.tabPage4.SuspendLayout();
this.panel2.SuspendLayout(); this.panel2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnClose // btnClose
// //
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// //
// tabControl1 // tabControl1
// //
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage6); this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Controls.Add(this.tabPage7); this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.Controls.Add(this.tabPageCoreType); this.tabControl1.Controls.Add(this.tabPageCoreType);
this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
// //
// tabPage1 // tabPage1
// //
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Controls.Add(this.groupBox1);
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// groupBox1 // groupBox1
// //
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.label16); this.groupBox1.Controls.Add(this.label16);
this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.txtpass); this.groupBox1.Controls.Add(this.txtpass);
@ -165,6 +182,7 @@
this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.txtlocalPort); this.groupBox1.Controls.Add(this.txtlocalPort);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label2);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
@ -214,8 +232,8 @@
// //
// cmbprotocol // cmbprotocol
// //
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.FormattingEnabled = true; this.cmbprotocol.FormattingEnabled = true;
this.cmbprotocol.Items.AddRange(new object[] { this.cmbprotocol.Items.AddRange(new object[] {
resources.GetString("cmbprotocol.Items"), resources.GetString("cmbprotocol.Items"),
@ -241,7 +259,6 @@
// //
// cmbloglevel // cmbloglevel
// //
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbloglevel.FormattingEnabled = true; this.cmbloglevel.FormattingEnabled = true;
this.cmbloglevel.Items.AddRange(new object[] { this.cmbloglevel.Items.AddRange(new object[] {
@ -250,6 +267,7 @@
resources.GetString("cmbloglevel.Items2"), resources.GetString("cmbloglevel.Items2"),
resources.GetString("cmbloglevel.Items3"), resources.GetString("cmbloglevel.Items3"),
resources.GetString("cmbloglevel.Items4")}); resources.GetString("cmbloglevel.Items4")});
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.Name = "cmbloglevel"; this.cmbloglevel.Name = "cmbloglevel";
// //
// label5 // label5
@ -269,10 +287,10 @@
// //
// tabPage2 // tabPage2
// //
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Controls.Add(this.linkDnsObjectDoc); this.tabPage2.Controls.Add(this.linkDnsObjectDoc);
this.tabPage2.Controls.Add(this.txtremoteDNS); this.tabPage2.Controls.Add(this.txtremoteDNS);
this.tabPage2.Controls.Add(this.label14); this.tabPage2.Controls.Add(this.label14);
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
@ -295,7 +313,6 @@
// //
// tabPage6 // tabPage6
// //
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Controls.Add(this.chkKcpcongestion); this.tabPage6.Controls.Add(this.chkKcpcongestion);
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize); this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
this.tabPage6.Controls.Add(this.label10); this.tabPage6.Controls.Add(this.label10);
@ -309,6 +326,7 @@
this.tabPage6.Controls.Add(this.label7); this.tabPage6.Controls.Add(this.label7);
this.tabPage6.Controls.Add(this.txtKcpmtu); this.tabPage6.Controls.Add(this.txtKcpmtu);
this.tabPage6.Controls.Add(this.label6); this.tabPage6.Controls.Add(this.label6);
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Name = "tabPage6"; this.tabPage6.Name = "tabPage6";
this.tabPage6.UseVisualStyleBackColor = true; this.tabPage6.UseVisualStyleBackColor = true;
// //
@ -380,7 +398,6 @@
// //
// tabPage7 // tabPage7
// //
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Controls.Add(this.numStatisticsFreshRate); this.tabPage7.Controls.Add(this.numStatisticsFreshRate);
this.tabPage7.Controls.Add(this.txttrayMenuServersLimit); this.tabPage7.Controls.Add(this.txttrayMenuServersLimit);
this.tabPage7.Controls.Add(this.label17); this.tabPage7.Controls.Add(this.label17);
@ -396,6 +413,7 @@
this.tabPage7.Controls.Add(this.lbFreshrate); this.tabPage7.Controls.Add(this.lbFreshrate);
this.tabPage7.Controls.Add(this.chkEnableStatistics); this.tabPage7.Controls.Add(this.chkEnableStatistics);
this.tabPage7.Controls.Add(this.chkAutoRun); this.tabPage7.Controls.Add(this.chkAutoRun);
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Name = "tabPage7"; this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true; this.tabPage7.UseVisualStyleBackColor = true;
// //
@ -484,7 +502,6 @@
// //
// tabPageCoreType // tabPageCoreType
// //
resources.ApplyResources(this.tabPageCoreType, "tabPageCoreType");
this.tabPageCoreType.Controls.Add(this.cmbCoreType6); this.tabPageCoreType.Controls.Add(this.cmbCoreType6);
this.tabPageCoreType.Controls.Add(this.labCoreType6); this.tabPageCoreType.Controls.Add(this.labCoreType6);
this.tabPageCoreType.Controls.Add(this.cmbCoreType5); this.tabPageCoreType.Controls.Add(this.cmbCoreType5);
@ -497,14 +514,15 @@
this.tabPageCoreType.Controls.Add(this.labCoreType2); this.tabPageCoreType.Controls.Add(this.labCoreType2);
this.tabPageCoreType.Controls.Add(this.cmbCoreType1); this.tabPageCoreType.Controls.Add(this.cmbCoreType1);
this.tabPageCoreType.Controls.Add(this.labCoreType1); this.tabPageCoreType.Controls.Add(this.labCoreType1);
resources.ApplyResources(this.tabPageCoreType, "tabPageCoreType");
this.tabPageCoreType.Name = "tabPageCoreType"; this.tabPageCoreType.Name = "tabPageCoreType";
this.tabPageCoreType.UseVisualStyleBackColor = true; this.tabPageCoreType.UseVisualStyleBackColor = true;
// //
// cmbCoreType6 // cmbCoreType6
// //
resources.ApplyResources(this.cmbCoreType6, "cmbCoreType6");
this.cmbCoreType6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType6.FormattingEnabled = true; this.cmbCoreType6.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType6, "cmbCoreType6");
this.cmbCoreType6.Name = "cmbCoreType6"; this.cmbCoreType6.Name = "cmbCoreType6";
// //
// labCoreType6 // labCoreType6
@ -514,9 +532,9 @@
// //
// cmbCoreType5 // cmbCoreType5
// //
resources.ApplyResources(this.cmbCoreType5, "cmbCoreType5");
this.cmbCoreType5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType5.FormattingEnabled = true; this.cmbCoreType5.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType5, "cmbCoreType5");
this.cmbCoreType5.Name = "cmbCoreType5"; this.cmbCoreType5.Name = "cmbCoreType5";
// //
// labCoreType5 // labCoreType5
@ -526,9 +544,9 @@
// //
// cmbCoreType4 // cmbCoreType4
// //
resources.ApplyResources(this.cmbCoreType4, "cmbCoreType4");
this.cmbCoreType4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType4.FormattingEnabled = true; this.cmbCoreType4.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType4, "cmbCoreType4");
this.cmbCoreType4.Name = "cmbCoreType4"; this.cmbCoreType4.Name = "cmbCoreType4";
// //
// labCoreType4 // labCoreType4
@ -538,9 +556,9 @@
// //
// cmbCoreType3 // cmbCoreType3
// //
resources.ApplyResources(this.cmbCoreType3, "cmbCoreType3");
this.cmbCoreType3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType3.FormattingEnabled = true; this.cmbCoreType3.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType3, "cmbCoreType3");
this.cmbCoreType3.Name = "cmbCoreType3"; this.cmbCoreType3.Name = "cmbCoreType3";
// //
// labCoreType3 // labCoreType3
@ -550,9 +568,9 @@
// //
// cmbCoreType2 // cmbCoreType2
// //
resources.ApplyResources(this.cmbCoreType2, "cmbCoreType2");
this.cmbCoreType2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType2.FormattingEnabled = true; this.cmbCoreType2.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType2, "cmbCoreType2");
this.cmbCoreType2.Name = "cmbCoreType2"; this.cmbCoreType2.Name = "cmbCoreType2";
// //
// labCoreType2 // labCoreType2
@ -562,9 +580,9 @@
// //
// cmbCoreType1 // cmbCoreType1
// //
resources.ApplyResources(this.cmbCoreType1, "cmbCoreType1");
this.cmbCoreType1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbCoreType1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType1.FormattingEnabled = true; this.cmbCoreType1.FormattingEnabled = true;
resources.ApplyResources(this.cmbCoreType1, "cmbCoreType1");
this.cmbCoreType1.Name = "cmbCoreType1"; this.cmbCoreType1.Name = "cmbCoreType1";
// //
// labCoreType1 // labCoreType1
@ -574,19 +592,19 @@
// //
// tabPage3 // tabPage3
// //
resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Controls.Add(this.groupBox2); this.tabPage3.Controls.Add(this.groupBox2);
resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// groupBox2 // groupBox2
// //
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.label18); this.groupBox2.Controls.Add(this.label18);
this.groupBox2.Controls.Add(this.cmbSystemProxyAdvancedProtocol); this.groupBox2.Controls.Add(this.cmbSystemProxyAdvancedProtocol);
this.groupBox2.Controls.Add(this.label13); this.groupBox2.Controls.Add(this.label13);
this.groupBox2.Controls.Add(this.label12); this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.txtsystemProxyExceptions); this.groupBox2.Controls.Add(this.txtsystemProxyExceptions);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
// //
@ -597,8 +615,8 @@
// //
// cmbSystemProxyAdvancedProtocol // cmbSystemProxyAdvancedProtocol
// //
resources.ApplyResources(this.cmbSystemProxyAdvancedProtocol, "cmbSystemProxyAdvancedProtocol");
this.cmbSystemProxyAdvancedProtocol.FormattingEnabled = true; this.cmbSystemProxyAdvancedProtocol.FormattingEnabled = true;
resources.ApplyResources(this.cmbSystemProxyAdvancedProtocol, "cmbSystemProxyAdvancedProtocol");
this.cmbSystemProxyAdvancedProtocol.Name = "cmbSystemProxyAdvancedProtocol"; this.cmbSystemProxyAdvancedProtocol.Name = "cmbSystemProxyAdvancedProtocol";
// //
// label13 // label13
@ -616,11 +634,119 @@
resources.ApplyResources(this.txtsystemProxyExceptions, "txtsystemProxyExceptions"); resources.ApplyResources(this.txtsystemProxyExceptions, "txtsystemProxyExceptions");
this.txtsystemProxyExceptions.Name = "txtsystemProxyExceptions"; this.txtsystemProxyExceptions.Name = "txtsystemProxyExceptions";
// //
// tabPage4
//
this.tabPage4.Controls.Add(this.portForwardingNetworkLabel);
this.tabPage4.Controls.Add(this.portForwardingNetworkComboBox);
this.tabPage4.Controls.Add(this.portForwardingDstPortLabel);
this.tabPage4.Controls.Add(this.portForwardingDstPortTextBox);
this.tabPage4.Controls.Add(this.portForwardingDstHostLabel);
this.tabPage4.Controls.Add(this.portForwardingLocalPortLabel);
this.tabPage4.Controls.Add(this.portForwardingLocalIpLabel);
this.tabPage4.Controls.Add(this.portForwardingTagLabel);
this.tabPage4.Controls.Add(this.portForwardingRemoveButton);
this.tabPage4.Controls.Add(this.portForwardingAddButton);
this.tabPage4.Controls.Add(this.portForwardingDstHostTextBox);
this.tabPage4.Controls.Add(this.portForwardingLocalPortTextBox);
this.tabPage4.Controls.Add(this.portForwardingLocalIpTextBox);
this.tabPage4.Controls.Add(this.portForwardingTagTextBox);
this.tabPage4.Controls.Add(this.tsbPortForwardingCheckListBox);
resources.ApplyResources(this.tabPage4, "tabPage4");
this.tabPage4.Name = "tabPage4";
this.tabPage4.UseVisualStyleBackColor = true;
//
// portForwardingNetworkLabel
//
resources.ApplyResources(this.portForwardingNetworkLabel, "portForwardingNetworkLabel");
this.portForwardingNetworkLabel.Name = "portForwardingNetworkLabel";
//
// portForwardingNetworkComboBox
//
this.portForwardingNetworkComboBox.FormattingEnabled = true;
this.portForwardingNetworkComboBox.Items.AddRange(new object[] {
resources.GetString("portForwardingNetworkComboBox.Items"),
resources.GetString("portForwardingNetworkComboBox.Items1"),
resources.GetString("portForwardingNetworkComboBox.Items2")});
resources.ApplyResources(this.portForwardingNetworkComboBox, "portForwardingNetworkComboBox");
this.portForwardingNetworkComboBox.Name = "portForwardingNetworkComboBox";
//
// portForwardingDstPortLabel
//
resources.ApplyResources(this.portForwardingDstPortLabel, "portForwardingDstPortLabel");
this.portForwardingDstPortLabel.Name = "portForwardingDstPortLabel";
//
// portForwardingDstPortTextBox
//
resources.ApplyResources(this.portForwardingDstPortTextBox, "portForwardingDstPortTextBox");
this.portForwardingDstPortTextBox.Name = "portForwardingDstPortTextBox";
//
// portForwardingDstHostLabel
//
resources.ApplyResources(this.portForwardingDstHostLabel, "portForwardingDstHostLabel");
this.portForwardingDstHostLabel.Name = "portForwardingDstHostLabel";
//
// portForwardingLocalPortLabel
//
resources.ApplyResources(this.portForwardingLocalPortLabel, "portForwardingLocalPortLabel");
this.portForwardingLocalPortLabel.Name = "portForwardingLocalPortLabel";
//
// portForwardingLocalIpLabel
//
resources.ApplyResources(this.portForwardingLocalIpLabel, "portForwardingLocalIpLabel");
this.portForwardingLocalIpLabel.Name = "portForwardingLocalIpLabel";
//
// portForwardingTagLabel
//
resources.ApplyResources(this.portForwardingTagLabel, "portForwardingTagLabel");
this.portForwardingTagLabel.Name = "portForwardingTagLabel";
//
// portForwardingRemoveButton
//
resources.ApplyResources(this.portForwardingRemoveButton, "portForwardingRemoveButton");
this.portForwardingRemoveButton.Name = "portForwardingRemoveButton";
this.portForwardingRemoveButton.UseVisualStyleBackColor = true;
this.portForwardingRemoveButton.Click += new System.EventHandler(this.portForwardingRemoveButton_Click);
//
// portForwardingAddButton
//
resources.ApplyResources(this.portForwardingAddButton, "portForwardingAddButton");
this.portForwardingAddButton.Name = "portForwardingAddButton";
this.portForwardingAddButton.UseVisualStyleBackColor = true;
this.portForwardingAddButton.Click += new System.EventHandler(this.portForwardingAddButton_Click);
//
// portForwardingDstHostTextBox
//
resources.ApplyResources(this.portForwardingDstHostTextBox, "portForwardingDstHostTextBox");
this.portForwardingDstHostTextBox.Name = "portForwardingDstHostTextBox";
//
// portForwardingLocalPortTextBox
//
resources.ApplyResources(this.portForwardingLocalPortTextBox, "portForwardingLocalPortTextBox");
this.portForwardingLocalPortTextBox.Name = "portForwardingLocalPortTextBox";
//
// portForwardingLocalIpTextBox
//
resources.ApplyResources(this.portForwardingLocalIpTextBox, "portForwardingLocalIpTextBox");
this.portForwardingLocalIpTextBox.Name = "portForwardingLocalIpTextBox";
//
// portForwardingTagTextBox
//
resources.ApplyResources(this.portForwardingTagTextBox, "portForwardingTagTextBox");
this.portForwardingTagTextBox.Name = "portForwardingTagTextBox";
//
// tsbPortForwardingCheckListBox
//
this.tsbPortForwardingCheckListBox.FormattingEnabled = true;
resources.ApplyResources(this.tsbPortForwardingCheckListBox, "tsbPortForwardingCheckListBox");
this.tsbPortForwardingCheckListBox.Name = "tsbPortForwardingCheckListBox";
this.tsbPortForwardingCheckListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.tsbPortForwardingCheckListBox_ItemChecked);
this.tsbPortForwardingCheckListBox.SelectedIndexChanged += new System.EventHandler(this.tsbPortForwardingCheckListBox_SelectedIndexChanged);
//
// panel2 // panel2
// //
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.btnClose); this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK); this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
// //
// btnOK // btnOK
@ -662,6 +788,8 @@
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.panel2.ResumeLayout(false); this.panel2.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
@ -746,5 +874,21 @@
private System.Windows.Forms.ComboBox cmbSystemProxyAdvancedProtocol; private System.Windows.Forms.ComboBox cmbSystemProxyAdvancedProtocol;
private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label18;
private System.Windows.Forms.NumericUpDown numStatisticsFreshRate; private System.Windows.Forms.NumericUpDown numStatisticsFreshRate;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.CheckedListBox tsbPortForwardingCheckListBox;
private System.Windows.Forms.TextBox portForwardingDstHostTextBox;
private System.Windows.Forms.TextBox portForwardingLocalPortTextBox;
private System.Windows.Forms.TextBox portForwardingLocalIpTextBox;
private System.Windows.Forms.TextBox portForwardingTagTextBox;
private System.Windows.Forms.Label portForwardingTagLabel;
private System.Windows.Forms.Button portForwardingRemoveButton;
private System.Windows.Forms.Button portForwardingAddButton;
private System.Windows.Forms.Label portForwardingDstPortLabel;
private System.Windows.Forms.TextBox portForwardingDstPortTextBox;
private System.Windows.Forms.Label portForwardingDstHostLabel;
private System.Windows.Forms.Label portForwardingLocalPortLabel;
private System.Windows.Forms.Label portForwardingLocalIpLabel;
private System.Windows.Forms.Label portForwardingNetworkLabel;
private System.Windows.Forms.ComboBox portForwardingNetworkComboBox;
} }
} }

View file

@ -27,6 +27,10 @@ namespace v2rayN.Forms
InitGUI(); InitGUI();
InitCoreType(); InitCoreType();
InitPortForwardingCheckListBox();
InitPortForwardingParamGUI(0);
} }
/// <summary> /// <summary>
@ -327,5 +331,92 @@ namespace v2rayN.Forms
Process.Start(Utils.GetPath("EnableLoopback.exe")); Process.Start(Utils.GetPath("EnableLoopback.exe"));
} }
private void InitPortForwardingCheckListBox()
{
for (int i = 0; i < config.portForwarding.Count; i++)
{
tsbPortForwardingCheckListBox.Items.Add(config.portForwarding[i].tag);
tsbPortForwardingCheckListBox.SetItemChecked(i, Boolean.Equals(config.portForwarding[i].enable, true));
}
}
private void InitPortForwardingParamGUI(int index)
{
if (index >= 0 && index < config.portForwarding.Count)
{
var item = config.portForwarding[index];
portForwardingTagTextBox.Text = item.tag;
portForwardingLocalIpTextBox.Text = item.localIp;
portForwardingLocalPortTextBox.Text = item.localPort.ToString();
portForwardingDstHostTextBox.Text = item.dstHost;
portForwardingDstPortTextBox.Text = item.dstPort.ToString();
portForwardingNetworkComboBox.Text = item.network;
}
}
private void SyncPortForwardingConfig(int index)
{
var item = new PortForwardingItem()
{
tag = portForwardingTagTextBox.Text,
localIp = portForwardingLocalIpTextBox.Text,
localPort = Convert.ToInt32(portForwardingLocalPortTextBox.Text),
dstHost = portForwardingDstHostTextBox.Text,
dstPort = Convert.ToInt32(portForwardingDstPortTextBox.Text),
network = portForwardingNetworkComboBox.Text,
enable = tsbPortForwardingCheckListBox.GetItemChecked(index),
};
if (index >= 0 && index < config.portForwarding.Count)
{
config.portForwarding[index] = item;
} else
{
config.portForwarding.Add(item);
}
}
private void portForwardingAddButton_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(portForwardingTagTextBox.Text))
{
return;
}
var index = tsbPortForwardingCheckListBox.Items.IndexOf(portForwardingTagTextBox.Text);
if (index == -1)
{
tsbPortForwardingCheckListBox.Items.Add(portForwardingTagTextBox.Text);
SyncPortForwardingConfig(tsbPortForwardingCheckListBox.Items.Count - 1);
tsbPortForwardingCheckListBox.SetItemChecked(tsbPortForwardingCheckListBox.Items.Count - 1, true);
tsbPortForwardingCheckListBox.SelectedIndex = tsbPortForwardingCheckListBox.Items.Count - 1;
}
else if (index != -1 && tsbPortForwardingCheckListBox.SelectedIndex == index)
{
SyncPortForwardingConfig(index);
}
else if (index != -1 && tsbPortForwardingCheckListBox.SelectedIndex != index)
{
tsbPortForwardingCheckListBox.SelectedIndex = index;
}
}
private void portForwardingRemoveButton_Click(object sender, EventArgs e)
{
if (tsbPortForwardingCheckListBox.SelectedIndex > -1)
{
config.portForwarding.RemoveAt(tsbPortForwardingCheckListBox.SelectedIndex);
tsbPortForwardingCheckListBox.Items.RemoveAt(tsbPortForwardingCheckListBox.SelectedIndex);
tsbPortForwardingCheckListBox.SelectedIndex = tsbPortForwardingCheckListBox.Items.Count > 0 ? 0 : -1;
}
}
private void tsbPortForwardingCheckListBox_ItemChecked(object sender, ItemCheckEventArgs e)
{
config.portForwarding[e.Index].enable = e.NewValue == CheckState.Checked ? true : false;
}
private void tsbPortForwardingCheckListBox_SelectedIndexChanged(object sender, EventArgs e)
{
InitPortForwardingParamGUI(tsbPortForwardingCheckListBox.SelectedIndex);
}
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -379,4 +379,31 @@
<data name="$this.Text" xml:space="preserve"> <data name="$this.Text" xml:space="preserve">
<value>参数设置</value> <value>参数设置</value>
</data> </data>
<data name="tabPage4.Text" xml:space="preserve">
<value> 端口转发 </value>
</data>
<data name="portForwardingDstHostLabel.Text" xml:space="preserve">
<value>目标主机</value>
</data>
<data name="portForwardingDstPortLabel.Text" xml:space="preserve">
<value>目标端口</value>
</data>
<data name="portForwardingLocalIpLabel.Text" xml:space="preserve">
<value>本地监听IP</value>
</data>
<data name="portForwardingLocalPortLabel.Text" xml:space="preserve">
<value>本地监听端口</value>
</data>
<data name="portForwardingNetworkLabel.Text" xml:space="preserve">
<value>网络</value>
</data>
<data name="portForwardingTagLabel.Text" xml:space="preserve">
<value>命名</value>
</data>
<data name="portForwardingAddButton.Text" xml:space="preserve">
<value>保存</value>
</data>
<data name="portForwardingRemoveButton.Text" xml:space="preserve">
<value>删除</value>
</data>
</root> </root>

View file

@ -90,6 +90,13 @@ namespace v2rayN.Handler
config.inbound[0].protocol = Global.InboundSocks; config.inbound[0].protocol = Global.InboundSocks;
} }
} }
// 端口转发
if (config.portForwarding == null)
{
config.portForwarding = new List<PortForwardingItem>();
}
//路由规则 //路由规则
if (Utils.IsNullOrEmpty(config.domainStrategy)) if (Utils.IsNullOrEmpty(config.domainStrategy))
{ {

View file

@ -157,6 +157,12 @@ namespace v2rayN.Handler
Inbounds inbound2 = GetInbound(config.inbound[0], Global.InboundHttp, 1, false); Inbounds inbound2 = GetInbound(config.inbound[0], Global.InboundHttp, 1, false);
v2rayConfig.inbounds.Add(inbound2); v2rayConfig.inbounds.Add(inbound2);
// 端口转发
foreach (var item in config.portForwarding)
{
v2rayConfig.inbounds.Add(GetPortForwarding(item));
}
if (config.inbound[0].allowLANConn) if (config.inbound[0].allowLANConn)
{ {
Inbounds inbound3 = GetInbound(config.inbound[0], Global.InboundSocks2, 2, true); Inbounds inbound3 = GetInbound(config.inbound[0], Global.InboundSocks2, 2, true);
@ -207,6 +213,25 @@ namespace v2rayN.Handler
return inbound; return inbound;
} }
private static Inbounds GetPortForwarding(PortForwardingItem portForwardingItem)
{
Inbounds inbound = new Inbounds();
inbound.tag = portForwardingItem.tag;
inbound.listen = portForwardingItem.localIp;
inbound.port = portForwardingItem.localPort;
inbound.protocol = Global.InboundAPIProtocal;
Inboundsettings settings = new Inboundsettings();
settings.udp = true;
settings.address = portForwardingItem.dstHost;
settings.port = portForwardingItem.dstPort;
settings.network = portForwardingItem.network;
settings.timeout = 0;
settings.followRedirect = false;
settings.userLevel = 0;
inbound.settings = settings;
return inbound;
}
/// <summary> /// <summary>
/// 路由 /// 路由
/// </summary> /// </summary>

View file

@ -149,6 +149,14 @@ namespace v2rayN.Mode
get; set; get; set;
} }
/// <summary>
/// 端口转发基于InItem
/// </summary>
public List<PortForwardingItem> portForwarding
{
get; set;
}
/// <summary> /// <summary>
/// vmess服务器信息 /// vmess服务器信息
/// </summary> /// </summary>
@ -599,6 +607,67 @@ namespace v2rayN.Mode
} }
[Serializable]
public class PortForwardingItem
{
/// <summary>
/// TAG
/// </summary>
public string tag
{
get; set;
}
/// <summary>
/// 本地监听IP
/// </summary>
public string localIp
{
get; set;
}
/// <summary>
/// 本地监听端口
/// </summary>
public int localPort
{
get; set;
}
/// <summary>
/// 目标主机
/// </summary>
public string dstHost
{
get; set;
}
/// <summary>
/// 目标端口
/// </summary>
public int dstPort
{
get; set;
}
/// <summary>
/// 网络[network: "tcp" | "udp" | "tcp,udp"]默认为tcp
/// </summary>
public string network
{
get; set;
}
/// <summary>
/// 是否启用
/// </summary>
public bool enable
{
get; set;
}
}
[Serializable] [Serializable]
public class KcpItem public class KcpItem
{ {

View file

@ -128,6 +128,31 @@ namespace v2rayN.Mode
/// </summary> /// </summary>
public string address { get; set; } public string address { get; set; }
/// <summary>
/// 端口,端口转发使用
/// </summary>
public int port { get; set; }
/// <summary>
/// 网络类型,端口转发使用["tcp" | "udp" | "tcp,udp"]
/// </summary>
public string network { get; set; }
/// <summary>
/// 连接空闲的时间限制,端口转发使用
/// </summary>
public int timeout { get; set; }
/// <summary>
/// 端口转发使用
/// </summary>
public bool followRedirect { get; set; }
/// <summary>
/// 端口转发使用
/// </summary>
public int userLevel { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>