diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index ebf87628..9f0503a9 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; +using System.Linq; using System.ServiceProcess; using System.Threading; using System.Threading.Tasks; @@ -207,7 +208,14 @@ namespace Netch.Forms private void SaveConfigs() { Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex; - Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.SelectedIndex; + if (ModeComboBox.Tag is object[] list) + { + Global.Settings.ModeComboBoxSelectedIndex = list.ToList().IndexOf(ModeComboBox.SelectedItem); + } + else + { + Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.Items.IndexOf(ModeComboBox.SelectedItem); + } Utils.Configuration.Save(); } diff --git a/Netch/Forms/Server/ShadowsocksR.Designer.cs b/Netch/Forms/Server/ShadowsocksR.Designer.cs index 6a20a4e7..8cd01b80 100644 --- a/Netch/Forms/Server/ShadowsocksR.Designer.cs +++ b/Netch/Forms/Server/ShadowsocksR.Designer.cs @@ -31,9 +31,9 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShadowsocksR)); this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox(); this.OBFSParamLabel = new System.Windows.Forms.Label(); - this.PluginOptionParamTextBox = new System.Windows.Forms.TextBox(); + this.OBFSOptionParamTextBox = new System.Windows.Forms.TextBox(); this.OBFSLabel = new System.Windows.Forms.Label(); - this.PluginComboBox = new System.Windows.Forms.ComboBox(); + this.OBFSComboBox = new System.Windows.Forms.ComboBox(); this.ProtocolParamLabel = new System.Windows.Forms.Label(); this.ProtocolParamTextBox = new System.Windows.Forms.TextBox(); this.ProtocolLabel = new System.Windows.Forms.Label(); @@ -55,9 +55,9 @@ // ConfigurationGroupBox // this.ConfigurationGroupBox.Controls.Add(this.OBFSParamLabel); - this.ConfigurationGroupBox.Controls.Add(this.PluginOptionParamTextBox); + this.ConfigurationGroupBox.Controls.Add(this.OBFSOptionParamTextBox); this.ConfigurationGroupBox.Controls.Add(this.OBFSLabel); - this.ConfigurationGroupBox.Controls.Add(this.PluginComboBox); + this.ConfigurationGroupBox.Controls.Add(this.OBFSComboBox); this.ConfigurationGroupBox.Controls.Add(this.ProtocolParamLabel); this.ConfigurationGroupBox.Controls.Add(this.ProtocolParamTextBox); this.ConfigurationGroupBox.Controls.Add(this.ProtocolLabel); @@ -90,11 +90,11 @@ // // OBFSParamTextBox // - this.PluginOptionParamTextBox.Location = new System.Drawing.Point(120, 227); - this.PluginOptionParamTextBox.Name = "OBFSParamTextBox"; - this.PluginOptionParamTextBox.Size = new System.Drawing.Size(294, 23); - this.PluginOptionParamTextBox.TabIndex = 17; - this.PluginOptionParamTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.OBFSOptionParamTextBox.Location = new System.Drawing.Point(120, 227); + this.OBFSOptionParamTextBox.Name = "OBFSParamTextBox"; + this.OBFSOptionParamTextBox.Size = new System.Drawing.Size(294, 23); + this.OBFSOptionParamTextBox.TabIndex = 17; + this.OBFSOptionParamTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // OBFSLabel // @@ -107,14 +107,14 @@ // // OBFSComboBox // - this.PluginComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; - this.PluginComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.PluginComboBox.FormattingEnabled = true; - this.PluginComboBox.Location = new System.Drawing.Point(120, 196); - this.PluginComboBox.Name = "OBFSComboBox"; - this.PluginComboBox.Size = new System.Drawing.Size(294, 24); - this.PluginComboBox.TabIndex = 15; - this.PluginComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem); + this.OBFSComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.OBFSComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.OBFSComboBox.FormattingEnabled = true; + this.OBFSComboBox.Location = new System.Drawing.Point(120, 196); + this.OBFSComboBox.Name = "OBFSComboBox"; + this.OBFSComboBox.Size = new System.Drawing.Size(294, 24); + this.OBFSComboBox.TabIndex = 15; + this.OBFSComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem); // // ProtocolParamLabel // @@ -293,8 +293,8 @@ private System.Windows.Forms.TextBox ProtocolParamTextBox; private System.Windows.Forms.Label ProtocolParamLabel; private System.Windows.Forms.Label OBFSLabel; - private System.Windows.Forms.ComboBox PluginComboBox; - private System.Windows.Forms.TextBox PluginOptionParamTextBox; + private System.Windows.Forms.ComboBox OBFSComboBox; + private System.Windows.Forms.TextBox OBFSOptionParamTextBox; private System.Windows.Forms.Label OBFSParamLabel; } } \ No newline at end of file diff --git a/Netch/Forms/Server/ShadowsocksR.cs b/Netch/Forms/Server/ShadowsocksR.cs index 9ca7a969..a8344a85 100644 --- a/Netch/Forms/Server/ShadowsocksR.cs +++ b/Netch/Forms/Server/ShadowsocksR.cs @@ -45,7 +45,7 @@ namespace Netch.Forms.Server foreach (var obfs in Global.OBFSs) { - PluginComboBox.Items.Add(obfs); + OBFSComboBox.Items.Add(obfs); } if (Index != -1) @@ -57,14 +57,14 @@ namespace Netch.Forms.Server EncryptMethodComboBox.SelectedIndex = Global.EncryptMethods.SSR.IndexOf(Global.Settings.Server[Index].EncryptMethod); ProtocolComboBox.SelectedIndex = Global.Protocols.IndexOf(Global.Settings.Server[Index].Protocol); ProtocolParamTextBox.Text = Global.Settings.Server[Index].ProtocolParam; - PluginComboBox.SelectedIndex = Global.OBFSs.IndexOf(Global.Settings.Server[Index].Plugin); - PluginOptionParamTextBox.Text = Global.Settings.Server[Index].PluginOption; + OBFSComboBox.SelectedIndex = Global.OBFSs.IndexOf(Global.Settings.Server[Index].OBFS); + OBFSOptionParamTextBox.Text = Global.Settings.Server[Index].OBFSParam; } else { EncryptMethodComboBox.SelectedIndex = 0; ProtocolComboBox.SelectedIndex = 0; - PluginComboBox.SelectedIndex = 0; + OBFSComboBox.SelectedIndex = 0; } } @@ -116,8 +116,8 @@ namespace Netch.Forms.Server EncryptMethod = EncryptMethodComboBox.Text, Protocol = ProtocolComboBox.Text, ProtocolParam = ProtocolParamTextBox.Text, - Plugin = PluginComboBox.Text, - PluginOption = PluginOptionParamTextBox.Text + OBFS = OBFSComboBox.Text, + OBFSParam = OBFSOptionParamTextBox.Text }); } else @@ -133,8 +133,8 @@ namespace Netch.Forms.Server EncryptMethod = EncryptMethodComboBox.Text, Protocol = ProtocolComboBox.Text, ProtocolParam = ProtocolParamTextBox.Text, - Plugin = PluginComboBox.Text, - PluginOption = PluginOptionParamTextBox.Text + OBFS = OBFSComboBox.Text, + OBFSParam = OBFSOptionParamTextBox.Text }; } diff --git a/Netch/Utils/ShareLink.cs b/Netch/Utils/ShareLink.cs index ffdf864c..0b265b24 100644 --- a/Netch/Utils/ShareLink.cs +++ b/Netch/Utils/ShareLink.cs @@ -175,7 +175,7 @@ namespace Netch.Utils { var finder = new Regex(@"^(?.+?)\?(.+)$"); var match = finder.Match(text); - + if (match.Success) { var plugins = HttpUtility.UrlDecode(HttpUtility.ParseQueryString(new Uri(text).Query).Get("plugin")); @@ -187,7 +187,7 @@ namespace Netch.Utils if (!pluginopts.Contains("obfs=")) pluginopts = "obfs=http;obfs-host=" + pluginopts; } - else if(plugin == "simple-obfs-tls") + else if (plugin == "simple-obfs-tls") { plugin = "simple-obfs"; if (!pluginopts.Contains("obfs=")) @@ -361,7 +361,7 @@ namespace Netch.Utils var parser = new Regex(@"^(?.+):(?(-?\d+?)):(?.+?):(?.+?):(?.+?):(?.+?)/\?(?.*)$"); var match = parser.Match(URLSafeBase64Decode(text)); - if(match.Success) + if (match.Success) { data.Hostname = match.Groups["server"].Value; data.Port = int.Parse(match.Groups["port"].Value); @@ -386,6 +386,10 @@ namespace Netch.Utils } 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)); @@ -452,10 +456,10 @@ namespace Netch.Utils return null; } - if(vmess.v == null || vmess.v == "1") + if (vmess.v == null || vmess.v == "1") { var info = vmess.host.Split(';'); - if(info.Length == 2) + if (info.Length == 2) { vmess.host = info[0]; vmess.path = info[1];