Compare commits

...

22 Commits
1.3.5 ... 1.3.6

Author SHA1 Message Date
Connection Refused
ec75fa54a4 Version 1.3.6 released 2020-01-14 22:55:59 +08:00
Connection Refused
1af18d12c2 Merge pull request #234 from chsbuffer/master
Exception handling & Update translation.
2020-01-14 22:17:57 +08:00
ChsBuffer
175d28e9c4 Exception handling & Update translation.
Signed-off-by: ChsBuffer <33744752+chsbuffer@users.noreply.github.com>
2020-01-14 22:07:04 +08:00
Andy1999
9a717e03ed change sponsor's link 2020-01-13 16:14:37 +08:00
Andy1999
eed6f84800 add sponsor 2020-01-13 16:09:29 +08:00
Connection Refused
a513f27904 Optimize TUN/TAP network card priority processing 2020-01-12 13:44:20 +08:00
Tindy X
d64497ff80 Update submodule 2020-01-12 01:00:12 +08:00
Tindy X
077d6caffb Update submodule 2020-01-12 00:26:19 +08:00
Connection Refused
4e1ae34f30 Merge pull request #233 from chsbuffer/master
Fix some problems of saving selected index
2020-01-12 00:20:06 +08:00
ChsBuffer
ad193a03d7 Fix some problems of saving selected index
Signed-off-by: ChsBuffer <33744752+chsbuffer@users.noreply.github.com>
2020-01-11 06:51:16 +08:00
Connection Refused
9ef7b99aa2 Optimize GUI 2020-01-09 22:28:24 +08:00
Connection Refused
a868241b6c Update submodule 2020-01-09 22:21:58 +08:00
Connection Refused
b2288817a0 Merge pull request #232 from 54Pany/master
Enhance tun/tap interface metric and fix dns server bug
2020-01-07 23:59:34 +08:00
anonymous
591a4be34d Enhance tun/tap interface metric and fix dns server bug 2020-01-07 23:29:46 +08:00
Connection Refused
74a748e0cf Merge pull request #231 from henning724/master
A simple profile UI which enables you to swtich to different profiles quickly
2020-01-04 18:50:09 +08:00
henning
6eca1085b2 A simple profile UI which enables you to swtich to different profiles quickly.
1. It will enable the UI sooner after you click the "Stop" button, allowing you to switch mode/server much sooner.

2. Adds a Profile UI which allows you to Ctrl+Click to save a profile and Click to switch to a profile.
2020-01-01 20:08:57 +08:00
Connection Refused
b57fb5c77a Merge pull request #230 from zyc199847/v2ray-mux-support
Try to fix v2ray mux issue
2019-12-21 00:01:32 +08:00
Jason
42c3bfa45e Try to fix v2ray mux issue 2019-12-20 23:14:07 +08:00
Connection Refused
365fd609be Update submodule 2019-12-16 20:34:12 +08:00
Tindy X
838a3b34d8 Fix VMess TLS settings 2019-12-09 13:31:55 +08:00
Connection Refused
185c60f509 Merge pull request #225 from ChickenSeller/bugfix_sublink
Suport negative port number in SSR sublink
2019-12-05 23:28:10 +08:00
Kaguya
5eb19586de Bugfix: minus port support 2019-12-05 23:51:19 +09:00
29 changed files with 608 additions and 186 deletions

View File

@@ -100,6 +100,20 @@ namespace Netch.Controllers
if (SavedMode.Type == 2) // 处理仅规则内走直连
{
// 将 TUN/TAP 网卡权重放到最高
var instance = new Process()
{
StartInfo =
{
FileName = String.Format("netsh"),
Arguments = String.Format("interface ip set interface {0} metric=0", Global.TUNTAP.Index),
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = true,
CreateNoWindow = true
}
};
instance.Start();
// 创建默认路由
if (!NativeMethods.CreateRoute("0.0.0.0", 0, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index, 10))
{
@@ -336,7 +350,8 @@ namespace Netch.Controllers
Instance.Kill();
}
pDNSController.Stop();
//pDNSController.Stop();
//修复点击停止按钮后再启动DNS服务没监听的BUG
ClearBypass();
}
catch (Exception e)

View File

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

View File

@@ -115,8 +115,15 @@ namespace Netch.Controllers
path = server.Path == "" ? "/" : server.Path
} : null,
tlsSettings = new Models.Information.VMess.TLSSettings()
{
allowInsecure = true,
serverName = server.Host == "" ? server.Hostname : server.Host
}
},
mux = new Models.Information.VMess.OutboundMux()
{
enabled = server.UseMux
}
},
new Models.Information.VMess.Outbounds()
{

View File

@@ -13,9 +13,9 @@ namespace Netch.Forms
private void AboutForm_Load(object sender, EventArgs e)
{
Text = Utils.i18N.Translate("About");
ChannelLabel.Text = Utils.i18N.Translate("Telegram Channel");
SponsorGroupBox.Text = Utils.i18N.Translate("Sponsor");
Text = Utils.i18N.Translate(Text);
ChannelLabel.Text = Utils.i18N.Translate(ChannelLabel.Text);
SponsorGroupBox.Text = Utils.i18N.Translate(SponsorGroupBox.Text);
}
private void AboutForm_FormClosing(object sender, FormClosingEventArgs e)

View File

@@ -13,10 +13,10 @@ namespace Netch.Forms
private void GlobalBypassIPForm_Load(object sender, EventArgs e)
{
Text = Utils.i18N.Translate("Global Bypass IPs");
AddButton.Text = Utils.i18N.Translate("Add");
DeleteButton.Text = Utils.i18N.Translate("Delete");
ControlButton.Text = Utils.i18N.Translate("Save");
Text = Utils.i18N.Translate(Text);
AddButton.Text = Utils.i18N.Translate(AddButton.Text);
DeleteButton.Text = Utils.i18N.Translate(DeleteButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
IPListBox.Items.AddRange(Global.Settings.BypassIPs.ToArray());

View File

@@ -50,6 +50,8 @@
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
this.ProfileNameText = new System.Windows.Forms.TextBox();
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();
@@ -68,6 +70,8 @@
this.ShowMainFormToolStripButton = new System.Windows.Forms.ToolStripMenuItem();
this.ExitToolStripButton = new System.Windows.Forms.ToolStripMenuItem();
this.SettingsButton = new System.Windows.Forms.Button();
this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
this.MenuStrip.SuspendLayout();
this.ConfigurationGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
@@ -75,6 +79,7 @@
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit();
this.StatusStrip.SuspendLayout();
this.NotifyMenu.SuspendLayout();
this.ProfileGroupBox.SuspendLayout();
this.SuspendLayout();
//
// MenuStrip
@@ -240,12 +245,14 @@
this.VersionLabel.IsLink = true;
this.VersionLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
this.VersionLabel.Name = "VersionLabel";
this.VersionLabel.Size = new System.Drawing.Size(35, 19);
this.VersionLabel.Size = new System.Drawing.Size(32, 19);
this.VersionLabel.Text = "x.x.x";
this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click);
//
// ConfigurationGroupBox
//
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);
@@ -255,11 +262,27 @@
this.ConfigurationGroupBox.Controls.Add(this.ServerLabel);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 28);
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
this.ConfigurationGroupBox.Size = new System.Drawing.Size(584, 86);
this.ConfigurationGroupBox.Size = new System.Drawing.Size(584, 113);
this.ConfigurationGroupBox.TabIndex = 1;
this.ConfigurationGroupBox.TabStop = false;
this.ConfigurationGroupBox.Text = "Configuration";
//
// ProfileNameText
//
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(84, 17);
this.ProfileLabel.TabIndex = 10;
this.ProfileLabel.Text = "Profile";
//
// SpeedPictureBox
//
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
@@ -344,7 +367,7 @@
this.UsedBandwidthLabel,
this.DownloadSpeedLabel,
this.UploadSpeedLabel});
this.StatusStrip.Location = new System.Drawing.Point(0, 154);
this.StatusStrip.Location = new System.Drawing.Point(0, 254);
this.StatusStrip.Name = "StatusStrip";
this.StatusStrip.Size = new System.Drawing.Size(608, 22);
this.StatusStrip.SizingGrip = false;
@@ -380,7 +403,7 @@
//
// ControlButton
//
this.ControlButton.Location = new System.Drawing.Point(521, 120);
this.ControlButton.Location = new System.Drawing.Point(521, 219);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 27);
this.ControlButton.TabIndex = 3;
@@ -422,19 +445,46 @@
//
// SettingsButton
//
this.SettingsButton.Location = new System.Drawing.Point(12, 120);
this.SettingsButton.Location = new System.Drawing.Point(12, 219);
this.SettingsButton.Name = "SettingsButton";
this.SettingsButton.Size = new System.Drawing.Size(72, 24);
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);
//
// ProfileGroupBox
//
this.ProfileGroupBox.Controls.Add(this.ProfileTable);
this.ProfileGroupBox.Location = new System.Drawing.Point(12, 147);
this.ProfileGroupBox.Name = "ProfileGroupBox";
this.ProfileGroupBox.Size = new System.Drawing.Size(584, 65);
this.ProfileGroupBox.TabIndex = 13;
this.ProfileGroupBox.TabStop = false;
this.ProfileGroupBox.Text = "Profiles";
//
// ProfileTable
//
this.ProfileTable.AutoSize = true;
this.ProfileTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ProfileTable.ColumnCount = 2;
this.ProfileTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.ProfileTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.ProfileTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProfileTable.Location = new System.Drawing.Point(3, 19);
this.ProfileTable.Name = "ProfileTable";
this.ProfileTable.RowCount = 1;
this.ProfileTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.ProfileTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.ProfileTable.Size = new System.Drawing.Size(578, 43);
this.ProfileTable.TabIndex = 0;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(608, 176);
this.ClientSize = new System.Drawing.Size(608, 276);
this.Controls.Add(this.ProfileGroupBox);
this.Controls.Add(this.SettingsButton);
this.Controls.Add(this.ControlButton);
this.Controls.Add(this.StatusStrip);
@@ -460,6 +510,8 @@
this.StatusStrip.ResumeLayout(false);
this.StatusStrip.PerformLayout();
this.NotifyMenu.ResumeLayout(false);
this.ProfileGroupBox.ResumeLayout(false);
this.ProfileGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -505,5 +557,9 @@
private System.Windows.Forms.ToolStripStatusLabel UploadSpeedLabel;
private System.Windows.Forms.ToolStripStatusLabel DownloadSpeedLabel;
private System.Windows.Forms.ToolStripMenuItem CleanDNSCacheToolStripMenuItem;
private System.Windows.Forms.Label ProfileLabel;
private System.Windows.Forms.TextBox ProfileNameText;
private System.Windows.Forms.GroupBox ProfileGroupBox;
private System.Windows.Forms.TableLayoutPanel ProfileTable;
}
}

View File

@@ -38,6 +38,8 @@ namespace Netch.Forms
/// </summary>
public bool IsFirstOpened = true;
public List<Button> ProfileButtons = new List<Button>();
public MainForm()
{
InitializeComponent();
@@ -202,6 +204,13 @@ namespace Netch.Forms
SelectLastMode();
}
private void SaveConfigs()
{
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.SelectedIndex;
Utils.Configuration.Save();
}
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
{
var cbx = sender as ComboBox;
@@ -272,32 +281,36 @@ namespace Netch.Forms
InitMode();
// 加载翻译
ServerToolStripMenuItem.Text = Utils.i18N.Translate("Server");
ImportServersFromClipboardToolStripMenuItem.Text = Utils.i18N.Translate("Import Servers From Clipboard");
AddSocks5ServerToolStripMenuItem.Text = Utils.i18N.Translate("Add [Socks5] Server");
AddShadowsocksServerToolStripMenuItem.Text = Utils.i18N.Translate("Add [Shadowsocks] Server");
AddShadowsocksRServerToolStripMenuItem.Text = Utils.i18N.Translate("Add [ShadowsocksR] Server");
AddVMessServerToolStripMenuItem.Text = Utils.i18N.Translate("Add [VMess] Server");
ModeToolStripMenuItem.Text = Utils.i18N.Translate("Mode");
CreateProcessModeToolStripMenuItem.Text = Utils.i18N.Translate("Create Process Mode");
SubscribeToolStripMenuItem.Text = Utils.i18N.Translate("Subscribe");
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate("Manage Subscribe Links");
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate("Update Servers From Subscribe Links");
OptionsToolStripMenuItem.Text = Utils.i18N.Translate("Options");
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate("Restart Service");
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate("Uninstall Service");
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate("Reload Modes");
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate("Clean DNS Cache");
AboutToolStripButton.Text = Utils.i18N.Translate("About");
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
ServerLabel.Text = Utils.i18N.Translate("Server");
ModeLabel.Text = Utils.i18N.Translate("Mode");
SettingsButton.Text = Utils.i18N.Translate("Settings");
ControlButton.Text = Utils.i18N.Translate("Start");
ServerToolStripMenuItem.Text = Utils.i18N.Translate(ServerToolStripMenuItem.Text);
ImportServersFromClipboardToolStripMenuItem.Text = Utils.i18N.Translate(ImportServersFromClipboardToolStripMenuItem.Text);
AddSocks5ServerToolStripMenuItem.Text = Utils.i18N.Translate(AddSocks5ServerToolStripMenuItem.Text);
AddShadowsocksServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksServerToolStripMenuItem.Text);
AddShadowsocksRServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksRServerToolStripMenuItem.Text);
AddVMessServerToolStripMenuItem.Text = Utils.i18N.Translate(AddVMessServerToolStripMenuItem.Text);
ModeToolStripMenuItem.Text = Utils.i18N.Translate(ModeToolStripMenuItem.Text);
CreateProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(CreateProcessModeToolStripMenuItem.Text);
SubscribeToolStripMenuItem.Text = Utils.i18N.Translate(SubscribeToolStripMenuItem.Text);
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text);
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text);
OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text);
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text);
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text);
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text);
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text);
AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text);
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text);
ModeLabel.Text = Utils.i18N.Translate(ModeLabel.Text);
ProfileLabel.Text = Utils.i18N.Translate(ProfileLabel.Text);
ProfileGroupBox.Text = Utils.i18N.Translate(ProfileGroupBox.Text);
SettingsButton.Text = Utils.i18N.Translate(SettingsButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
UsedBandwidthLabel.Text = $@"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}0 KB";
StatusLabel.Text = $@"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}";
ShowMainFormToolStripButton.Text = Utils.i18N.Translate("Show");
ExitToolStripButton.Text = Utils.i18N.Translate("Exit");
ShowMainFormToolStripButton.Text = Utils.i18N.Translate(ShowMainFormToolStripButton.Text);
ExitToolStripButton.Text = Utils.i18N.Translate(ExitToolStripButton.Text);
InitProfile();
// 自动检测延迟
Task.Run(() =>
@@ -626,6 +639,7 @@ namespace Netch.Forms
private void ReloadModesToolStripMenuItem_Click(object sender, EventArgs e)
{
Enabled = false;
SaveConfigs();
Task.Run(() =>
{
InitMode();
@@ -655,6 +669,7 @@ namespace Netch.Forms
private void EditPictureBox_Click(object sender, EventArgs e)
{
SaveConfigs();
// 当前ServerComboBox中至少有一项
if (ServerComboBox.SelectedIndex != -1)
{
@@ -753,7 +768,8 @@ namespace Netch.Forms
MainController = new MainController();
if (MainController.Start(server, mode))
{
if (mode.Type == 0)
//if (mode.Type == 0)
if (false)
{
UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = true;
MainController.pNFController.OnBandwidthUpdated += OnBandwidthUpdated;
@@ -821,6 +837,10 @@ namespace Netch.Forms
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Stopping")}";
State = Models.State.Stopping;
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = SettingsButton.Enabled = true;
ProfileGroupBox.Enabled = false;
Task.Run(() =>
{
var server = ServerComboBox.SelectedItem as Models.Server;
@@ -828,7 +848,8 @@ namespace Netch.Forms
MainController.Stop();
if (mode.Type == 0)
//if (mode.Type == 0)
if (false)
{
LastUploadBandwidth = 0;
LastDownloadBandwidth = 0;
@@ -838,7 +859,9 @@ namespace Netch.Forms
UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = false;
}
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = true;
ControlButton.Enabled = true;
ProfileGroupBox.Enabled = true;
ControlButton.Text = Utils.i18N.Translate("Start");
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Stopped")}";
State = Models.State.Stopped;
@@ -885,9 +908,7 @@ namespace Netch.Forms
}
}
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.SelectedIndex;
Utils.Configuration.Save();
SaveConfigs();
State = Models.State.Terminating;
NotifyIcon.Visible = false;
@@ -930,5 +951,166 @@ namespace Netch.Forms
LastDownloadBandwidth = download;
Refresh();
}
private void ProfileButton_Click(object sender, EventArgs e)
{
int index = ProfileButtons.IndexOf((Button)sender);
//Utils.Logging.Info(String.Format("Button no.{0} clicked", index));
if (Control.ModifierKeys == Keys.Control)
{
if (ServerComboBox.SelectedIndex == -1)
{
MessageBox.Show(Utils.i18N.Translate("Please select a server first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else if (ModeComboBox.SelectedIndex == -1)
{
MessageBox.Show(Utils.i18N.Translate("Please select an mode first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
SaveProfile(index);
ProfileButtons[index].Text = ProfileNameText.Text;
}
}
else
{
try
{
ProfileNameText.Text = LoadProfile(index);
// start the profile
bool need2ndStart = true;
if (State == Models.State.Waiting || State == Models.State.Stopped)
{
need2ndStart = false;
}
ControlButton.PerformClick();
if (need2ndStart)
{
Task.Run(() =>
{
while (State != Models.State.Stopped)
{
Thread.Sleep(200);
}
ControlButton.PerformClick();
});
}
}
catch (Exception ee)
{
Task.Run(() =>
{
Utils.Logging.Info(ee.Message);
ProfileButtons[index].Text = Utils.i18N.Translate("Error");
Thread.Sleep(1200);
ProfileButtons[index].Text = Utils.i18N.Translate("None");
});
}
}
}
public void InitProfile()
{
int num_profile = 4;
ProfileTable.ColumnCount = num_profile;
while (Global.Settings.profiles.Count < num_profile)
{
Global.Settings.profiles.Add(new Models.Profile());
}
// buttons
for (int i = 0; i < num_profile; ++i)
{
var b = new Button();
ProfileTable.Controls.Add(b, i, 0);
b.Location = new Point(i * 100, 0);
b.Click += new EventHandler(ProfileButton_Click);
b.Dock = DockStyle.Fill;
b.Text = "None";
ProfileButtons.Add(b);
if (!Global.Settings.profiles[i].IsDummy)
{
b.Text = Global.Settings.profiles[i].ProfileName;
}
else
{
b.Text = Utils.i18N.Translate(b.Text);
}
}
// equal column
this.ProfileTable.ColumnStyles.Clear();
for (int i = 1; i <= this.ProfileTable.RowCount; i++)
{
ProfileTable.RowStyles.Add(new RowStyle(SizeType.Percent, 1));
}
for (int i = 1; i <= this.ProfileTable.ColumnCount; i++)
{
ProfileTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1));
}
}
private String LoadProfile(int index)
{
Models.Profile p = Global.Settings.profiles[index];
if (p.IsDummy)
throw new Exception("Profile not found.");
bool result = false;
foreach (Models.Server server in ServerComboBox.Items)
{
if (server.Remark.Equals(p.ServerRemark))
{
ServerComboBox.SelectedItem = server;
result = true;
break;
}
}
if (!result)
throw new Exception("Server not found.");
result = false;
foreach (Models.Mode mode in ModeComboBox.Items)
{
if (mode.Remark.Equals(p.ModeRemark))
{
ModeComboBox.SelectedItem = mode;
result = true;
break;
}
}
if (!result)
throw new Exception("Mode not found.");
return p.ProfileName;
}
private void SaveProfile(int index)
{
var selectedServer = (Models.Server)ServerComboBox.SelectedItem;
var selectedMode = (Models.Mode)ModeComboBox.SelectedItem;
String name = ProfileNameText.Text;
Global.Settings.profiles[index] = new Models.Profile(selectedServer, selectedMode, name);
}
}
}

View File

@@ -54,16 +54,16 @@ namespace Netch.Forms.Mode
private void ModeForm_Load(object sender, EventArgs e)
{
Text = Utils.i18N.Translate("Create Process Mode");
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
RemarkLabel.Text = Utils.i18N.Translate("Remark");
FilenameLabel.Text = Utils.i18N.Translate("Filename");
UseCustomFilenameBox.Text = Utils.i18N.Translate("Use Custom Filename");
StaySameButton.Text = Utils.i18N.Translate("Stay the same");
TimeDataButton.Text = Utils.i18N.Translate("Time data");
AddButton.Text = Utils.i18N.Translate("Add");
ScanButton.Text = Utils.i18N.Translate("Scan");
ControlButton.Text = Utils.i18N.Translate("Save");
Text = Utils.i18N.Translate(Text);
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
FilenameLabel.Text = Utils.i18N.Translate(FilenameLabel.Text);
UseCustomFilenameBox.Text = Utils.i18N.Translate(UseCustomFilenameBox.Text);
StaySameButton.Text = Utils.i18N.Translate(StaySameButton.Text);
TimeDataButton.Text = Utils.i18N.Translate(TimeDataButton.Text);
AddButton.Text = Utils.i18N.Translate(AddButton.Text);
ScanButton.Text = Utils.i18N.Translate(ScanButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
if (Global.Settings.ModeFileNameType == 0)
{

View File

@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Netch.Forms.Server
@@ -21,14 +22,14 @@ namespace Netch.Forms.Server
private void Shadowsocks_Load(object sender, EventArgs e)
{
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
RemarkLabel.Text = Utils.i18N.Translate("Remark");
AddressLabel.Text = Utils.i18N.Translate("Address");
PasswordLabel.Text = Utils.i18N.Translate("Password");
EncryptMethodLabel.Text = Utils.i18N.Translate("Encrypt Method");
PluginLabel.Text = Utils.i18N.Translate("Plugin");
PluginOptionsLabel.Text = Utils.i18N.Translate("Plugin Options");
ControlButton.Text = Utils.i18N.Translate("Save");
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
AddressLabel.Text = Utils.i18N.Translate(AddressLabel.Text);
PasswordLabel.Text = Utils.i18N.Translate(PasswordLabel.Text);
EncryptMethodLabel.Text = Utils.i18N.Translate(EncryptMethodLabel.Text);
PluginLabel.Text = Utils.i18N.Translate(PluginLabel.Text);
PluginOptionsLabel.Text = Utils.i18N.Translate(PluginOptionsLabel.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
foreach (var encrypt in Global.EncryptMethods.SS)
{
@@ -83,6 +84,10 @@ namespace Netch.Forms.Server
private void ControlButton_Click(object sender, EventArgs e)
{
if (!Regex.Match(PortTextBox.Text, "^[0-9]+$").Success)
{
return;
}
if (Index == -1)
{
Global.Settings.Server.Add(new Models.Server()

View File

@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Netch.Forms.Server
@@ -21,16 +22,16 @@ namespace Netch.Forms.Server
private void ShadowsocksR_Load(object sender, EventArgs e)
{
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
RemarkLabel.Text = Utils.i18N.Translate("Remark");
AddressLabel.Text = Utils.i18N.Translate("Address");
PasswordLabel.Text = Utils.i18N.Translate("Password");
EncryptMethodLabel.Text = Utils.i18N.Translate("Encrypt Method");
ProtocolLabel.Text = Utils.i18N.Translate("Protocol");
ProtocolParamLabel.Text = Utils.i18N.Translate("Protocol Param");
OBFSLabel.Text = Utils.i18N.Translate("OBFS");
OBFSParamLabel.Text = Utils.i18N.Translate("OBFS Param");
ControlButton.Text = Utils.i18N.Translate("Save");
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
AddressLabel.Text = Utils.i18N.Translate(AddressLabel.Text);
PasswordLabel.Text = Utils.i18N.Translate(PasswordLabel.Text);
EncryptMethodLabel.Text = Utils.i18N.Translate(EncryptMethodLabel.Text);
ProtocolLabel.Text = Utils.i18N.Translate(ProtocolLabel.Text);
ProtocolParamLabel.Text = Utils.i18N.Translate(ProtocolParamLabel.Text);
OBFSLabel.Text = Utils.i18N.Translate(OBFSLabel.Text);
OBFSParamLabel.Text = Utils.i18N.Translate(OBFSParamLabel.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
foreach (var encrypt in Global.EncryptMethods.SSR)
{
@@ -99,6 +100,10 @@ namespace Netch.Forms.Server
private void ControlButton_Click(object sender, EventArgs e)
{
if (!Regex.Match(PortTextBox.Text, "^[0-9]+$").Success)
{
return;
}
if (Index == -1)
{
Global.Settings.Server.Add(new Models.Server()

View File

@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Netch.Forms.Server
@@ -21,12 +22,12 @@ namespace Netch.Forms.Server
private void Shadowsocks_Load(object sender, EventArgs e)
{
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
RemarkLabel.Text = Utils.i18N.Translate("Remark");
AddressLabel.Text = Utils.i18N.Translate("Address");
UsernameLabel.Text = Utils.i18N.Translate("Username");
PasswordLabel.Text = Utils.i18N.Translate("Password");
ControlButton.Text = Utils.i18N.Translate("Save");
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
AddressLabel.Text = Utils.i18N.Translate(AddressLabel.Text);
UsernameLabel.Text = Utils.i18N.Translate(UsernameLabel.Text);
PasswordLabel.Text = Utils.i18N.Translate(PasswordLabel.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
if (Index != -1)
{
@@ -70,6 +71,10 @@ namespace Netch.Forms.Server
private void ControlButton_Click(object sender, EventArgs e)
{
if (!Regex.Match(PortTextBox.Text, "^[0-9]+$").Success)
{
return;
}
if (Index == -1)
{
Global.Settings.Server.Add(new Models.Server()

View File

@@ -30,6 +30,7 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VMess));
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
this.UseMuxCheckBox = new System.Windows.Forms.CheckBox();
this.TLSSecureCheckBox = new System.Windows.Forms.CheckBox();
this.QUICSecretLabel = new System.Windows.Forms.Label();
this.QUICSecurityLabel = new System.Windows.Forms.Label();
@@ -61,6 +62,7 @@
//
// ConfigurationGroupBox
//
this.ConfigurationGroupBox.Controls.Add(this.UseMuxCheckBox);
this.ConfigurationGroupBox.Controls.Add(this.TLSSecureCheckBox);
this.ConfigurationGroupBox.Controls.Add(this.QUICSecretLabel);
this.ConfigurationGroupBox.Controls.Add(this.QUICSecurityLabel);
@@ -86,19 +88,33 @@
this.ConfigurationGroupBox.Controls.Add(this.RemarkTextBox);
this.ConfigurationGroupBox.Controls.Add(this.RemarkLabel);
this.ConfigurationGroupBox.Controls.Add(this.PortLabel);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 12);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(18, 18);
this.ConfigurationGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
this.ConfigurationGroupBox.Size = new System.Drawing.Size(420, 373);
this.ConfigurationGroupBox.Padding = new System.Windows.Forms.Padding(4);
this.ConfigurationGroupBox.Size = new System.Drawing.Size(630, 560);
this.ConfigurationGroupBox.TabIndex = 1;
this.ConfigurationGroupBox.TabStop = false;
this.ConfigurationGroupBox.Text = "Configuration";
//
// UseMuxCheckBox
//
this.UseMuxCheckBox.AutoSize = true;
this.UseMuxCheckBox.Location = new System.Drawing.Point(292, 519);
this.UseMuxCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.UseMuxCheckBox.Name = "UseMuxCheckBox";
this.UseMuxCheckBox.Size = new System.Drawing.Size(110, 28);
this.UseMuxCheckBox.TabIndex = 25;
this.UseMuxCheckBox.Text = "Use Mux";
this.UseMuxCheckBox.UseVisualStyleBackColor = true;
//
// TLSSecureCheckBox
//
this.TLSSecureCheckBox.AutoSize = true;
this.TLSSecureCheckBox.Location = new System.Drawing.Point(302, 346);
this.TLSSecureCheckBox.Location = new System.Drawing.Point(453, 519);
this.TLSSecureCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.TLSSecureCheckBox.Name = "TLSSecureCheckBox";
this.TLSSecureCheckBox.Size = new System.Drawing.Size(90, 21);
this.TLSSecureCheckBox.Size = new System.Drawing.Size(127, 28);
this.TLSSecureCheckBox.TabIndex = 24;
this.TLSSecureCheckBox.Text = "TLS Secure";
this.TLSSecureCheckBox.UseVisualStyleBackColor = true;
@@ -106,26 +122,29 @@
// QUICSecretLabel
//
this.QUICSecretLabel.AutoSize = true;
this.QUICSecretLabel.Location = new System.Drawing.Point(10, 320);
this.QUICSecretLabel.Location = new System.Drawing.Point(15, 480);
this.QUICSecretLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.QUICSecretLabel.Name = "QUICSecretLabel";
this.QUICSecretLabel.Size = new System.Drawing.Size(79, 17);
this.QUICSecretLabel.Size = new System.Drawing.Size(113, 24);
this.QUICSecretLabel.TabIndex = 22;
this.QUICSecretLabel.Text = "QUIC Secret";
//
// QUICSecurityLabel
//
this.QUICSecurityLabel.AutoSize = true;
this.QUICSecurityLabel.Location = new System.Drawing.Point(10, 290);
this.QUICSecurityLabel.Location = new System.Drawing.Point(15, 435);
this.QUICSecurityLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.QUICSecurityLabel.Name = "QUICSecurityLabel";
this.QUICSecurityLabel.Size = new System.Drawing.Size(88, 17);
this.QUICSecurityLabel.Size = new System.Drawing.Size(129, 24);
this.QUICSecurityLabel.TabIndex = 20;
this.QUICSecurityLabel.Text = "QUIC Security";
//
// QUICSecretTextBox
//
this.QUICSecretTextBox.Location = new System.Drawing.Point(120, 317);
this.QUICSecretTextBox.Location = new System.Drawing.Point(180, 476);
this.QUICSecretTextBox.Margin = new System.Windows.Forms.Padding(4);
this.QUICSecretTextBox.Name = "QUICSecretTextBox";
this.QUICSecretTextBox.Size = new System.Drawing.Size(294, 23);
this.QUICSecretTextBox.Size = new System.Drawing.Size(439, 31);
this.QUICSecretTextBox.TabIndex = 23;
this.QUICSecretTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
@@ -134,52 +153,58 @@
this.QUICSecurityComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.QUICSecurityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.QUICSecurityComboBox.FormattingEnabled = true;
this.QUICSecurityComboBox.Location = new System.Drawing.Point(120, 286);
this.QUICSecurityComboBox.Location = new System.Drawing.Point(180, 429);
this.QUICSecurityComboBox.Margin = new System.Windows.Forms.Padding(4);
this.QUICSecurityComboBox.Name = "QUICSecurityComboBox";
this.QUICSecurityComboBox.Size = new System.Drawing.Size(294, 24);
this.QUICSecurityComboBox.Size = new System.Drawing.Size(439, 32);
this.QUICSecurityComboBox.TabIndex = 21;
this.QUICSecurityComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// PathLabel
//
this.PathLabel.AutoSize = true;
this.PathLabel.Location = new System.Drawing.Point(10, 260);
this.PathLabel.Location = new System.Drawing.Point(15, 390);
this.PathLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.PathLabel.Name = "PathLabel";
this.PathLabel.Size = new System.Drawing.Size(33, 17);
this.PathLabel.Size = new System.Drawing.Size(49, 24);
this.PathLabel.TabIndex = 18;
this.PathLabel.Text = "Path";
//
// PathTextBox
//
this.PathTextBox.Location = new System.Drawing.Point(120, 257);
this.PathTextBox.Location = new System.Drawing.Point(180, 386);
this.PathTextBox.Margin = new System.Windows.Forms.Padding(4);
this.PathTextBox.Name = "PathTextBox";
this.PathTextBox.Size = new System.Drawing.Size(294, 23);
this.PathTextBox.Size = new System.Drawing.Size(439, 31);
this.PathTextBox.TabIndex = 19;
this.PathTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// HostLabel
//
this.HostLabel.AutoSize = true;
this.HostLabel.Location = new System.Drawing.Point(10, 231);
this.HostLabel.Location = new System.Drawing.Point(15, 346);
this.HostLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.HostLabel.Name = "HostLabel";
this.HostLabel.Size = new System.Drawing.Size(35, 17);
this.HostLabel.Size = new System.Drawing.Size(50, 24);
this.HostLabel.TabIndex = 16;
this.HostLabel.Text = "Host";
//
// HostTextBox
//
this.HostTextBox.Location = new System.Drawing.Point(120, 228);
this.HostTextBox.Location = new System.Drawing.Point(180, 342);
this.HostTextBox.Margin = new System.Windows.Forms.Padding(4);
this.HostTextBox.Name = "HostTextBox";
this.HostTextBox.Size = new System.Drawing.Size(294, 23);
this.HostTextBox.Size = new System.Drawing.Size(439, 31);
this.HostTextBox.TabIndex = 17;
this.HostTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// FakeTypeLabel
//
this.FakeTypeLabel.AutoSize = true;
this.FakeTypeLabel.Location = new System.Drawing.Point(10, 201);
this.FakeTypeLabel.Location = new System.Drawing.Point(15, 302);
this.FakeTypeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.FakeTypeLabel.Name = "FakeTypeLabel";
this.FakeTypeLabel.Size = new System.Drawing.Size(67, 17);
this.FakeTypeLabel.Size = new System.Drawing.Size(97, 24);
this.FakeTypeLabel.TabIndex = 14;
this.FakeTypeLabel.Text = "Fake Type";
//
@@ -188,18 +213,20 @@
this.FakeTypeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.FakeTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.FakeTypeComboBox.FormattingEnabled = true;
this.FakeTypeComboBox.Location = new System.Drawing.Point(120, 197);
this.FakeTypeComboBox.Location = new System.Drawing.Point(180, 296);
this.FakeTypeComboBox.Margin = new System.Windows.Forms.Padding(4);
this.FakeTypeComboBox.Name = "FakeTypeComboBox";
this.FakeTypeComboBox.Size = new System.Drawing.Size(294, 24);
this.FakeTypeComboBox.Size = new System.Drawing.Size(439, 32);
this.FakeTypeComboBox.TabIndex = 15;
this.FakeTypeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// TransferProtocolLabel
//
this.TransferProtocolLabel.AutoSize = true;
this.TransferProtocolLabel.Location = new System.Drawing.Point(10, 170);
this.TransferProtocolLabel.Location = new System.Drawing.Point(15, 255);
this.TransferProtocolLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.TransferProtocolLabel.Name = "TransferProtocolLabel";
this.TransferProtocolLabel.Size = new System.Drawing.Size(109, 17);
this.TransferProtocolLabel.Size = new System.Drawing.Size(156, 24);
this.TransferProtocolLabel.TabIndex = 12;
this.TransferProtocolLabel.Text = "Transfer Protocol";
//
@@ -208,18 +235,20 @@
this.TransferProtocolComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.TransferProtocolComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.TransferProtocolComboBox.FormattingEnabled = true;
this.TransferProtocolComboBox.Location = new System.Drawing.Point(120, 166);
this.TransferProtocolComboBox.Location = new System.Drawing.Point(180, 249);
this.TransferProtocolComboBox.Margin = new System.Windows.Forms.Padding(4);
this.TransferProtocolComboBox.Name = "TransferProtocolComboBox";
this.TransferProtocolComboBox.Size = new System.Drawing.Size(294, 24);
this.TransferProtocolComboBox.Size = new System.Drawing.Size(439, 32);
this.TransferProtocolComboBox.TabIndex = 13;
this.TransferProtocolComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// EncryptMethodLabel
//
this.EncryptMethodLabel.AutoSize = true;
this.EncryptMethodLabel.Location = new System.Drawing.Point(10, 139);
this.EncryptMethodLabel.Location = new System.Drawing.Point(15, 208);
this.EncryptMethodLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.EncryptMethodLabel.Name = "EncryptMethodLabel";
this.EncryptMethodLabel.Size = new System.Drawing.Size(101, 17);
this.EncryptMethodLabel.Size = new System.Drawing.Size(150, 24);
this.EncryptMethodLabel.TabIndex = 10;
this.EncryptMethodLabel.Text = "Encrypt Method";
//
@@ -228,102 +257,114 @@
this.EncryptMethodComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.EncryptMethodComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.EncryptMethodComboBox.FormattingEnabled = true;
this.EncryptMethodComboBox.Location = new System.Drawing.Point(120, 135);
this.EncryptMethodComboBox.Location = new System.Drawing.Point(180, 202);
this.EncryptMethodComboBox.Margin = new System.Windows.Forms.Padding(4);
this.EncryptMethodComboBox.Name = "EncryptMethodComboBox";
this.EncryptMethodComboBox.Size = new System.Drawing.Size(294, 24);
this.EncryptMethodComboBox.Size = new System.Drawing.Size(439, 32);
this.EncryptMethodComboBox.TabIndex = 11;
this.EncryptMethodComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// AlterIDLabel
//
this.AlterIDLabel.AutoSize = true;
this.AlterIDLabel.Location = new System.Drawing.Point(10, 109);
this.AlterIDLabel.Location = new System.Drawing.Point(15, 164);
this.AlterIDLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.AlterIDLabel.Name = "AlterIDLabel";
this.AlterIDLabel.Size = new System.Drawing.Size(52, 17);
this.AlterIDLabel.Size = new System.Drawing.Size(76, 24);
this.AlterIDLabel.TabIndex = 8;
this.AlterIDLabel.Text = "Alter ID";
//
// AlterIDTextBox
//
this.AlterIDTextBox.Location = new System.Drawing.Point(120, 106);
this.AlterIDTextBox.Location = new System.Drawing.Point(180, 159);
this.AlterIDTextBox.Margin = new System.Windows.Forms.Padding(4);
this.AlterIDTextBox.Name = "AlterIDTextBox";
this.AlterIDTextBox.Size = new System.Drawing.Size(54, 23);
this.AlterIDTextBox.Size = new System.Drawing.Size(79, 31);
this.AlterIDTextBox.TabIndex = 9;
this.AlterIDTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// UserIDLabel
//
this.UserIDLabel.AutoSize = true;
this.UserIDLabel.Location = new System.Drawing.Point(10, 80);
this.UserIDLabel.Location = new System.Drawing.Point(15, 120);
this.UserIDLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.UserIDLabel.Name = "UserIDLabel";
this.UserIDLabel.Size = new System.Drawing.Size(52, 17);
this.UserIDLabel.Size = new System.Drawing.Size(72, 24);
this.UserIDLabel.TabIndex = 6;
this.UserIDLabel.Text = "User ID";
//
// UserIDTextBox
//
this.UserIDTextBox.Location = new System.Drawing.Point(120, 77);
this.UserIDTextBox.Location = new System.Drawing.Point(180, 116);
this.UserIDTextBox.Margin = new System.Windows.Forms.Padding(4);
this.UserIDTextBox.Name = "UserIDTextBox";
this.UserIDTextBox.Size = new System.Drawing.Size(294, 23);
this.UserIDTextBox.Size = new System.Drawing.Size(439, 31);
this.UserIDTextBox.TabIndex = 7;
this.UserIDTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// PortTextBox
//
this.PortTextBox.Location = new System.Drawing.Point(360, 48);
this.PortTextBox.Location = new System.Drawing.Point(540, 72);
this.PortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.PortTextBox.Name = "PortTextBox";
this.PortTextBox.Size = new System.Drawing.Size(54, 23);
this.PortTextBox.Size = new System.Drawing.Size(79, 31);
this.PortTextBox.TabIndex = 5;
this.PortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AddressTextBox
//
this.AddressTextBox.Location = new System.Drawing.Point(120, 48);
this.AddressTextBox.Location = new System.Drawing.Point(180, 72);
this.AddressTextBox.Margin = new System.Windows.Forms.Padding(4);
this.AddressTextBox.Name = "AddressTextBox";
this.AddressTextBox.Size = new System.Drawing.Size(234, 23);
this.AddressTextBox.Size = new System.Drawing.Size(349, 31);
this.AddressTextBox.TabIndex = 3;
this.AddressTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AddressLabel
//
this.AddressLabel.AutoSize = true;
this.AddressLabel.Location = new System.Drawing.Point(10, 51);
this.AddressLabel.Location = new System.Drawing.Point(15, 76);
this.AddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.AddressLabel.Name = "AddressLabel";
this.AddressLabel.Size = new System.Drawing.Size(56, 17);
this.AddressLabel.Size = new System.Drawing.Size(80, 24);
this.AddressLabel.TabIndex = 2;
this.AddressLabel.Text = "Address";
//
// RemarkTextBox
//
this.RemarkTextBox.Location = new System.Drawing.Point(120, 19);
this.RemarkTextBox.Location = new System.Drawing.Point(180, 28);
this.RemarkTextBox.Margin = new System.Windows.Forms.Padding(4);
this.RemarkTextBox.Name = "RemarkTextBox";
this.RemarkTextBox.Size = new System.Drawing.Size(294, 23);
this.RemarkTextBox.Size = new System.Drawing.Size(439, 31);
this.RemarkTextBox.TabIndex = 1;
this.RemarkTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// RemarkLabel
//
this.RemarkLabel.AutoSize = true;
this.RemarkLabel.Location = new System.Drawing.Point(10, 22);
this.RemarkLabel.Location = new System.Drawing.Point(15, 33);
this.RemarkLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.RemarkLabel.Name = "RemarkLabel";
this.RemarkLabel.Size = new System.Drawing.Size(53, 17);
this.RemarkLabel.Size = new System.Drawing.Size(76, 24);
this.RemarkLabel.TabIndex = 0;
this.RemarkLabel.Text = "Remark";
//
// PortLabel
//
this.PortLabel.AutoSize = true;
this.PortLabel.Location = new System.Drawing.Point(353, 51);
this.PortLabel.Location = new System.Drawing.Point(530, 76);
this.PortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.PortLabel.Name = "PortLabel";
this.PortLabel.Size = new System.Drawing.Size(11, 17);
this.PortLabel.Size = new System.Drawing.Size(14, 24);
this.PortLabel.TabIndex = 4;
this.PortLabel.Text = ":";
//
// ControlButton
//
this.ControlButton.Location = new System.Drawing.Point(357, 391);
this.ControlButton.Location = new System.Drawing.Point(536, 586);
this.ControlButton.Margin = new System.Windows.Forms.Padding(4);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.Size = new System.Drawing.Size(112, 34);
this.ControlButton.TabIndex = 2;
this.ControlButton.Text = "Save";
this.ControlButton.UseVisualStyleBackColor = true;
@@ -331,15 +372,15 @@
//
// VMess
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(444, 426);
this.ClientSize = new System.Drawing.Size(666, 639);
this.Controls.Add(this.ControlButton);
this.Controls.Add(this.ConfigurationGroupBox);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.MaximizeBox = false;
this.Name = "VMess";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
@@ -381,5 +422,6 @@
private System.Windows.Forms.Label QUICSecretLabel;
private System.Windows.Forms.CheckBox TLSSecureCheckBox;
private System.Windows.Forms.Button ControlButton;
private System.Windows.Forms.CheckBox UseMuxCheckBox;
}
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Netch.Forms.Server
@@ -42,20 +43,21 @@ namespace Netch.Forms.Server
private void VMess_Load(object sender, EventArgs e)
{
ConfigurationGroupBox.Text = Utils.i18N.Translate("Configuration");
RemarkLabel.Text = Utils.i18N.Translate("Remark");
AddressLabel.Text = Utils.i18N.Translate("Address");
UserIDLabel.Text = Utils.i18N.Translate("User ID");
AlterIDLabel.Text = Utils.i18N.Translate("Alter ID");
EncryptMethodLabel.Text = Utils.i18N.Translate("Encrypt Method");
TransferProtocolLabel.Text = Utils.i18N.Translate("Transfer Protocol");
FakeTypeLabel.Text = Utils.i18N.Translate("Fake Type");
HostLabel.Text = Utils.i18N.Translate("Host");
PathLabel.Text = Utils.i18N.Translate("Path");
QUICSecurityLabel.Text = Utils.i18N.Translate("QUIC Security");
QUICSecretLabel.Text = Utils.i18N.Translate("QUIC Secret");
TLSSecureCheckBox.Text = Utils.i18N.Translate("TLS Secure");
ControlButton.Text = Utils.i18N.Translate("Save");
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
AddressLabel.Text = Utils.i18N.Translate(AddressLabel.Text);
UserIDLabel.Text = Utils.i18N.Translate(UserIDLabel.Text);
AlterIDLabel.Text = Utils.i18N.Translate(AlterIDLabel.Text);
EncryptMethodLabel.Text = Utils.i18N.Translate(EncryptMethodLabel.Text);
TransferProtocolLabel.Text = Utils.i18N.Translate(TransferProtocolLabel.Text);
FakeTypeLabel.Text = Utils.i18N.Translate(FakeTypeLabel.Text);
HostLabel.Text = Utils.i18N.Translate(HostLabel.Text);
PathLabel.Text = Utils.i18N.Translate(PathLabel.Text);
QUICSecurityLabel.Text = Utils.i18N.Translate(QUICSecurityLabel.Text);
QUICSecretLabel.Text = Utils.i18N.Translate(QUICSecretLabel.Text);
TLSSecureCheckBox.Text = Utils.i18N.Translate(TLSSecureCheckBox.Text);
UseMuxCheckBox.Text = Utils.i18N.Translate(UseMuxCheckBox.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
foreach (var encrypt in Global.EncryptMethods.VMess)
{
@@ -92,6 +94,7 @@ namespace Netch.Forms.Server
QUICSecurityComboBox.SelectedIndex = Global.EncryptMethods.VMessQUIC.IndexOf(Global.Settings.Server[Index].QUICSecure);
QUICSecretTextBox.Text = Global.Settings.Server[Index].QUICSecret;
TLSSecureCheckBox.Checked = Global.Settings.Server[Index].TLSSecure;
UseMuxCheckBox.Checked = Global.Settings.Server[Index].UseMux;
}
else
{
@@ -109,6 +112,10 @@ namespace Netch.Forms.Server
private void ControlButton_Click(object sender, EventArgs e)
{
if (!Regex.Match(PortTextBox.Text, "^[0-9]+$").Success)
{
return;
}
if (Index == -1)
{
Global.Settings.Server.Add(new Models.Server()
@@ -126,7 +133,8 @@ namespace Netch.Forms.Server
Path = PathTextBox.Text,
QUICSecure = QUICSecurityComboBox.Text,
QUICSecret = QUICSecretTextBox.Text,
TLSSecure = TLSSecureCheckBox.Checked
TLSSecure = TLSSecureCheckBox.Checked,
UseMux = UseMuxCheckBox.Checked
});
}
else
@@ -146,7 +154,8 @@ namespace Netch.Forms.Server
Path = PathTextBox.Text,
QUICSecure = QUICSecurityComboBox.Text,
QUICSecret = QUICSecretTextBox.Text,
TLSSecure = TLSSecureCheckBox.Checked
TLSSecure = TLSSecureCheckBox.Checked,
UseMux = UseMuxCheckBox.Checked
};
}

View File

@@ -43,15 +43,15 @@ namespace Netch.Forms
private void SettingForm_Load(object sender, EventArgs e)
{
Text = Utils.i18N.Translate("Settings");
PortGroupBox.Text = Utils.i18N.Translate("Local Port");
AllowDevicesCheckBox.Text = Utils.i18N.Translate("Allow other Devices to connect");
TUNTAPAddressLabel.Text = Utils.i18N.Translate("Address");
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate("Netmask");
TUNTAPGatewayLabel.Text = Utils.i18N.Translate("Gateway");
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate("Use Custom DNS");
GlobalBypassIPsButton.Text = Utils.i18N.Translate("Global Bypass IPs");
ControlButton.Text = Utils.i18N.Translate("Save");
Text = Utils.i18N.Translate(Text);
PortGroupBox.Text = Utils.i18N.Translate(PortGroupBox.Text);
AllowDevicesCheckBox.Text = Utils.i18N.Translate(AllowDevicesCheckBox.Text);
TUNTAPAddressLabel.Text = Utils.i18N.Translate(TUNTAPAddressLabel.Text);
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
ExitWhenClosedCheckBox.Checked = Global.Settings.ExitWhenClosed;
StopWhenExitedCheckBox.Checked = Global.Settings.StopWhenExited;
@@ -68,11 +68,11 @@ namespace Netch.Forms
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
BehaviorGroupBox.Text = Utils.i18N.Translate("Behavior");
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate("Exit when closed");
StopWhenExitedCheckBox.Text = Utils.i18N.Translate("Stop when exited");
StartWhenOpenedCheckBox.Text = Utils.i18N.Translate("Start when opened");
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate("Check update when opened");
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
StopWhenExitedCheckBox.Text = Utils.i18N.Translate(StopWhenExitedCheckBox.Text);
StartWhenOpenedCheckBox.Text = Utils.i18N.Translate(StartWhenOpenedCheckBox.Text);
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
if (Global.Settings.TUNTAP.DNS.Count > 0)
{

View File

@@ -36,15 +36,15 @@ namespace Netch.Forms
private void SubscribeForm_Load(object sender, EventArgs e)
{
Text = Utils.i18N.Translate("Subscribe");
RemarkColumnHeader.Text = Utils.i18N.Translate("Remark");
LinkColumnHeader.Text = Utils.i18N.Translate("Link");
UseSelectedServerCheckBox.Text = Utils.i18N.Translate("Use Selected Server To Update Subscription");
DeleteToolStripMenuItem.Text = Utils.i18N.Translate("Delete");
RemarkLabel.Text = Utils.i18N.Translate("Remark");
LinkLabel.Text = Utils.i18N.Translate("Link");
AddButton.Text = Utils.i18N.Translate("Add");
ControlButton.Text = Utils.i18N.Translate("Save");
Text = Utils.i18N.Translate(Text);
RemarkColumnHeader.Text = Utils.i18N.Translate(RemarkColumnHeader.Text);
LinkColumnHeader.Text = Utils.i18N.Translate(LinkColumnHeader.Text);
UseSelectedServerCheckBox.Text = Utils.i18N.Translate(UseSelectedServerCheckBox.Text);
DeleteToolStripMenuItem.Text = Utils.i18N.Translate(DeleteToolStripMenuItem.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
LinkLabel.Text = Utils.i18N.Translate(LinkLabel.Text);
AddButton.Text = Utils.i18N.Translate(AddButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
UserAgentTextBox.Text = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36";
UseSelectedServerCheckBox.Checked = Global.Settings.UseProxyToUpdateSubscription;

View File

@@ -128,6 +128,8 @@ namespace Netch.Models.Information
public class TLSSettings
{
public bool allowInsecure = true;
public string serverName;
}
public class OutboundSettings
@@ -137,7 +139,7 @@ namespace Netch.Models.Information
public class OutboundMux
{
public bool enabled = true;
public bool enabled = false;
}
public class StreamSettings

30
Netch/Models/Profile.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
namespace Netch.Models
{
public class Profile
{
public String ServerRemark;
public String ModeRemark;
public String ProfileName;
public bool IsDummy = true;
public Profile(Server server, Mode mode, String name)
{
ServerRemark = server.Remark;
ModeRemark = mode.Remark;
ProfileName = name;
IsDummy = false;
}
/// <summary>
/// Return a dummy one.
/// </summary>
public Profile()
{
}
}
}

View File

@@ -128,6 +128,11 @@ namespace Netch.Models
/// </summary>
public bool TLSSecure = false;
/// <summary>
/// Mux 多路复用VMess
/// </summary>
public bool UseMux = false;
/// <summary>
/// 延迟
/// </summary>

View File

@@ -118,5 +118,11 @@ namespace Netch.Models
/// 全局绕过 IP 列表
/// </summary>
public List<string> BypassIPs = new List<string>();
/// <summary>
/// Saved profiles
/// </summary>
public List<Profile> profiles = new List<Profile>();
}
}

View File

@@ -5,6 +5,14 @@
/// </summary>
public class VMess
{
/// <summary>
/// Mux Class
/// </summary>
public class Mux
{
public object enabled;
}
/// <summary>
/// 链接版本
/// </summary>
@@ -59,5 +67,10 @@
/// 是否使用 TLS
/// </summary>
public string tls;
/// <summary>
/// Mux 多路复用
/// </summary>
public Mux mux;
}
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?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>
@@ -294,6 +294,7 @@
<Compile Include="Models\GitHubRelease\VersionUtil.cs" />
<Compile Include="Models\LegacyServer.cs" />
<Compile Include="Models\LegacySetting.cs" />
<Compile Include="Models\Profile.cs" />
<Compile Include="NativeMethods.cs" />
<Compile Include="Netch.cs" />
<Compile Include="Models\Information\VMess.cs" />

View File

@@ -16,7 +16,7 @@
"Started": "已启动",
"Stopping": "正在停止中",
"Stopped": "已停止",
"Server": "服务器",
"Import Servers From Clipboard": "从剪贴板导入服务器",
"Add [Socks5] Server": "添加 [Socks5] 服务器",
@@ -41,6 +41,7 @@
"QUIC Security": "QUIC 加密方式",
"QUIC Secret": "QUIC 加密密钥",
"TLS Secure": "TLS 底层传输安全",
"Use Mux": "Mux 多路复用",
"Encrypt Method": "加密方式",
"Protocol": "协议",
"Protocol Param": "协议参数",
@@ -49,14 +50,14 @@
"Saved": "保存成功",
"Plugin": "插件",
"Plugin Options": "插件参数",
"Subscribe": "订阅",
"Manage Subscribe Links": "管理订阅链接",
"Update Servers From Subscribe Links": "从订阅链接更新服务器",
"No subscription link": "没有任何一条订阅链接",
"Updating in the background": "正在后台更新中",
"Update completed": "更新完成",
"Options": "选项",
"Restart Service": "重启服务",
"Restarting service": "正在重启服务中",
@@ -121,7 +122,11 @@
"Global Bypass IPs": "全局直连 IP",
"Port value illegal. Try again.": "端口值非法。请重试。",
"Check update when opened": "打开软件时检查更新",
"Profile": "配置名",
"Profiles": "配置",
"None": "无",
"Show": "显示",
"Exit": "退出"
}

View File

@@ -358,13 +358,17 @@ namespace Netch.Utils
data.Type = "SS";
}
*/
var parser = new Regex(@"^(?<server>.+):(?<port>\d+?):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
var match = parser.Match(URLSafeBase64Decode(text));
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.EncryptMethod = match.Groups["method"].Value;
@@ -478,6 +482,26 @@ namespace Netch.Utils
}
data.TLSSecure = vmess.tls == "tls";
if (vmess.mux == null)
{
data.UseMux = false;
}
else
{
if (vmess.mux.enabled is Boolean)
{
data.UseMux = (bool)vmess.mux.enabled;
}
else if (vmess.mux.enabled is String)
{
data.UseMux = (string)vmess.mux.enabled == "true"; // 针对使用字符串当作布尔值的情况
}
else
{
data.UseMux = false;
}
}
data.EncryptMethod = "auto"; // V2Ray 加密方式不包括在链接中,主动添加一个
list.Add(data);

View File

@@ -42,6 +42,10 @@ As well, Netch avoid the restricted NAT problem caused by SSTap<escape><a name =
## Sponsor
[![ManSora](docs/sponsor/mansora.jpg)](https://www.mansora.net/cart.php)
[![51across](docs/sponsor/51across.jpg)](https://across-gfw.com/register?aff=4739)
开发不易,以下为恰饭时间。
这是我所选择的服务器提供商IPLC专线翻墙、稳定、速度快、价格便宜。欢迎大家使用我的推广链接前去注册。https://across-gfw.com/register?aff=4739
## Screenshots

View File

@@ -206,6 +206,12 @@ acb4bc24651509c21558420d97865262e959bc0c 190629 1.0.9-STABLE Rollback
ManSora 可提供深港沪日等地区的专线服务器。有共享IP的NAT VPS适合个人使用也可以为企业/销售某种工具的商家提供独立IP的定制服务器。
[![51across](sponsor/51across.jpg)](https://across-gfw.com/register?aff=4739)
开发不易,以下为恰饭时间。
这是我所选择的服务器提供商IPLC专线翻墙、稳定、速度快、价格便宜。欢迎大家使用我的推广链接前去注册。https://across-gfw.com/register?aff=4739
## 截图
![主界面](screenshots/main.png)

BIN
docs/sponsor/51across.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

2
modes

Submodule modes updated: c994796add...cff55c0541