diff --git a/Netch/Controllers/NFController.cs b/Netch/Controllers/NFController.cs
index b6fa456c..6ab887cc 100644
--- a/Netch/Controllers/NFController.cs
+++ b/Netch/Controllers/NFController.cs
@@ -207,12 +207,11 @@ namespace Netch.Controllers
}
}
- Utils.Logging.Info($"{fallback}");
-
if (File.Exists("logging\\redirector.log"))
File.Delete("logging\\redirector.log");
- Instance.StartInfo.Arguments = fallback;
+ Instance.StartInfo.Arguments = fallback + $" -tcport {Global.Settings.RedirectorTCPPort}";
+ Utils.Logging.Info(Instance.StartInfo.Arguments);
Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived;
State = Models.State.Starting;
diff --git a/Netch/Forms/SettingForm.Designer.cs b/Netch/Forms/SettingForm.Designer.cs
index 8a3894cc..65b85527 100644
--- a/Netch/Forms/SettingForm.Designer.cs
+++ b/Netch/Forms/SettingForm.Designer.cs
@@ -68,6 +68,8 @@
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
+ this.RedirectorLabel = new System.Windows.Forms.Label();
+ this.RedirectorTextBox = new System.Windows.Forms.TextBox();
this.PortGroupBox.SuspendLayout();
this.TUNTAPGroupBox.SuspendLayout();
this.BehaviorGroupBox.SuspendLayout();
@@ -75,6 +77,8 @@
//
// PortGroupBox
//
+ this.PortGroupBox.Controls.Add(this.RedirectorLabel);
+ this.PortGroupBox.Controls.Add(this.RedirectorTextBox);
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
@@ -90,7 +94,7 @@
// AllowDevicesCheckBox
//
this.AllowDevicesCheckBox.AutoSize = true;
- this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 80);
+ this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 109);
this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox";
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21);
this.AllowDevicesCheckBox.TabIndex = 5;
@@ -471,6 +475,23 @@
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
//
+ // RedirectorLabel
+ //
+ this.RedirectorLabel.AutoSize = true;
+ this.RedirectorLabel.Location = new System.Drawing.Point(9, 83);
+ this.RedirectorLabel.Name = "RedirectorLabel";
+ this.RedirectorLabel.Size = new System.Drawing.Size(95, 17);
+ this.RedirectorLabel.TabIndex = 6;
+ this.RedirectorLabel.Text = "Redirector TCP";
+ //
+ // RedirectorTextBox
+ //
+ this.RedirectorTextBox.Location = new System.Drawing.Point(120, 80);
+ this.RedirectorTextBox.Name = "RedirectorTextBox";
+ this.RedirectorTextBox.Size = new System.Drawing.Size(294, 23);
+ this.RedirectorTextBox.TabIndex = 7;
+ this.RedirectorTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -542,5 +563,7 @@
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
private System.Windows.Forms.Label DetectionInterval_Label;
+ private System.Windows.Forms.Label RedirectorLabel;
+ private System.Windows.Forms.TextBox RedirectorTextBox;
}
}
\ No newline at end of file
diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs
index c988b379..8b89ccab 100644
--- a/Netch/Forms/SettingForm.cs
+++ b/Netch/Forms/SettingForm.cs
@@ -69,6 +69,7 @@ namespace Netch.Forms
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
+ RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
@@ -238,6 +239,27 @@ namespace Netch.Forms
return;
}
+ try
+ {
+ var RedirectorPort = int.Parse(RedirectorTextBox.Text);
+
+ if (RedirectorPort > 0 && RedirectorPort < 65536)
+ {
+ Global.Settings.RedirectorTCPPort = RedirectorPort;
+ }
+ else
+ {
+ throw new FormatException();
+ }
+ }
+ catch (FormatException)
+ {
+ RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
+ MessageBox.Show(Utils.i18N.Translate("Port value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+ return;
+ }
+
if (AllowDevicesCheckBox.Checked)
{
Global.Settings.LocalAddress = "0.0.0.0";
diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs
index 84f12f1e..13b0c5c4 100644
--- a/Netch/Models/Setting.cs
+++ b/Netch/Models/Setting.cs
@@ -102,7 +102,7 @@ namespace Netch.Models
///
/// Redirector TCP 占用端口
///
- //public int RedirectorTCPPort = 2800;
+ public int RedirectorTCPPort = 3901;
///
/// HTTP 和 Socks5 本地代理地址
diff --git a/binaries b/binaries
index a26274a8..2c681e04 160000
--- a/binaries
+++ b/binaries
@@ -1 +1 @@
-Subproject commit a26274a8347bf8a9f9344fd413cbb9fa14177eae
+Subproject commit 2c681e04eb860465e998d79f23bc831e4dbce1e7