Compare commits

..

8 Commits

Author SHA1 Message Date
Amazing_DM
bd05f875f2 Version 1.4.0 2020-03-11 09:59:01 +08:00
Amazing_DM
ea3fb188e4 :bug:修复NTT规则重复添加 2020-03-11 09:57:34 +08:00
Amazing_DM
ee3ac561b5 Update submodule 2020-03-10 21:43:19 +08:00
Amazing_DM
4fb090d7a4 Revert ":art:所有tap模式绕Lan IP"
This reverts commit 6dd50f1510.
2020-03-10 21:33:40 +08:00
Amazing_DM
9302900b5d Catch一模式列表筛选异常 2020-03-10 21:08:45 +08:00
Amazing_DM
6dd50f1510 :art:所有tap模式绕Lan IP
Signed-off-by: Amazing_DM <amazingdmdd@gmail.com>
2020-03-10 16:01:01 +08:00
Amazing_DM
91f73b936d Update submodule
Signed-off-by: Amazing_DM <amazingdmdd@gmail.com>
2020-03-10 14:57:59 +08:00
Amazing_DM
9ddcc3ae3c :zap:更新内核
Signed-off-by: Amazing_DM <amazingdmdd@gmail.com>
2020-03-10 14:45:50 +08:00
9 changed files with 98 additions and 165 deletions

View File

@@ -116,9 +116,8 @@ namespace Netch.Controllers
} }
} }
var processes = ""; var processes = "NTT.exe,";
mode.Rule.Add("NTT.exe");
foreach (var proc in mode.Rule) foreach (var proc in mode.Rule)
{ {
processes += proc; processes += proc;
@@ -152,7 +151,7 @@ namespace Netch.Controllers
} }
} }
Instance.StartInfo.Arguments = fallback + $" -t {Global.Settings.RedirectorTCPPort}"; Instance.StartInfo.Arguments = fallback;
Instance.OutputDataReceived += OnOutputDataReceived; Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived; Instance.ErrorDataReceived += OnOutputDataReceived;
State = Models.State.Starting; State = Models.State.Starting;
@@ -160,7 +159,6 @@ namespace Netch.Controllers
Instance.BeginOutputReadLine(); Instance.BeginOutputReadLine();
Instance.BeginErrorReadLine(); Instance.BeginErrorReadLine();
var IsFallback = false;
for (var i = 0; i < 1000; i++) for (var i = 0; i < 1000; i++)
{ {
Thread.Sleep(10); Thread.Sleep(10);
@@ -169,33 +167,6 @@ namespace Netch.Controllers
{ {
return true; 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 进程启动超时"); Utils.Logging.Info("NF 进程启动超时");
@@ -234,7 +205,7 @@ namespace Netch.Controllers
{ {
State = Models.State.Stopped; State = Models.State.Stopped;
} }
else if (e.Data.Contains("Started")) else if (e.Data.Contains("Redirect to"))
{ {
State = Models.State.Started; State = Models.State.Started;
} }

View File

@@ -300,7 +300,7 @@ namespace Netch.Controllers
else else
{ {
pDNSController.Start(); 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"; //dns = "1.1.1.1,1.0.0.1";
} }

View File

@@ -26,7 +26,7 @@ namespace Netch.Controllers
public const string Name = @"Netch"; public const string Name = @"Netch";
public const string Copyright = @"Copyright © 2019 - 2020"; public const string Copyright = @"Copyright © 2019 - 2020";
public const string Version = @"1.3.9"; public const string Version = @"1.4.0";
public async void Check(bool notifyNoFound, bool isPreRelease) public async void Check(bool notifyNoFound, bool isPreRelease)
{ {

View File

@@ -238,60 +238,66 @@ namespace Netch.Forms
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e) private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
{ {
var cbx = sender as ComboBox; try
// 绘制背景颜色
e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds);
if (e.Index >= 0)
{ {
// 绘制 备注/名称 字符串
e.Graphics.DrawString(cbx.Items[e.Index].ToString(), cbx.Font, new SolidBrush(Color.Black), e.Bounds);
if (cbx.Items[e.Index] is Models.Server) var cbx = sender as ComboBox;
// 绘制背景颜色
e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds);
if (e.Index >= 0)
{ {
var item = cbx.Items[e.Index] as Models.Server; // 绘制 备注/名称 字符串
e.Graphics.DrawString(cbx.Items[e.Index].ToString(), cbx.Font, new SolidBrush(Color.Black), e.Bounds);
// 计算延迟底色 if (cbx.Items[e.Index] is Models.Server)
SolidBrush brush;
if (item.Delay > 200)
{ {
// 红色 var item = cbx.Items[e.Index] as Models.Server;
brush = new SolidBrush(Color.Red);
// 计算延迟底色
SolidBrush brush;
if (item.Delay > 200)
{
// 红色
brush = new SolidBrush(Color.Red);
}
else if (item.Delay > 80)
{
// 黄色
brush = new SolidBrush(Color.Yellow);
}
else if (item.Delay >= 0)
{
// 绿色
brush = new SolidBrush(Color.FromArgb(50, 255, 56));
}
else
{
// 灰色
brush = new SolidBrush(Color.Gray);
}
// 绘制延迟底色
e.Graphics.FillRectangle(brush, ServerComboBox.Size.Width - 60, e.Bounds.Y, 60, e.Bounds.Height);
// 绘制延迟字符串
e.Graphics.DrawString(item.Delay.ToString(), cbx.Font, new SolidBrush(Color.Black), ServerComboBox.Size.Width - 58, e.Bounds.Y);
} }
else if (item.Delay > 80) else if (cbx.Items[e.Index] is Models.Mode)
{ {
// 黄色 var item = cbx.Items[e.Index] as Models.Mode;
brush = new SolidBrush(Color.Yellow);
// 绘制延迟底色
e.Graphics.FillRectangle(new SolidBrush(Color.Gray), ServerComboBox.Size.Width - 60, e.Bounds.Y, 60, e.Bounds.Height);
// 绘制延迟字符串
e.Graphics.DrawString(item.Rule.Count.ToString(), cbx.Font, new SolidBrush(Color.Black), ServerComboBox.Size.Width - 58, e.Bounds.Y);
} }
else if (item.Delay >= 0)
{
// 绿色
brush = new SolidBrush(Color.FromArgb(50, 255, 56));
}
else
{
// 灰色
brush = new SolidBrush(Color.Gray);
}
// 绘制延迟底色
e.Graphics.FillRectangle(brush, ServerComboBox.Size.Width - 60, e.Bounds.Y, 60, e.Bounds.Height);
// 绘制延迟字符串
e.Graphics.DrawString(item.Delay.ToString(), cbx.Font, new SolidBrush(Color.Black), ServerComboBox.Size.Width - 58, e.Bounds.Y);
}
else if (cbx.Items[e.Index] is Models.Mode)
{
var item = cbx.Items[e.Index] as Models.Mode;
// 绘制延迟底色
e.Graphics.FillRectangle(new SolidBrush(Color.Gray), ServerComboBox.Size.Width - 60, e.Bounds.Y, 60, e.Bounds.Height);
// 绘制延迟字符串
e.Graphics.DrawString(item.Rule.Count.ToString(), cbx.Font, new SolidBrush(Color.Black), ServerComboBox.Size.Width - 58, e.Bounds.Y);
} }
} }
catch (Exception)
{ }
} }
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
@@ -766,6 +772,7 @@ namespace Netch.Forms
private void ControlButton_Click(object sender, EventArgs e) private void ControlButton_Click(object sender, EventArgs e)
{ {
SaveConfigs();
if (State == Models.State.Waiting || State == Models.State.Stopped) if (State == Models.State.Waiting || State == Models.State.Stopped)
{ {
// 当前 ServerComboBox 中至少有一项 // 当前 ServerComboBox 中至少有一项

View File

@@ -30,8 +30,6 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm));
this.PortGroupBox = new System.Windows.Forms.GroupBox(); 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.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
this.HTTPPortLabel = new System.Windows.Forms.Label(); this.HTTPPortLabel = new System.Windows.Forms.Label();
this.HTTPPortTextBox = new System.Windows.Forms.TextBox(); this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
@@ -50,7 +48,11 @@
this.ControlButton = new System.Windows.Forms.Button(); this.ControlButton = new System.Windows.Forms.Button();
this.GlobalBypassIPsButton = new System.Windows.Forms.Button(); this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox(); 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.RunAtStartup = new System.Windows.Forms.CheckBox();
this.STUN_ServerTextBox = new System.Windows.Forms.TextBox();
this.MinimizeWhenStartedCheckBox = new System.Windows.Forms.CheckBox(); this.MinimizeWhenStartedCheckBox = new System.Windows.Forms.CheckBox();
this.ProfileCount_Label = new System.Windows.Forms.Label(); this.ProfileCount_Label = new System.Windows.Forms.Label();
this.ProfileCount_TextBox = new System.Windows.Forms.TextBox(); this.ProfileCount_TextBox = new System.Windows.Forms.TextBox();
@@ -58,10 +60,6 @@
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox(); this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox(); this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
this.ExitWhenClosedCheckBox = 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.PortGroupBox.SuspendLayout();
this.TUNTAPGroupBox.SuspendLayout(); this.TUNTAPGroupBox.SuspendLayout();
this.BehaviorGroupBox.SuspendLayout(); this.BehaviorGroupBox.SuspendLayout();
@@ -69,8 +67,6 @@
// //
// PortGroupBox // PortGroupBox
// //
this.PortGroupBox.Controls.Add(this.RedirectorLabel);
this.PortGroupBox.Controls.Add(this.RedirectorTextBox);
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox); this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
this.PortGroupBox.Controls.Add(this.HTTPPortLabel); this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox); this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
@@ -83,23 +79,6 @@
this.PortGroupBox.TabStop = false; this.PortGroupBox.TabStop = false;
this.PortGroupBox.Text = "Local Port"; 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 // AllowDevicesCheckBox
// //
this.AllowDevicesCheckBox.AutoSize = true; this.AllowDevicesCheckBox.AutoSize = true;
@@ -285,6 +264,32 @@
this.BehaviorGroupBox.TabStop = false; this.BehaviorGroupBox.TabStop = false;
this.BehaviorGroupBox.Text = "Behavior"; 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 // RunAtStartup
// //
this.RunAtStartup.AutoSize = true; this.RunAtStartup.AutoSize = true;
@@ -295,6 +300,14 @@
this.RunAtStartup.Text = "Run at startup"; this.RunAtStartup.Text = "Run at startup";
this.RunAtStartup.UseVisualStyleBackColor = true; 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 // MinimizeWhenStartedCheckBox
// //
this.MinimizeWhenStartedCheckBox.AutoSize = true; this.MinimizeWhenStartedCheckBox.AutoSize = true;
@@ -366,40 +379,6 @@
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true; 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 // SettingForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -450,8 +429,6 @@
private System.Windows.Forms.Button GlobalBypassIPsButton; private System.Windows.Forms.Button GlobalBypassIPsButton;
private System.Windows.Forms.CheckBox TUNTAPUseCustomDNSCheckBox; private System.Windows.Forms.CheckBox TUNTAPUseCustomDNSCheckBox;
private System.Windows.Forms.CheckBox AllowDevicesCheckBox; 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.GroupBox BehaviorGroupBox;
private System.Windows.Forms.CheckBox ExitWhenClosedCheckBox; private System.Windows.Forms.CheckBox ExitWhenClosedCheckBox;
private System.Windows.Forms.CheckBox StopWhenExitedCheckBox; private System.Windows.Forms.CheckBox StopWhenExitedCheckBox;

View File

@@ -64,7 +64,6 @@ namespace Netch.Forms
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString(); Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString(); HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address; TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask; TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
@@ -225,27 +224,6 @@ namespace Netch.Forms
return; 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) if (AllowDevicesCheckBox.Checked)
{ {
Global.Settings.LocalAddress = "0.0.0.0"; Global.Settings.LocalAddress = "0.0.0.0";

View File

@@ -97,7 +97,7 @@ namespace Netch.Models
/// <summary> /// <summary>
/// Redirector TCP 占用端口 /// Redirector TCP 占用端口
/// </summary> /// </summary>
public int RedirectorTCPPort = 2800; //public int RedirectorTCPPort = 2800;
/// <summary> /// <summary>
/// HTTP 和 Socks5 本地代理地址 /// HTTP 和 Socks5 本地代理地址
@@ -127,7 +127,7 @@ namespace Netch.Models
/// <summary> /// <summary>
/// 全局绕过 IP 列表 /// 全局绕过 IP 列表
/// </summary> /// </summary>
public List<string> BypassIPs = new List<string>(); public List<string> BypassIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/24" };
/// <summary> /// <summary>
/// 已保存的快捷配置 /// 已保存的快捷配置

2
modes

Submodule modes updated: 9b3ce74bd6...8d6f98d43e