mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
@@ -152,7 +152,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
Instance.StartInfo.Arguments = fallback + $" -t {Global.Settings.RedirectorTCPPort}";
|
||||
Instance.StartInfo.Arguments = fallback;
|
||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
State = Models.State.Starting;
|
||||
@@ -160,7 +160,6 @@ namespace Netch.Controllers
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
|
||||
var IsFallback = false;
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
@@ -169,33 +168,6 @@ namespace Netch.Controllers
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (State == Models.State.Stopped)
|
||||
{
|
||||
if (!IsFallback)
|
||||
{
|
||||
IsFallback = true;
|
||||
Stop();
|
||||
Utils.Logging.Info($"尝试去除 \"-t {Global.Settings.RedirectorTCPPort}\" 参数后启动 \"bin\\Redirector.exe\"");
|
||||
Instance.StartInfo.Arguments = fallback;
|
||||
Utils.Logging.Info($"当前 \"bin\\Redirector.exe\" 启动参数为 \"{Instance.StartInfo.Arguments}\"");
|
||||
Global.Settings.RedirectorTCPPort = 2800;
|
||||
Instance.CancelOutputRead();
|
||||
Instance.CancelErrorRead();
|
||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
State = Models.State.Starting;
|
||||
Instance.Start();
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Logging.Info("NF 进程启动失败");
|
||||
Stop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Utils.Logging.Info("NF 进程启动超时");
|
||||
@@ -234,7 +206,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("Started"))
|
||||
else if (e.Data.Contains("Redirect to"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace Netch.Controllers
|
||||
else
|
||||
{
|
||||
pDNSController.Start();
|
||||
dns = "127.0.0.1,127.0.0.1";
|
||||
dns = "127.0.0.1";
|
||||
//dns = "1.1.1.1,1.0.0.1";
|
||||
}
|
||||
|
||||
|
||||
99
Netch/Forms/SettingForm.Designer.cs
generated
99
Netch/Forms/SettingForm.Designer.cs
generated
@@ -30,8 +30,6 @@
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm));
|
||||
this.PortGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.RedirectorLabel = new System.Windows.Forms.Label();
|
||||
this.RedirectorTextBox = new System.Windows.Forms.TextBox();
|
||||
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.HTTPPortLabel = new System.Windows.Forms.Label();
|
||||
this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
|
||||
@@ -50,7 +48,11 @@
|
||||
this.ControlButton = new System.Windows.Forms.Button();
|
||||
this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
|
||||
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.RunAtStartup = new System.Windows.Forms.CheckBox();
|
||||
this.STUN_ServerTextBox = new System.Windows.Forms.TextBox();
|
||||
this.MinimizeWhenStartedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ProfileCount_Label = new System.Windows.Forms.Label();
|
||||
this.ProfileCount_TextBox = new System.Windows.Forms.TextBox();
|
||||
@@ -58,10 +60,6 @@
|
||||
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.STUN_ServerTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.PortGroupBox.SuspendLayout();
|
||||
this.TUNTAPGroupBox.SuspendLayout();
|
||||
this.BehaviorGroupBox.SuspendLayout();
|
||||
@@ -69,8 +67,6 @@
|
||||
//
|
||||
// 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);
|
||||
@@ -83,23 +79,6 @@
|
||||
this.PortGroupBox.TabStop = false;
|
||||
this.PortGroupBox.Text = "Local Port";
|
||||
//
|
||||
// RedirectorLabel
|
||||
//
|
||||
this.RedirectorLabel.AutoSize = true;
|
||||
this.RedirectorLabel.Location = new System.Drawing.Point(9, 110);
|
||||
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, 107);
|
||||
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;
|
||||
//
|
||||
// AllowDevicesCheckBox
|
||||
//
|
||||
this.AllowDevicesCheckBox.AutoSize = true;
|
||||
@@ -285,6 +264,32 @@
|
||||
this.BehaviorGroupBox.TabStop = false;
|
||||
this.BehaviorGroupBox.Text = "Behavior";
|
||||
//
|
||||
// STUN_ServerPortTextBox
|
||||
//
|
||||
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 237);
|
||||
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
|
||||
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.STUN_ServerPortTextBox.TabIndex = 8;
|
||||
this.STUN_ServerPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 243);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(110, 17);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "STUN Server Port";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(9, 214);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(82, 17);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "STUN Server";
|
||||
//
|
||||
// RunAtStartup
|
||||
//
|
||||
this.RunAtStartup.AutoSize = true;
|
||||
@@ -295,6 +300,14 @@
|
||||
this.RunAtStartup.Text = "Run at startup";
|
||||
this.RunAtStartup.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// STUN_ServerTextBox
|
||||
//
|
||||
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 211);
|
||||
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
|
||||
this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.STUN_ServerTextBox.TabIndex = 11;
|
||||
this.STUN_ServerTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// MinimizeWhenStartedCheckBox
|
||||
//
|
||||
this.MinimizeWhenStartedCheckBox.AutoSize = true;
|
||||
@@ -366,40 +379,6 @@
|
||||
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(9, 214);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(82, 17);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "STUN Server";
|
||||
//
|
||||
// STUN_ServerTextBox
|
||||
//
|
||||
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 211);
|
||||
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
|
||||
this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.STUN_ServerTextBox.TabIndex = 11;
|
||||
this.STUN_ServerTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 243);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(110, 17);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "STUN Server Port";
|
||||
//
|
||||
// STUN_ServerPortTextBox
|
||||
//
|
||||
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 237);
|
||||
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
|
||||
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.STUN_ServerPortTextBox.TabIndex = 8;
|
||||
this.STUN_ServerPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// SettingForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
@@ -450,8 +429,6 @@
|
||||
private System.Windows.Forms.Button GlobalBypassIPsButton;
|
||||
private System.Windows.Forms.CheckBox TUNTAPUseCustomDNSCheckBox;
|
||||
private System.Windows.Forms.CheckBox AllowDevicesCheckBox;
|
||||
private System.Windows.Forms.TextBox RedirectorTextBox;
|
||||
private System.Windows.Forms.Label RedirectorLabel;
|
||||
private System.Windows.Forms.GroupBox BehaviorGroupBox;
|
||||
private System.Windows.Forms.CheckBox ExitWhenClosedCheckBox;
|
||||
private System.Windows.Forms.CheckBox StopWhenExitedCheckBox;
|
||||
|
||||
@@ -64,7 +64,6 @@ 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;
|
||||
@@ -225,27 +224,6 @@ 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";
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Netch.Models
|
||||
/// <summary>
|
||||
/// Redirector TCP 占用端口
|
||||
/// </summary>
|
||||
public int RedirectorTCPPort = 2800;
|
||||
//public int RedirectorTCPPort = 2800;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP 和 Socks5 本地代理地址
|
||||
|
||||
2
binaries
2
binaries
Submodule binaries updated: afbf683214...cf389ebbb6
Reference in New Issue
Block a user