From dcb6092eb861864614db5194f7cc651cfa6bfc1b Mon Sep 17 00:00:00 2001 From: Student Main Date: Sun, 5 Jan 2020 22:53:04 +0800 Subject: [PATCH] set default method to chacha20-ietf-poly1305 in all place... --- shadowsocks-csharp/Encryption/EncryptorFactory.cs | 2 +- shadowsocks-csharp/Model/Server.cs | 7 +++++-- shadowsocks-csharp/View/ConfigForm.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/shadowsocks-csharp/Encryption/EncryptorFactory.cs b/shadowsocks-csharp/Encryption/EncryptorFactory.cs index 169a67ce..fcae221a 100644 --- a/shadowsocks-csharp/Encryption/EncryptorFactory.cs +++ b/shadowsocks-csharp/Encryption/EncryptorFactory.cs @@ -70,7 +70,7 @@ namespace Shadowsocks.Encryption { if (method.IsNullOrEmpty()) { - method = "aes-256-cfb"; + method = Model.Server.DefaultMethod; } method = method.ToLowerInvariant(); diff --git a/shadowsocks-csharp/Model/Server.cs b/shadowsocks-csharp/Model/Server.cs index 88f72c2c..6e08f50e 100755 --- a/shadowsocks-csharp/Model/Server.cs +++ b/shadowsocks-csharp/Model/Server.cs @@ -11,6 +11,9 @@ namespace Shadowsocks.Model [Serializable] public class Server { + public const string DefaultMethod = "chacha20-ietf-poly1305"; + public const int DefaultPort = 8388; + #region ParseLegacyURL public static readonly Regex UrlFinder = new Regex(@"ss://(?[A-Za-z0-9+-/=_]+)(?:#(?\S+))?", RegexOptions.IgnoreCase), @@ -69,8 +72,8 @@ namespace Shadowsocks.Model public Server() { server = ""; - server_port = 8388; - method = "chacha20-ietf-poly1305"; + server_port = DefaultPort; + method = DefaultMethod; plugin = ""; plugin_opts = ""; plugin_args = ""; diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 8151dc58..379edc29 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -316,7 +316,7 @@ namespace Shadowsocks.View IPTextBox.Text = server.server; ServerPortTextBox.Text = server.server_port.ToString(); PasswordTextBox.Text = server.password; - EncryptionSelect.Text = server.method ?? "aes-256-cfb"; + EncryptionSelect.Text = server.method ?? Server.DefaultMethod; PluginTextBox.Text = server.plugin; PluginOptionsTextBox.Text = server.plugin_opts; PluginArgumentsTextBox.Text = server.plugin_args;