Compare commits

..

19 Commits

Author SHA1 Message Date
Amazing_DM
bdaab4f1ac 此处修复一个诡异的BUG 感谢@ColinWood Tap模式 Mux不能为Null 否则Netch内存占用极大 2020-03-27 12:03:31 +08:00
Amazing_DM
9ad5e16f47 Update submodule 2020-03-26 14:48:30 +08:00
Amazing_DM
c861ed4116 Merge pull request #256 from VCStardust/master
Change STUN Test Server
2020-03-25 21:57:45 -05:00
Col. Schwi
c39b758fe6 Change STUN Server 2020-03-25 21:28:15 +08:00
Amazing_DM
e1901587a5 :art:订阅更新超时改为10s
:art:微调设置界面
2020-03-24 18:29:46 +08:00
Amazing_DM
8aea21a2c6 :bug:fix a bug. catch复制链接按钮 2020-03-23 14:43:38 +08:00
Amazing_DM
d97d461354 :art:改进SSR链接解析 2020-03-23 14:40:22 +08:00
Amazing_DM
d8f3bdaa78 :sparkles:添加启动后Tcping设置 2020-03-23 11:18:17 +08:00
Amazing_DM
7516ecf946 Update submodule 2020-03-22 14:23:17 +08:00
Amazing_DM
69d6397383 Merge pull request #255 from henning724/master
解决MainForm Design页面报错问题 ver2
2020-03-22 14:20:40 +08:00
Amazing_DM
7854a91fef Update submodule 2020-03-22 14:17:27 +08:00
Amazing_DM
853da97ffc Update NFController 2020-03-20 22:51:27 +08:00
Amazing_DM
a0fbcb588d :sparkles:添加白名单模式(可代理全局进程) 2020-03-20 22:37:59 +08:00
Amazing_DM
1e2c284a18 Update submodule 2020-03-20 20:40:05 +08:00
henning724
499898fdf5 将部分界面元素放到table中
修复配置数为0时部分系统上的显示bug
2020-03-20 20:24:35 +08:00
henning724
5874bf7599 解决MainForm Design页面报错问题 ver2 2020-03-20 18:15:56 +08:00
Amazing_DM
137456f6e6 Revert "解决MainForm Design页面报错问题"
This reverts commit 6c1d2c9e4e.
2020-03-20 17:21:39 +08:00
Amazing_DM
5fe0e33722 Merge pull request #254 from henning724/master
解决MainForm Design页面报错问题
2020-03-20 17:16:26 +08:00
henning724
6c1d2c9e4e 解决MainForm Design页面报错问题 2020-03-20 17:07:36 +08:00
20 changed files with 792 additions and 309 deletions

View File

@@ -3,24 +3,40 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29009.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetchLib", "NetchLib\NetchLib.csproj", "{A8715AF4-ACC6-43F9-9381-4294C5360623}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|Any CPU.ActiveCfg = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.ActiveCfg = Debug|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.ActiveCfg = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.Build.0 = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|Any CPU.ActiveCfg = Release|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.ActiveCfg = Release|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.Build.0 = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|Any CPU.ActiveCfg = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.ActiveCfg = Debug|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.Build.0 = Debug|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x86.ActiveCfg = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x86.Build.0 = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|Any CPU.ActiveCfg = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.ActiveCfg = Release|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.Build.0 = Release|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x86.ActiveCfg = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -124,11 +124,11 @@ namespace Netch.Controllers
}
// 进程代理模式,启动 NF 控制器
result = pNFController.Start(server, mode);
Task.Run(() =>
{
pNTTController.Start();
});
if (result)
Task.Run(() =>
{
pNTTController.Start();
});
}
else if (mode.Type == 1)
@@ -143,11 +143,11 @@ namespace Netch.Controllers
}
// TUN/TAP 黑名单代理模式,启动 TUN/TAP 控制器
result = pTUNTAPController.Start(server, mode);
Task.Run(() =>
{
pNTTController.Start();
});
if (result)
Task.Run(() =>
{
pNTTController.Start();
});
}
else if (mode.Type == 2)
{
@@ -161,11 +161,11 @@ namespace Netch.Controllers
}
// TUN/TAP 白名单代理模式,启动 TUN/TAP 控制器
result = pTUNTAPController.Start(server, mode);
Task.Run(() =>
{
pNTTController.Start();
});
if (result)
Task.Run(() =>
{
pNTTController.Start();
});
}
else if (mode.Type == 3 || mode.Type == 5)
{

View File

@@ -88,10 +88,10 @@ namespace Netch.Controllers
var service = new ServiceController("netfilter2");
if (service.Status == ServiceControllerStatus.Running)
{
//防止其他程序占用
service.Stop();
//防止其他程序占用 重置NF百万ID限制 待定
/*service.Stop();
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
service.Start();
service.Start();*/
}
else if (service.Status == ServiceControllerStatus.Stopped)
{
@@ -111,7 +111,13 @@ namespace Netch.Controllers
}
}
var processes = "NTT.exe,";
var processes = "";
//开启进程白名单模式
if (!Global.Settings.ProcessBypassMode)
{
processes += "NTT.exe,";
}
foreach (var proc in mode.Rule)
{
@@ -164,10 +170,24 @@ namespace Netch.Controllers
}
Instance.StartInfo.FileName = "bin\\Redirector.exe";
//开启进程白名单模式
if (Global.Settings.ProcessBypassMode)
{
processes += ",Shadowsocks.exe";
processes += ",ShadowsocksR.exe";
processes += ",Privoxy.exe";
processes += ",simple-obfs.exe";
processes += ",v2ray.exe,v2ctl.exe,v2ray-plugin.exe";
fallback += " -bypass true ";
}
else
{
fallback += " -bypass false ";
}
if (server.Type != "Socks5")
{
fallback = $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
fallback += $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
}
else
{
@@ -178,7 +198,7 @@ namespace Netch.Controllers
return false;
}
fallback = $"-r {result}:{server.Port} -p \"{processes}\"";
fallback += $"-r {result}:{server.Port} -p \"{processes}\"";
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
{
@@ -187,6 +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.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived;

View File

@@ -127,14 +127,18 @@ namespace Netch.Controllers
enabled = server.UseMux
}
},
new Models.Information.VMess.Outbounds
//此处修复一个诡异的BUG 感谢@ColinWood Tap模式 Mux不能为Null 否则Netch内存占用极大
/*new Models.Information.VMess.Outbounds
{
tag = "direct",
protocol = "freedom",
settings = null,
streamSettings = null,
*//*mux = new Models.Information.VMess.OutboundMux(){
enabled = true
}*//*
mux = null
}
}*/
},
routing = new Models.Information.VMess.Routing
{
@@ -147,7 +151,7 @@ namespace Netch.Controllers
{
"geoip:cn",
"geoip:private"
},
domain = new List<string>
{

View File

@@ -53,23 +53,27 @@ namespace Netch.Forms
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox();
this.DeleteModePictureBox = new System.Windows.Forms.PictureBox();
this.EditModePictureBox = new System.Windows.Forms.PictureBox();
this.ProfileNameText = new System.Windows.Forms.TextBox();
this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.ProfileLabel = new System.Windows.Forms.Label();
this.SpeedPictureBox = new System.Windows.Forms.PictureBox();
this.DeletePictureBox = new System.Windows.Forms.PictureBox();
this.EditPictureBox = new System.Windows.Forms.PictureBox();
this.ModeLabel = new System.Windows.Forms.Label();
this.ServerLabel = new System.Windows.Forms.Label();
this.ProfileNameText = new System.Windows.Forms.TextBox();
this.ModeComboBox = new System.Windows.Forms.SearchComboBox();
this.ServerComboBox = new System.Windows.Forms.ComboBox();
this.ServerLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.EditPictureBox = new System.Windows.Forms.PictureBox();
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox();
this.DeletePictureBox = new System.Windows.Forms.PictureBox();
this.SpeedPictureBox = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.EditModePictureBox = new System.Windows.Forms.PictureBox();
this.DeleteModePictureBox = new System.Windows.Forms.PictureBox();
this.StatusStrip = new System.Windows.Forms.StatusStrip();
this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.UsedBandwidthLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.DownloadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.UploadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.ControlButton = new System.Windows.Forms.Button();
this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.NotifyMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
@@ -78,15 +82,17 @@ namespace Netch.Forms
this.SettingsButton = new System.Windows.Forms.Button();
this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.MenuStrip.SuspendLayout();
this.ConfigurationGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit();
this.configLayoutPanel.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
this.tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit();
this.StatusStrip.SuspendLayout();
this.NotifyMenu.SuspendLayout();
this.ProfileGroupBox.SuspendLayout();
@@ -269,46 +275,180 @@ namespace Netch.Forms
//
// ConfigurationGroupBox
//
this.ConfigurationGroupBox.Controls.Add(this.CopyLinkPictureBox);
this.ConfigurationGroupBox.Controls.Add(this.DeleteModePictureBox);
this.ConfigurationGroupBox.Controls.Add(this.EditModePictureBox);
this.ConfigurationGroupBox.Controls.Add(this.ProfileNameText);
this.ConfigurationGroupBox.Controls.Add(this.ProfileLabel);
this.ConfigurationGroupBox.Controls.Add(this.SpeedPictureBox);
this.ConfigurationGroupBox.Controls.Add(this.DeletePictureBox);
this.ConfigurationGroupBox.Controls.Add(this.EditPictureBox);
this.ConfigurationGroupBox.Controls.Add(this.ModeLabel);
this.ConfigurationGroupBox.Controls.Add(this.ModeComboBox);
this.ConfigurationGroupBox.Controls.Add(this.ServerComboBox);
this.ConfigurationGroupBox.Controls.Add(this.ServerLabel);
this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 28);
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
this.ConfigurationGroupBox.Size = new System.Drawing.Size(605, 113);
this.ConfigurationGroupBox.Size = new System.Drawing.Size(605, 115);
this.ConfigurationGroupBox.TabIndex = 1;
this.ConfigurationGroupBox.TabStop = false;
this.ConfigurationGroupBox.Text = "Configuration";
//
// configLayoutPanel
//
this.configLayoutPanel.ColumnCount = 3;
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.configLayoutPanel.Controls.Add(this.ProfileLabel, 0, 2);
this.configLayoutPanel.Controls.Add(this.ModeLabel, 0, 1);
this.configLayoutPanel.Controls.Add(this.ServerLabel, 0, 0);
this.configLayoutPanel.Controls.Add(this.ProfileNameText, 1, 2);
this.configLayoutPanel.Controls.Add(this.ModeComboBox, 1, 1);
this.configLayoutPanel.Controls.Add(this.ServerComboBox, 1, 0);
this.configLayoutPanel.Controls.Add(this.tableLayoutPanel2, 2, 0);
this.configLayoutPanel.Controls.Add(this.tableLayoutPanel3, 2, 1);
this.configLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.configLayoutPanel.Location = new System.Drawing.Point(3, 19);
this.configLayoutPanel.Name = "configLayoutPanel";
this.configLayoutPanel.RowCount = 3;
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.configLayoutPanel.Size = new System.Drawing.Size(599, 93);
this.configLayoutPanel.TabIndex = 15;
//
// ProfileLabel
//
this.ProfileLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ProfileLabel.AutoSize = true;
this.ProfileLabel.Location = new System.Drawing.Point(3, 69);
this.ProfileLabel.Name = "ProfileLabel";
this.ProfileLabel.Size = new System.Drawing.Size(45, 17);
this.ProfileLabel.TabIndex = 10;
this.ProfileLabel.Text = "Profile";
//
// ModeLabel
//
this.ModeLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ModeLabel.AutoSize = true;
this.ModeLabel.Location = new System.Drawing.Point(3, 38);
this.ModeLabel.Name = "ModeLabel";
this.ModeLabel.Size = new System.Drawing.Size(43, 17);
this.ModeLabel.TabIndex = 3;
this.ModeLabel.Text = "Mode";
//
// ServerLabel
//
this.ServerLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ServerLabel.AutoSize = true;
this.ServerLabel.Location = new System.Drawing.Point(3, 7);
this.ServerLabel.Name = "ServerLabel";
this.ServerLabel.Size = new System.Drawing.Size(45, 17);
this.ServerLabel.TabIndex = 0;
this.ServerLabel.Text = "Server";
//
// ProfileNameText
//
this.ProfileNameText.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProfileNameText.Location = new System.Drawing.Point(54, 65);
this.ProfileNameText.Name = "ProfileNameText";
this.ProfileNameText.Size = new System.Drawing.Size(442, 23);
this.ProfileNameText.TabIndex = 11;
//
// ModeComboBox
//
this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ModeComboBox.FormattingEnabled = true;
this.ModeComboBox.IntegralHeight = false;
this.ModeComboBox.Location = new System.Drawing.Point(54, 34);
this.ModeComboBox.Name = "ModeComboBox";
this.ModeComboBox.Size = new System.Drawing.Size(442, 24);
this.ModeComboBox.TabIndex = 2;
this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// ServerComboBox
//
this.ServerComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ServerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ServerComboBox.FormattingEnabled = true;
this.ServerComboBox.IntegralHeight = false;
this.ServerComboBox.Location = new System.Drawing.Point(54, 3);
this.ServerComboBox.MaxDropDownItems = 16;
this.ServerComboBox.Name = "ServerComboBox";
this.ServerComboBox.Size = new System.Drawing.Size(442, 24);
this.ServerComboBox.TabIndex = 1;
this.ServerComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 4;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.Controls.Add(this.EditPictureBox, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.CopyLinkPictureBox, 3, 0);
this.tableLayoutPanel2.Controls.Add(this.DeletePictureBox, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.SpeedPictureBox, 2, 0);
this.tableLayoutPanel2.Location = new System.Drawing.Point(502, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(94, 24);
this.tableLayoutPanel2.TabIndex = 12;
//
// EditPictureBox
//
this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image")));
this.EditPictureBox.Location = new System.Drawing.Point(3, 3);
this.EditPictureBox.Name = "EditPictureBox";
this.EditPictureBox.Size = new System.Drawing.Size(16, 16);
this.EditPictureBox.TabIndex = 7;
this.EditPictureBox.TabStop = false;
this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click);
//
// CopyLinkPictureBox
//
this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink;
this.CopyLinkPictureBox.Location = new System.Drawing.Point(582, 25);
this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3);
this.CopyLinkPictureBox.Name = "CopyLinkPictureBox";
this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18);
this.CopyLinkPictureBox.TabIndex = 14;
this.CopyLinkPictureBox.TabStop = false;
this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click);
//
// DeleteModePictureBox
// DeletePictureBox
//
this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete;
this.DeleteModePictureBox.Location = new System.Drawing.Point(540, 57);
this.DeleteModePictureBox.Name = "DeleteModePictureBox";
this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16);
this.DeleteModePictureBox.TabIndex = 13;
this.DeleteModePictureBox.TabStop = false;
this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click);
this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image")));
this.DeletePictureBox.Location = new System.Drawing.Point(26, 3);
this.DeletePictureBox.Name = "DeletePictureBox";
this.DeletePictureBox.Size = new System.Drawing.Size(16, 16);
this.DeletePictureBox.TabIndex = 8;
this.DeletePictureBox.TabStop = false;
this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click);
//
// SpeedPictureBox
//
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image")));
this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3);
this.SpeedPictureBox.Name = "SpeedPictureBox";
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
this.SpeedPictureBox.TabIndex = 9;
this.SpeedPictureBox.TabStop = false;
this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click);
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 4;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.Controls.Add(this.EditModePictureBox, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.DeleteModePictureBox, 1, 0);
this.tableLayoutPanel3.Location = new System.Drawing.Point(502, 34);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(94, 24);
this.tableLayoutPanel3.TabIndex = 13;
//
// EditModePictureBox
//
@@ -316,104 +456,23 @@ namespace Netch.Forms
this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.Location = new System.Drawing.Point(518, 56);
this.EditModePictureBox.Location = new System.Drawing.Point(3, 3);
this.EditModePictureBox.Name = "EditModePictureBox";
this.EditModePictureBox.Size = new System.Drawing.Size(16, 16);
this.EditModePictureBox.TabIndex = 12;
this.EditModePictureBox.TabStop = false;
this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click);
//
// ProfileNameText
// DeleteModePictureBox
//
this.ProfileNameText.Location = new System.Drawing.Point(57, 83);
this.ProfileNameText.Name = "ProfileNameText";
this.ProfileNameText.Size = new System.Drawing.Size(455, 23);
this.ProfileNameText.TabIndex = 11;
//
// ProfileLabel
//
this.ProfileLabel.AutoSize = true;
this.ProfileLabel.Location = new System.Drawing.Point(6, 86);
this.ProfileLabel.Name = "ProfileLabel";
this.ProfileLabel.Size = new System.Drawing.Size(45, 17);
this.ProfileLabel.TabIndex = 10;
this.ProfileLabel.Text = "Profile";
//
// SpeedPictureBox
//
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image")));
this.SpeedPictureBox.Location = new System.Drawing.Point(562, 26);
this.SpeedPictureBox.Name = "SpeedPictureBox";
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
this.SpeedPictureBox.TabIndex = 9;
this.SpeedPictureBox.TabStop = false;
this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click);
//
// DeletePictureBox
//
this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image")));
this.DeletePictureBox.Location = new System.Drawing.Point(540, 26);
this.DeletePictureBox.Name = "DeletePictureBox";
this.DeletePictureBox.Size = new System.Drawing.Size(16, 16);
this.DeletePictureBox.TabIndex = 8;
this.DeletePictureBox.TabStop = false;
this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click);
//
// EditPictureBox
//
this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image")));
this.EditPictureBox.Location = new System.Drawing.Point(518, 26);
this.EditPictureBox.Name = "EditPictureBox";
this.EditPictureBox.Size = new System.Drawing.Size(16, 16);
this.EditPictureBox.TabIndex = 7;
this.EditPictureBox.TabStop = false;
this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click);
//
// ModeLabel
//
this.ModeLabel.AutoSize = true;
this.ModeLabel.Location = new System.Drawing.Point(6, 56);
this.ModeLabel.Name = "ModeLabel";
this.ModeLabel.Size = new System.Drawing.Size(43, 17);
this.ModeLabel.TabIndex = 3;
this.ModeLabel.Text = "Mode";
//
// ModeComboBox
//
this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ModeComboBox.FormattingEnabled = true;
this.ModeComboBox.IntegralHeight = false;
this.ModeComboBox.Location = new System.Drawing.Point(57, 53);
this.ModeComboBox.Name = "ModeComboBox";
this.ModeComboBox.Size = new System.Drawing.Size(455, 24);
this.ModeComboBox.TabIndex = 2;
this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// ServerComboBox
//
this.ServerComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ServerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ServerComboBox.FormattingEnabled = true;
this.ServerComboBox.IntegralHeight = false;
this.ServerComboBox.Location = new System.Drawing.Point(57, 22);
this.ServerComboBox.MaxDropDownItems = 16;
this.ServerComboBox.Name = "ServerComboBox";
this.ServerComboBox.Size = new System.Drawing.Size(455, 24);
this.ServerComboBox.TabIndex = 1;
this.ServerComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// ServerLabel
//
this.ServerLabel.AutoSize = true;
this.ServerLabel.Location = new System.Drawing.Point(6, 26);
this.ServerLabel.Name = "ServerLabel";
this.ServerLabel.Size = new System.Drawing.Size(45, 17);
this.ServerLabel.TabIndex = 0;
this.ServerLabel.Text = "Server";
this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete;
this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3);
this.DeleteModePictureBox.Name = "DeleteModePictureBox";
this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16);
this.DeleteModePictureBox.TabIndex = 13;
this.DeleteModePictureBox.TabStop = false;
this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click);
//
// StatusStrip
//
@@ -424,7 +483,7 @@ namespace Netch.Forms
this.DownloadSpeedLabel,
this.UploadSpeedLabel,
this.NatTypeStatusLabel});
this.StatusStrip.Location = new System.Drawing.Point(0, 254);
this.StatusStrip.Location = new System.Drawing.Point(0, 250);
this.StatusStrip.Name = "StatusStrip";
this.StatusStrip.Size = new System.Drawing.Size(629, 22);
this.StatusStrip.SizingGrip = false;
@@ -458,16 +517,21 @@ namespace Netch.Forms
this.UploadSpeedLabel.Text = "↑: 0 KB/s";
this.UploadSpeedLabel.Visible = false;
//
// NatTypeStatusLabel
//
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel";
this.NatTypeStatusLabel.Size = new System.Drawing.Size(0, 17);
//
// ControlButton
//
this.ControlButton.Location = new System.Drawing.Point(542, 219);
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ControlButton.Location = new System.Drawing.Point(542, 215);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 27);
this.ControlButton.TabIndex = 3;
this.ControlButton.Text = "Start";
this.ControlButton.UseVisualStyleBackColor = true;
this.ControlButton.Click += new System.EventHandler(this.ControlButton_Click);
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
// NotifyIcon
//
@@ -503,19 +567,19 @@ namespace Netch.Forms
//
// SettingsButton
//
this.SettingsButton.Location = new System.Drawing.Point(12, 219);
this.SettingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SettingsButton.Location = new System.Drawing.Point(12, 215);
this.SettingsButton.Name = "SettingsButton";
this.SettingsButton.Size = new System.Drawing.Size(72, 27);
this.SettingsButton.TabIndex = 4;
this.SettingsButton.Text = "Settings";
this.SettingsButton.UseVisualStyleBackColor = true;
this.SettingsButton.Click += new System.EventHandler(this.SettingsButton_Click);
this.SettingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
// ProfileGroupBox
//
this.ProfileGroupBox.Controls.Add(this.ProfileTable);
this.ProfileGroupBox.Location = new System.Drawing.Point(12, 147);
this.ProfileGroupBox.Location = new System.Drawing.Point(12, 146);
this.ProfileGroupBox.Name = "ProfileGroupBox";
this.ProfileGroupBox.Size = new System.Drawing.Size(605, 65);
this.ProfileGroupBox.TabIndex = 13;
@@ -538,17 +602,11 @@ namespace Netch.Forms
this.ProfileTable.Size = new System.Drawing.Size(599, 43);
this.ProfileTable.TabIndex = 0;
//
// NatTypeStatusLabel
//
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel";
this.NatTypeStatusLabel.Size = new System.Drawing.Size(109, 17);
this.NatTypeStatusLabel.Text = "";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(629, 276);
this.ClientSize = new System.Drawing.Size(629, 272);
this.Controls.Add(this.ProfileGroupBox);
this.Controls.Add(this.SettingsButton);
this.Controls.Add(this.ControlButton);
@@ -568,13 +626,16 @@ namespace Netch.Forms
this.MenuStrip.ResumeLayout(false);
this.MenuStrip.PerformLayout();
this.ConfigurationGroupBox.ResumeLayout(false);
this.ConfigurationGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit();
this.configLayoutPanel.ResumeLayout(false);
this.configLayoutPanel.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit();
this.tableLayoutPanel3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit();
this.StatusStrip.ResumeLayout(false);
this.StatusStrip.PerformLayout();
this.NotifyMenu.ResumeLayout(false);
@@ -634,5 +695,8 @@ namespace Netch.Forms
private System.Windows.Forms.PictureBox DeleteModePictureBox;
private System.Windows.Forms.PictureBox CopyLinkPictureBox;
private System.Windows.Forms.ToolStripStatusLabel NatTypeStatusLabel;
private System.Windows.Forms.TableLayoutPanel configLayoutPanel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
}
}

View File

@@ -875,25 +875,28 @@ namespace Netch.Forms
}
State = Models.State.Started;
// 自动检测延迟
Task.Run(() =>
if (Global.Settings.StartedTcping)
{
while (true)
// 自动检测延迟
Task.Run(() =>
{
if (State == Models.State.Started)
while (true)
{
server.Test();
if (State == Models.State.Started)
{
server.Test();
// 重载服务器列表
InitServer();
Thread.Sleep(1000);
Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
}
else
{
break;
}
}
else
{
break;
}
}
});
});
}
}
else
{
@@ -1101,9 +1104,10 @@ namespace Netch.Forms
var num_profile = Global.Settings.ProfileCount;
if (num_profile == 0)
{
ProfileGroupBox.Size = new Size(0,0);
ConfigurationGroupBox.Size -= new Size(0, 30);
this.Size -= new Size(0, 70 + 30);
ProfileGroupBox.Size = new Size(0, 0);
ConfigurationGroupBox.Size -= new Size(0, 25);
this.Size -= new Size(0, 70 + 25);
configLayoutPanel.RowStyles[2].Height = 0;
return;
}
@@ -1250,7 +1254,15 @@ namespace Netch.Forms
if (ServerComboBox.SelectedIndex != -1)
{
var selectedMode = (Models.Server)ServerComboBox.SelectedItem;
Clipboard.SetText(Utils.ShareLink.GetShareLink(selectedMode));
try
{
//听说巨硬BUG经常会炸所以Catch一下 :D
Clipboard.SetText(Utils.ShareLink.GetShareLink(selectedMode));
}
catch (Exception)
{
}
}
else
{

View File

@@ -121,20 +121,18 @@
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="SpeedPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="EditPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAk9JREFUOE9N
k19ojWEcx8+xsRgzbSlaJouGRCNuXIyMXJ1LpVyYFAttqylEsdKQC1yZpF24oJQrN0q5UJKUlP3DWTPz
pzmm2Tk753nf9+fzfd/3nJ2nPr3v8z7P7/d7nu/v+ybMbBUsA703wwk/sKcPJz07POzszOg8HXAKBr55
bLMmWKOgxZCEBfH7zg9/fev55Gw8G9jUXGC/IFMI7HXGt7ZBZ9fGHNtsJVQogYIrQMFVOc8GLn5x4eby
UWB6k8AXU75N5gJ9aoBkMYGqL4JLbHB9bFRA+Xj207Pr0fcbTNtgC1QWE1TC6t/5INvF0UdmwgqlkZ4N
rJvvP3JBmul6OArSrloJ6mAz3H383bMHE6FApZFlqitpbcbZhTnfWrzA9rNUDfVKsAFSY1Q5+9mFopWP
IU6TGnJ2nrXetCslY6hwnRLo/q1XWVTr/iHwdCECQS2PFpl81IUnBLZ+LNit8bALRyA8gTTY0f816vVl
Klwh2UneH5GweJ53076d5pv04SrSQiLWKkEVbFUl9VtItPYRZ6/iVr7549sx5sORuP2wBw5BgxIsgY2w
DVZAlwLVc21/GwdTWRfvhXp4Cbv1rgRrQRbeDge466xaplO8x5FxMEvWCctBRTpgH4RGWgdyoRZuSyiJ
qcrSIQ5+DgtBCXQCuXAphFaWjfVsnMD752iX2tQ5b6g7sAv0w20CiV50b3gCuTDB1ub7mGjvYCF0XRzc
B/rrGkGqK7BYVI5MaFILSdzVdI9WHuRvG42Cj4Mc2g4toEJKUAMZSJlZzX8eY2N9ZDKIEQAAAABJRU5E
rkJggg==
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAg9JREFUOE+F
U81uElEYnTdw58qFunBlYnwAE7e+QhMT38CNcefWxKWufADjiqqtmsZIW2gRulBTY4fGGGmLMFOGn5aB
GYa5c+f4nTsINKF6kkPIxz3nO/f7Llas1IXXGyW8Wi9h+T/kmVx+C7WGA8F14S2LxR8HdfjDAMMwFI7O
YQg/CI14pVDGKIoGYnDZomMgB4gk0VAqgUoWkxjHMd5t7eCkTz2uWIxGd601nHYPR66H+nH7LKXW9LrG
JBrHeL+9g1N/gDRNl4wBoxHhKDJxmWierPG3lGeiaGrQ9DpPjMFADJjA7fSko4ff0nWerDntWQJegQbl
XRsLEiweZMAEEoFn1opl9GXopa97sFaLlWmCY0nAjo2WdCYn3ednIGvHodPCSIw+2z9hrRQqZoWzBLOu
jBvJ1MlYyARK+LGl8LCWYq+vsyvMttA17oduiwOaru4vEhGvdzSuVRUu2THu7KvJDCYJxrHKugr5XdZk
6kSsgWJXo+pr7J5q3K7GeFoXA75EDuRfYOyCdLZFTDhhipyboDsIv2QGg6H5YREorvSyzgTFH7wEnh8g
0frxdAbn4Vs/xYtmNguK10TcCXjF+JmUrlpvNj/lDxqu2cDZFxialb1sKly0FZYl8oZc4yRK+CYeiPie
8IYlH3dz+W3zuub5Vv5x33/V8VwG9aimsCniMEl92dZN0SxRB+D+Hw2grtB8iuYFAAAAAElFTkSuQmCC
</value>
</data>
<data name="DeletePictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -151,18 +149,20 @@
R+QMmWB7l2jP55IkExaBIP+X+VaqtcbLMAynmftgqMOzv61mlBRRiHFjAAAAAElFTkSuQmCC
</value>
</data>
<data name="EditPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="SpeedPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAg9JREFUOE+F
U81uElEYnTdw58qFunBlYnwAE7e+QhMT38CNcefWxKWufADjiqqtmsZIW2gRulBTY4fGGGmLMFOGn5aB
GYa5c+f4nTsINKF6kkPIxz3nO/f7Llas1IXXGyW8Wi9h+T/kmVx+C7WGA8F14S2LxR8HdfjDAMMwFI7O
YQg/CI14pVDGKIoGYnDZomMgB4gk0VAqgUoWkxjHMd5t7eCkTz2uWIxGd601nHYPR66H+nH7LKXW9LrG
JBrHeL+9g1N/gDRNl4wBoxHhKDJxmWierPG3lGeiaGrQ9DpPjMFADJjA7fSko4ff0nWerDntWQJegQbl
XRsLEiweZMAEEoFn1opl9GXopa97sFaLlWmCY0nAjo2WdCYn3ednIGvHodPCSIw+2z9hrRQqZoWzBLOu
jBvJ1MlYyARK+LGl8LCWYq+vsyvMttA17oduiwOaru4vEhGvdzSuVRUu2THu7KvJDCYJxrHKugr5XdZk
6kSsgWJXo+pr7J5q3K7GeFoXA75EDuRfYOyCdLZFTDhhipyboDsIv2QGg6H5YREorvSyzgTFH7wEnh8g
0frxdAbn4Vs/xYtmNguK10TcCXjF+JmUrlpvNj/lDxqu2cDZFxialb1sKly0FZYl8oZc4yRK+CYeiPie
8IYlH3dz+W3zuub5Vv5x33/V8VwG9aimsCniMEl92dZN0SxRB+D+Hw2grtB8iuYFAAAAAElFTkSuQmCC
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAk9JREFUOE9N
k19ojWEcx8+xsRgzbSlaJouGRCNuXIyMXJ1LpVyYFAttqylEsdKQC1yZpF24oJQrN0q5UJKUlP3DWTPz
pzmm2Tk753nf9+fzfd/3nJ2nPr3v8z7P7/d7nu/v+ybMbBUsA703wwk/sKcPJz07POzszOg8HXAKBr55
bLMmWKOgxZCEBfH7zg9/fev55Gw8G9jUXGC/IFMI7HXGt7ZBZ9fGHNtsJVQogYIrQMFVOc8GLn5x4eby
UWB6k8AXU75N5gJ9aoBkMYGqL4JLbHB9bFRA+Xj207Pr0fcbTNtgC1QWE1TC6t/5INvF0UdmwgqlkZ4N
rJvvP3JBmul6OArSrloJ6mAz3H383bMHE6FApZFlqitpbcbZhTnfWrzA9rNUDfVKsAFSY1Q5+9mFopWP
IU6TGnJ2nrXetCslY6hwnRLo/q1XWVTr/iHwdCECQS2PFpl81IUnBLZ+LNit8bALRyA8gTTY0f816vVl
Klwh2UneH5GweJ53076d5pv04SrSQiLWKkEVbFUl9VtItPYRZ6/iVr7549sx5sORuP2wBw5BgxIsgY2w
DVZAlwLVc21/GwdTWRfvhXp4Cbv1rgRrQRbeDge466xaplO8x5FxMEvWCctBRTpgH4RGWgdyoRZuSyiJ
qcrSIQ5+DgtBCXQCuXAphFaWjfVsnMD752iX2tQ5b6g7sAv0w20CiV50b3gCuTDB1ub7mGjvYCF0XRzc
B/rrGkGqK7BYVI5MaFILSdzVdI9WHuRvG42Cj4Mc2g4toEJKUAMZSJlZzX8eY2N9ZDKIEQAAAABJRU5E
rkJggg==
</value>
</data>
<metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -49,8 +49,13 @@
this.ControlButton = new System.Windows.Forms.Button();
this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox();
this.DetectionInterval_Label = new System.Windows.Forms.Label();
this.DetectionInterval_TextBox = new System.Windows.Forms.TextBox();
this.EnableStartedTcping_CheckBox = new System.Windows.Forms.CheckBox();
this.DelayTestAfterStartup_Label = new System.Windows.Forms.Label();
this.BypassModeCheckBox = new System.Windows.Forms.CheckBox();
this.Redirector2checkBox = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.ExperimentalFunction_Label = new System.Windows.Forms.Label();
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
@@ -238,7 +243,7 @@
// ControlButton
//
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ControlButton.Location = new System.Drawing.Point(357, 679);
this.ControlButton.Location = new System.Drawing.Point(781, 356);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.TabIndex = 11;
@@ -249,7 +254,7 @@
// GlobalBypassIPsButton
//
this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 679);
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 356);
this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton";
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23);
this.GlobalBypassIPsButton.TabIndex = 10;
@@ -259,8 +264,13 @@
//
// BehaviorGroupBox
//
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label);
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
this.BehaviorGroupBox.Controls.Add(this.DelayTestAfterStartup_Label);
this.BehaviorGroupBox.Controls.Add(this.BypassModeCheckBox);
this.BehaviorGroupBox.Controls.Add(this.Redirector2checkBox);
this.BehaviorGroupBox.Controls.Add(this.label3);
this.BehaviorGroupBox.Controls.Add(this.ExperimentalFunction_Label);
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox);
this.BehaviorGroupBox.Controls.Add(this.label2);
this.BehaviorGroupBox.Controls.Add(this.label1);
@@ -273,35 +283,82 @@
this.BehaviorGroupBox.Controls.Add(this.StartWhenOpenedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.StopWhenExitedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox);
this.BehaviorGroupBox.Location = new System.Drawing.Point(12, 351);
this.BehaviorGroupBox.Location = new System.Drawing.Point(438, 12);
this.BehaviorGroupBox.Name = "BehaviorGroupBox";
this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 312);
this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 333);
this.BehaviorGroupBox.TabIndex = 8;
this.BehaviorGroupBox.TabStop = false;
this.BehaviorGroupBox.Text = "Behavior";
//
// DetectionInterval_Label
//
this.DetectionInterval_Label.AutoSize = true;
this.DetectionInterval_Label.Location = new System.Drawing.Point(230, 151);
this.DetectionInterval_Label.Name = "DetectionInterval_Label";
this.DetectionInterval_Label.Size = new System.Drawing.Size(128, 17);
this.DetectionInterval_Label.TabIndex = 18;
this.DetectionInterval_Label.Text = "Detection interval(/s)";
//
// DetectionInterval_TextBox
//
this.DetectionInterval_TextBox.Location = new System.Drawing.Point(364, 148);
this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox";
this.DetectionInterval_TextBox.Size = new System.Drawing.Size(47, 23);
this.DetectionInterval_TextBox.TabIndex = 17;
this.DetectionInterval_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// EnableStartedTcping_CheckBox
//
this.EnableStartedTcping_CheckBox.AutoSize = true;
this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(152, 150);
this.EnableStartedTcping_CheckBox.Name = "EnableStartedTcping_CheckBox";
this.EnableStartedTcping_CheckBox.Size = new System.Drawing.Size(66, 21);
this.EnableStartedTcping_CheckBox.TabIndex = 15;
this.EnableStartedTcping_CheckBox.Text = "Enable";
this.EnableStartedTcping_CheckBox.UseVisualStyleBackColor = true;
//
// DelayTestAfterStartup_Label
//
this.DelayTestAfterStartup_Label.AutoSize = true;
this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(6, 151);
this.DelayTestAfterStartup_Label.Name = "DelayTestAfterStartup_Label";
this.DelayTestAfterStartup_Label.Size = new System.Drawing.Size(141, 17);
this.DelayTestAfterStartup_Label.TabIndex = 16;
this.DelayTestAfterStartup_Label.Text = "Delay test after startup";
//
// BypassModeCheckBox
//
this.BypassModeCheckBox.AutoSize = true;
this.BypassModeCheckBox.Location = new System.Drawing.Point(276, 236);
this.BypassModeCheckBox.Name = "BypassModeCheckBox";
this.BypassModeCheckBox.Size = new System.Drawing.Size(135, 21);
this.BypassModeCheckBox.TabIndex = 14;
this.BypassModeCheckBox.Text = "进程代理白名单模式";
this.BypassModeCheckBox.UseVisualStyleBackColor = true;
this.BypassModeCheckBox.CheckedChanged += new System.EventHandler(this.BypassModeCheckBox_CheckedChanged);
//
// Redirector2checkBox
//
this.Redirector2checkBox.AutoSize = true;
this.Redirector2checkBox.Location = new System.Drawing.Point(120, 266);
this.Redirector2checkBox.Location = new System.Drawing.Point(152, 235);
this.Redirector2checkBox.Name = "Redirector2checkBox";
this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21);
this.Redirector2checkBox.TabIndex = 11;
this.Redirector2checkBox.Text = "是否启用2号核心";
this.Redirector2checkBox.UseVisualStyleBackColor = true;
//
// label3
// ExperimentalFunction_Label
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 267);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 17);
this.label3.TabIndex = 13;
this.label3.Text = "实验性功能";
this.ExperimentalFunction_Label.AutoSize = true;
this.ExperimentalFunction_Label.Location = new System.Drawing.Point(6, 236);
this.ExperimentalFunction_Label.Name = "ExperimentalFunction_Label";
this.ExperimentalFunction_Label.Size = new System.Drawing.Size(133, 17);
this.ExperimentalFunction_Label.TabIndex = 13;
this.ExperimentalFunction_Label.Text = "Experimental function";
//
// STUN_ServerPortTextBox
//
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 237);
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(117, 206);
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 23);
this.STUN_ServerPortTextBox.TabIndex = 8;
@@ -310,7 +367,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 243);
this.label2.Location = new System.Drawing.Point(6, 209);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(110, 17);
this.label2.TabIndex = 12;
@@ -319,7 +376,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 214);
this.label1.Location = new System.Drawing.Point(6, 180);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(82, 17);
this.label1.TabIndex = 10;
@@ -328,7 +385,7 @@
// RunAtStartup
//
this.RunAtStartup.AutoSize = true;
this.RunAtStartup.Location = new System.Drawing.Point(120, 130);
this.RunAtStartup.Location = new System.Drawing.Point(12, 75);
this.RunAtStartup.Name = "RunAtStartup";
this.RunAtStartup.Size = new System.Drawing.Size(109, 21);
this.RunAtStartup.TabIndex = 11;
@@ -337,7 +394,7 @@
//
// STUN_ServerTextBox
//
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 211);
this.STUN_ServerTextBox.Location = new System.Drawing.Point(117, 177);
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23);
this.STUN_ServerTextBox.TabIndex = 11;
@@ -346,7 +403,7 @@
// MinimizeWhenStartedCheckBox
//
this.MinimizeWhenStartedCheckBox.AutoSize = true;
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(120, 103);
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(206, 48);
this.MinimizeWhenStartedCheckBox.Name = "MinimizeWhenStartedCheckBox";
this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(158, 21);
this.MinimizeWhenStartedCheckBox.TabIndex = 10;
@@ -356,7 +413,7 @@
// ProfileCount_Label
//
this.ProfileCount_Label.AutoSize = true;
this.ProfileCount_Label.Location = new System.Drawing.Point(9, 185);
this.ProfileCount_Label.Location = new System.Drawing.Point(6, 123);
this.ProfileCount_Label.Name = "ProfileCount_Label";
this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17);
this.ProfileCount_Label.TabIndex = 8;
@@ -364,16 +421,16 @@
//
// ProfileCount_TextBox
//
this.ProfileCount_TextBox.Location = new System.Drawing.Point(222, 182);
this.ProfileCount_TextBox.Location = new System.Drawing.Point(203, 120);
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
this.ProfileCount_TextBox.Size = new System.Drawing.Size(192, 23);
this.ProfileCount_TextBox.Size = new System.Drawing.Size(208, 23);
this.ProfileCount_TextBox.TabIndex = 9;
this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// CheckUpdateWhenOpenedCheckBox
//
this.CheckUpdateWhenOpenedCheckBox.AutoSize = true;
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(120, 157);
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(206, 75);
this.CheckUpdateWhenOpenedCheckBox.Name = "CheckUpdateWhenOpenedCheckBox";
this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(190, 21);
this.CheckUpdateWhenOpenedCheckBox.TabIndex = 8;
@@ -384,7 +441,7 @@
// StartWhenOpenedCheckBox
//
this.StartWhenOpenedCheckBox.AutoSize = true;
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(120, 76);
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(12, 48);
this.StartWhenOpenedCheckBox.Name = "StartWhenOpenedCheckBox";
this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(137, 21);
this.StartWhenOpenedCheckBox.TabIndex = 7;
@@ -395,7 +452,7 @@
// StopWhenExitedCheckBox
//
this.StopWhenExitedCheckBox.AutoSize = true;
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(120, 49);
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(206, 22);
this.StopWhenExitedCheckBox.Name = "StopWhenExitedCheckBox";
this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(127, 21);
this.StopWhenExitedCheckBox.TabIndex = 6;
@@ -406,7 +463,7 @@
// ExitWhenClosedCheckBox
//
this.ExitWhenClosedCheckBox.AutoSize = true;
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(120, 22);
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(12, 21);
this.ExitWhenClosedCheckBox.Name = "ExitWhenClosedCheckBox";
this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(123, 21);
this.ExitWhenClosedCheckBox.TabIndex = 5;
@@ -418,7 +475,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(444, 713);
this.ClientSize = new System.Drawing.Size(868, 390);
this.Controls.Add(this.BehaviorGroupBox);
this.Controls.Add(this.PortGroupBox);
this.Controls.Add(this.GlobalBypassIPsButton);
@@ -479,6 +536,11 @@
private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
private System.Windows.Forms.CheckBox TUNTAPProxyDNSCheckBox;
private System.Windows.Forms.CheckBox Redirector2checkBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label ExperimentalFunction_Label;
private System.Windows.Forms.CheckBox BypassModeCheckBox;
private System.Windows.Forms.TextBox DetectionInterval_TextBox;
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
private System.Windows.Forms.Label DetectionInterval_Label;
}
}

View File

@@ -63,6 +63,9 @@ namespace Netch.Forms
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;
RunAtStartup.Checked = Global.Settings.RunAtStartup;
Redirector2checkBox.Checked = Global.Settings.UseRedirector2;
BypassModeCheckBox.Checked = Global.Settings.ProcessBypassMode;
EnableStartedTcping_CheckBox.Checked = Global.Settings.StartedTcping;
DetectionInterval_TextBox.Text = Global.Settings.StartedTcping_Interval.ToString();
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
@@ -82,6 +85,11 @@ namespace Netch.Forms
RunAtStartup.Text = Utils.i18N.Translate(RunAtStartup.Text);
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text);
ExperimentalFunction_Label.Text = Utils.i18N.Translate(ExperimentalFunction_Label.Text);
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
EnableStartedTcping_CheckBox.Text = Utils.i18N.Translate(EnableStartedTcping_CheckBox.Text);
DetectionInterval_Label.Text = Utils.i18N.Translate(DetectionInterval_Label.Text);
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
@@ -146,6 +154,8 @@ namespace Netch.Forms
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
Global.Settings.RunAtStartup = RunAtStartup.Checked;
Global.Settings.UseRedirector2 = Redirector2checkBox.Checked;
Global.Settings.ProcessBypassMode = BypassModeCheckBox.Checked;
Global.Settings.StartedTcping = EnableStartedTcping_CheckBox.Checked;
// 开机自启判断
TaskSchedulerClass scheduler = new TaskSchedulerClass();
@@ -312,6 +322,28 @@ namespace Netch.Forms
return;
}
try
{
Global.Settings.StartedTcping = EnableStartedTcping_CheckBox.Checked;
var DetectionInterval = int.Parse(DetectionInterval_TextBox.Text);
if (DetectionInterval > 0)
{
Global.Settings.StartedTcping_Interval = DetectionInterval;
}
else
{
throw new FormatException();
}
}
catch (FormatException)
{
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
MessageBox.Show(Utils.i18N.Translate("STUN_ServerPort value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text;
Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text;
@@ -331,5 +363,18 @@ namespace Netch.Forms
Close();
}
private void BypassModeCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (BypassModeCheckBox.Checked)
{
Redirector2checkBox.Checked = false;
Redirector2checkBox.Enabled = false;
}
else
{
Redirector2checkBox.Enabled = true;
}
}
}
}

View File

@@ -147,16 +147,31 @@ namespace Netch.Models
/// <summary>
/// STUN测试服务器
/// </summary>
public string STUN_Server = "stun.stunprotocol.org";
public string STUN_Server = "stun.l.google.com";
/// <summary>
/// STUN测试服务器
/// </summary>
public int STUN_Server_Port = 3478;
public int STUN_Server_Port = 19302;
/// <summary>
/// 是否切换为2号核心
/// </summary>
public bool UseRedirector2 = false;
/// <summary>
/// 是否启用进程代理白名单模式
/// </summary>
public bool ProcessBypassMode = false;
/// <summary>
/// 是否启用启动后延迟测试
/// </summary>
public bool StartedTcping = false;
/// <summary>
/// 启动后延迟测试间隔/秒
/// </summary>
public int StartedTcping_Interval = 3;
}
}

View File

@@ -73,6 +73,10 @@
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NetchLib\NetchLib.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />

View File

@@ -8,8 +8,8 @@ namespace Netch.Override
protected override WebRequest GetWebRequest(Uri address)
{
var request = base.GetWebRequest(address);
request.Timeout = 4000;
((HttpWebRequest)request).ReadWriteTimeout = 4000;
request.Timeout = 10000;
((HttpWebRequest)request).ReadWriteTimeout = 10000;
return request;
}

View File

@@ -153,6 +153,10 @@
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
"STUN_ServerPort value illegal. Try again.": "STUN端口数值非法。请重试。",
"TUN/TAP driver is not detected. Is it installed now?": "未检测到TUN/TAP驱动是否现在安装",
"Experimental function": "实验性功能",
"Delay test after startup": "启动后延迟测试",
"Enable": "启用",
"Detection interval(/s)": "检测间隔(/秒)",
"Profile": "配置名",
"Profiles": "配置",

View File

@@ -290,80 +290,88 @@ namespace Netch.Utils
}
else if (text.StartsWith("ssr://"))
{
var data = new Server();
data.Type = "SSR";
text = text.Substring(6);
list.Add(SsrServerFromLink(text));
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
var match = parser.Match(URLSafeBase64Decode(text));
/* var data = new Server();
data.Type = "SSR";
if (match.Success)
{
data.Hostname = match.Groups["server"].Value;
data.Port = int.Parse(match.Groups["port"].Value);
if (data.Port < 0)
{
data.Port += 65536;
}
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
text = text.Substring(6);
data.EncryptMethod = match.Groups["method"].Value;
if (!Global.EncryptMethods.SSR.Contains(data.EncryptMethod))
{
Logging.Info(string.Format("不支持的 SSR 加密方式:{0}", data.EncryptMethod));
return null;
}
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
var parser2 = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/$");
var match = parser2.Match(URLSafeBase64Decode(text));
if (!match.Success)
{
match = parser2.Match(UnBase64String(text));
}
data.Protocol = match.Groups["protocol"].Value;
if (!Global.Protocols.Contains(data.Protocol))
{
Logging.Info(string.Format("不支持的 SSR 协议:{0}", data.Protocol));
return null;
}
if (match.Success)
{
data.Hostname = match.Groups["server"].Value;
data.Port = int.Parse(match.Groups["port"].Value);
if (data.Port < 0)
{
data.Port += 65536;
}
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
data.OBFS = match.Groups["obfs"].Value;
if (data.OBFS == @"tls1.2_ticket_fastauth")
{
data.OBFS = @"tls1.2_ticket_auth";
}
if (!Global.OBFSs.Contains(data.OBFS))
{
Logging.Info(string.Format("不支持的 SSR 混淆:{0}", data.OBFS));
return null;
}
data.EncryptMethod = match.Groups["method"].Value;
if (!Global.EncryptMethods.SSR.Contains(data.EncryptMethod))
{
Logging.Info(string.Format("不支持的 SSR 加密方式:{0}", data.EncryptMethod));
return null;
}
var info = match.Groups["info"].Value;
var dict = new Dictionary<string, string>();
foreach (var str in info.Split('&'))
{
var splited = str.Split('=');
dict.Add(splited[0], splited[1]);
}
data.Protocol = match.Groups["protocol"].Value;
if (!Global.Protocols.Contains(data.Protocol))
{
Logging.Info(string.Format("不支持的 SSR 协议:{0}", data.Protocol));
return null;
}
if (dict.ContainsKey("remarks"))
{
data.Remark = URLSafeBase64Decode(dict["remarks"]);
}
data.OBFS = match.Groups["obfs"].Value;
if (data.OBFS == @"tls1.2_ticket_fastauth")
{
data.OBFS = @"tls1.2_ticket_auth";
}
if (!Global.OBFSs.Contains(data.OBFS))
{
Logging.Info(string.Format("不支持的 SSR 混淆:{0}", data.OBFS));
return null;
}
if (dict.ContainsKey("protoparam"))
{
data.ProtocolParam = URLSafeBase64Decode(dict["protoparam"]);
}
var info = match.Groups["info"].Value;
var dict = new Dictionary<string, string>();
foreach (var str in info.Split('&'))
{
var splited = str.Split('=');
dict.Add(splited[0], splited[1]);
}
if (dict.ContainsKey("obfsparam"))
{
data.OBFSParam = URLSafeBase64Decode(dict["obfsparam"]);
}
if (dict.ContainsKey("remarks"))
{
data.Remark = URLSafeBase64Decode(dict["remarks"]);
}
if (Global.EncryptMethods.SS.Contains(data.EncryptMethod) && data.Protocol == "origin" && data.OBFS == "plain")
{
data.OBFS = "";
data.Type = "SS";
}
}
if (dict.ContainsKey("protoparam"))
{
data.ProtocolParam = URLSafeBase64Decode(dict["protoparam"]);
}
if (dict.ContainsKey("obfsparam"))
{
data.OBFSParam = URLSafeBase64Decode(dict["obfsparam"]);
}
if (Global.EncryptMethods.SS.Contains(data.EncryptMethod) && data.Protocol == "origin" && data.OBFS == "plain")
{
data.OBFS = "";
data.Type = "SS";
}
list.Add(data);
}*/
list.Add(data);
}
else if (text.StartsWith("vmess://"))
{
@@ -517,5 +525,123 @@ namespace Netch.Utils
return list;
}
public static string UnBase64String(string value)
{
if (value == null || value == "")
{
return "";
}
byte[] bytes = Convert.FromBase64String(value);
return Encoding.UTF8.GetString(bytes);
}
public static string ToBase64String(string value)
{
if (value == null || value == "")
{
return "";
}
byte[] bytes = Encoding.UTF8.GetBytes(value);
return Convert.ToBase64String(bytes);
}
/// <summary>
/// SSR链接解析器
/// Copy From https://github.com/HMBSbige/ShadowsocksR-Windows/blob/d9dc8d032a6e04c14b9dc6c8f673c9cc5aa9f607/shadowsocks-csharp/Model/Server.cs#L428
/// Thx :D
/// </summary>
/// <param name="ssrUrl"></param>
/// <returns></returns>
public static Server SsrServerFromLink(string ssrUrl)
{
// ssr://host:port:protocol:method:obfs:base64pass/?obfsparam=base64&remarks=base64&group=base64&udpport=0&uot=1
var ssr = Regex.Match(ssrUrl, "ssr://([A-Za-z0-9_-]+)", RegexOptions.IgnoreCase);
if (!ssr.Success)
throw new FormatException();
var data = URLSafeBase64Decode(ssr.Groups[1].Value);
var params_dict = new Dictionary<string, string>();
var param_start_pos = data.IndexOf("?", StringComparison.Ordinal);
if (param_start_pos > 0)
{
params_dict = ParseParam(data.Substring(param_start_pos + 1));
data = data.Substring(0, param_start_pos);
}
if (data.IndexOf("/", StringComparison.Ordinal) >= 0)
{
data = data.Substring(0, data.LastIndexOf("/", StringComparison.Ordinal));
}
var UrlFinder = new Regex("^(.+):([^:]+):([^:]*):([^:]+):([^:]*):([^:]+)");
var match = UrlFinder.Match(data);
if (match == null || !match.Success)
throw new FormatException();
var serverAddr = match.Groups[1].Value;
var Server_Port = ushort.Parse(match.Groups[2].Value);
var Protocol = match.Groups[3].Value.Length == 0 ? "origin" : match.Groups[3].Value;
Protocol = Protocol.Replace("_compatible", "");
var Method = match.Groups[4].Value;
var obfs = match.Groups[5].Value.Length == 0 ? "plain" : match.Groups[5].Value;
obfs = obfs.Replace("_compatible", "");
var Password = URLSafeBase64Decode(match.Groups[6].Value);
var ProtocolParam = "";
var ObfsParam = "";
var Remarks = "";
var Group = "";
if (params_dict.ContainsKey("protoparam"))
{
ProtocolParam = URLSafeBase64Decode(params_dict["protoparam"]);
}
if (params_dict.ContainsKey("obfsparam"))
{
ObfsParam = URLSafeBase64Decode(params_dict["obfsparam"]);
}
if (params_dict.ContainsKey("remarks"))
{
Remarks = URLSafeBase64Decode(params_dict["remarks"]);
}
Group = params_dict.ContainsKey("group") ? URLSafeBase64Decode(params_dict["group"]) : string.Empty;
/*if (params_dict.ContainsKey("uot"))
{
UdpOverTcp = int.Parse(params_dict["uot"]) != 0;
}
if (params_dict.ContainsKey("udpport"))
{
Server_Udp_Port = ushort.Parse(params_dict["udpport"]);
}*/
Server server = new Server();
server.Type = "SSR";
server.Hostname = serverAddr;
server.Port = Server_Port;
server.Protocol = Protocol;
server.EncryptMethod = Method;
server.OBFS = obfs;
server.Password = Password;
server.ProtocolParam = ProtocolParam;
server.OBFSParam = ObfsParam;
server.Remark = Remarks;
server.Group = Group;
return server;
}
private static Dictionary<string, string> ParseParam(string paramStr)
{
var paramsDict = new Dictionary<string, string>();
var obfsParams = paramStr.Split('&');
foreach (var p in obfsParams)
{
if (p.IndexOf('=') > 0)
{
var index = p.IndexOf('=');
var key = p.Substring(0, index);
var val = p.Substring(index + 1);
paramsDict[key] = val;
}
}
return paramsDict;
}
}
}

3
NetchLib/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/bin
/obj
/NetchLib.csproj.user

67
NetchLib/NetchLib.csproj Normal file
View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Platforms>x86;x64</Platforms>
<ProjectGuid>{A8715AF4-ACC6-43F9-9381-4294C5360623}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NetchLib</RootNamespace>
<AssemblyName>NetchLib</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<NoWarn />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SearchComboBox.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetchLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetchLib")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a8715af4-acc6-43f9-9381-4294c5360623")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

2
modes

Submodule modes updated: b1366d48be...de2c3c7cf1