diff --git a/Netch/Controllers/NFController.cs b/Netch/Controllers/NFController.cs index bbd730cb..78d2001f 100644 --- a/Netch/Controllers/NFController.cs +++ b/Netch/Controllers/NFController.cs @@ -196,7 +196,7 @@ namespace Netch.Controllers aio_dial((int) NameList.TYPE_TCPPASS + offset, socks5.Password ?? string.Empty); aio_dial((int) NameList.TYPE_TCPMETH + offset, string.Empty); } - else if (MainController.Server is Shadowsocks shadowsocks) + else if (MainController.Server is Shadowsocks shadowsocks && !shadowsocks.HasPlugin() && Global.Settings.RedirectorSS) { aio_dial((int) NameList.TYPE_TCPTYPE + offset, "Shadowsocks"); aio_dial((int) NameList.TYPE_TCPHOST + offset, $"{shadowsocks.AutoResolveHostname()}:{shadowsocks.Port}"); diff --git a/Netch/Forms/SettingForm.Designer.cs b/Netch/Forms/SettingForm.Designer.cs index e386ec04..9127353f 100644 --- a/Netch/Forms/SettingForm.Designer.cs +++ b/Netch/Forms/SettingForm.Designer.cs @@ -109,6 +109,7 @@ namespace Netch.Forms this.OtherDNSTextBox = new System.Windows.Forms.TextBox(); this.ControlButton = new System.Windows.Forms.Button(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.RedirectorSSCheckBox = new System.Windows.Forms.CheckBox(); this.TabControl.SuspendLayout(); this.GeneralTabPage.SuspendLayout(); this.PortGroupBox.SuspendLayout(); @@ -361,6 +362,7 @@ namespace Netch.Forms this.NFTabPage.Controls.Add(this.ModifySystemDNSCheckBox); this.NFTabPage.Controls.Add(this.ModifiedDNSLabel); this.NFTabPage.Controls.Add(this.ModifiedDNSTextBox); + this.NFTabPage.Controls.Add(this.RedirectorSSCheckBox); this.NFTabPage.Location = new System.Drawing.Point(4, 29); this.NFTabPage.Name = "NFTabPage"; this.NFTabPage.Padding = new System.Windows.Forms.Padding(3); @@ -914,6 +916,17 @@ namespace Netch.Forms this.flowLayoutPanel1.Size = new System.Drawing.Size(480, 400); this.flowLayoutPanel1.TabIndex = 0; // + // RedirectorSSCheckBox + // + this.RedirectorSSCheckBox.AutoSize = true; + this.RedirectorSSCheckBox.Location = new System.Drawing.Point(8, 65); + this.RedirectorSSCheckBox.Name = "RedirectorSSCheckBox"; + this.RedirectorSSCheckBox.Size = new System.Drawing.Size(102, 16); + this.RedirectorSSCheckBox.TabIndex = 0; + this.RedirectorSSCheckBox.Text = "Redirector SS"; + this.RedirectorSSCheckBox.UseVisualStyleBackColor = true; + this.RedirectorSSCheckBox.CheckedChanged += new System.EventHandler(this.ModifySystemDNSCheckBox_CheckedChanged); + // // SettingForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -1032,5 +1045,6 @@ namespace Netch.Forms private System.Windows.Forms.TextBox ChinaDNSTextBox; private System.Windows.Forms.TextBox ModifiedDNSTextBox; private System.Windows.Forms.Label ModifiedDNSLabel; + private System.Windows.Forms.CheckBox RedirectorSSCheckBox; } } \ No newline at end of file diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs index a1995cf8..6c782090 100644 --- a/Netch/Forms/SettingForm.cs +++ b/Netch/Forms/SettingForm.cs @@ -97,6 +97,10 @@ namespace Netch.Forms s => Global.Settings.ModifiedDNS = s, Global.Settings.ModifiedDNS); + BindCheckBox(RedirectorSSCheckBox, + s => Global.Settings.RedirectorSS = s, + Global.Settings.RedirectorSS); + #endregion #region TUN/TAP diff --git a/Netch/Forms/SettingForm.resx b/Netch/Forms/SettingForm.resx index 9a37d326..b3c3547f 100644 --- a/Netch/Forms/SettingForm.resx +++ b/Netch/Forms/SettingForm.resx @@ -1,4 +1,64 @@ - + + + @@ -57,8 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + + AAABAAMAAAAAAAEAIAAoIAQANgAAAEBAAAABACAAKEIAAF4gBAAgIAAAAQAgAKgQAACGYgQAKAAAAAAB AAAAAgAAAQAgAAAAAAAAIAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs index 9c286b11..2b423eb2 100644 --- a/Netch/Models/Setting.cs +++ b/Netch/Models/Setting.cs @@ -253,5 +253,7 @@ namespace Netch.Models public V2rayConfig V2RayConfig = new V2rayConfig(); public AioDNSConfig AioDNS = new AioDNSConfig(); + + public bool RedirectorSS = false; } } \ No newline at end of file diff --git a/Netch/Utils/ModeHelper.cs b/Netch/Utils/ModeHelper.cs index fcf90bc9..31d7fa50 100644 --- a/Netch/Utils/ModeHelper.cs +++ b/Netch/Utils/ModeHelper.cs @@ -144,7 +144,7 @@ namespace Netch.Utils 0 => server switch { Socks5 => true, - Shadowsocks shadowsocks when !shadowsocks.HasPlugin() => true, + Shadowsocks shadowsocks when !shadowsocks.HasPlugin() && Global.Settings.RedirectorSS => true, _ => false }, _ => false