Browse Source

drop OTA; add AEAD config

tags/4.0
Syrone Wong 7 years ago
parent
commit
7408a75f0e
5 changed files with 35 additions and 54 deletions
  1. +0
    -2
      .gitignore
  2. +1
    -2
      shadowsocks-csharp/Controller/ShadowsocksController.cs
  3. +1
    -4
      shadowsocks-csharp/Model/Server.cs
  4. +33
    -43
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  5. +0
    -3
      shadowsocks-csharp/View/ConfigForm.cs

+ 0
- 2
.gitignore View File

@@ -7,8 +7,6 @@ TestResults
*.suo *.suo


shadowsocks-csharp/3rd/* shadowsocks-csharp/3rd/*
!shadowsocks-csharp/3rd/zxing/
!shadowsocks-csharp/3rd/SimpleJson.cs
packages/* packages/*


shadowsocks-csharp.sln.DotSettings.user shadowsocks-csharp.sln.DotSettings.user

+ 1
- 2
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -303,8 +303,7 @@ namespace Shadowsocks.Controller
public static string GetQRCode(Server server) public static string GetQRCode(Server server)
{ {
string tag = string.Empty; string tag = string.Empty;
string auth = server.auth ? "-auth" : string.Empty;
string parts = $"{server.method}{auth}:{server.password}@{server.server}:{server.server_port}";
string parts = $"{server.method}:{server.password}@{server.server}:{server.server_port}";
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts)); string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(parts));
if(!server.remarks.IsNullOrEmpty()) if(!server.remarks.IsNullOrEmpty())
{ {


+ 1
- 4
shadowsocks-csharp/Model/Server.cs View File

@@ -11,7 +11,7 @@ namespace Shadowsocks.Model
{ {
public static readonly Regex public static readonly Regex
UrlFinder = new Regex("^(?i)ss://([A-Za-z0-9+-/=_]+)(#(.+))?$", RegexOptions.IgnoreCase), UrlFinder = new Regex("^(?i)ss://([A-Za-z0-9+-/=_]+)(#(.+))?$", RegexOptions.IgnoreCase),
DetailsParser = new Regex("^((?<method>.+?)(?<auth>-auth)??:(?<password>.*)@(?<hostname>.+?)" +
DetailsParser = new Regex("^((?<method>.+?):(?<password>.*)@(?<hostname>.+?)" +
":(?<port>\\d+?))$", RegexOptions.IgnoreCase); ":(?<port>\\d+?))$", RegexOptions.IgnoreCase);
private const int DefaultServerTimeoutSec = 5; private const int DefaultServerTimeoutSec = 5;
@@ -22,7 +22,6 @@ namespace Shadowsocks.Model
public string password; public string password;
public string method; public string method;
public string remarks; public string remarks;
public bool auth;
public int timeout; public int timeout;
public override int GetHashCode() public override int GetHashCode()
@@ -67,7 +66,6 @@ namespace Shadowsocks.Model
method = "aes-256-cfb"; method = "aes-256-cfb";
password = ""; password = "";
remarks = ""; remarks = "";
auth = false;
timeout = DefaultServerTimeoutSec; timeout = DefaultServerTimeoutSec;
} }
@@ -82,7 +80,6 @@ namespace Shadowsocks.Model
match = DetailsParser.Match(Encoding.UTF8.GetString(Convert.FromBase64String( match = DetailsParser.Match(Encoding.UTF8.GetString(Convert.FromBase64String(
base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '=')))); base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '='))));
method = match.Groups["method"].Value; method = match.Groups["method"].Value;
auth = match.Groups["auth"].Success;
password = match.Groups["password"].Value; password = match.Groups["password"].Value;
server = match.Groups["hostname"].Value; server = match.Groups["hostname"].Value;
server_port = int.Parse(match.Groups["port"].Value); server_port = int.Parse(match.Groups["port"].Value);


+ 33
- 43
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -39,7 +39,8 @@
this.PasswordTextBox = new System.Windows.Forms.TextBox(); this.PasswordTextBox = new System.Windows.Forms.TextBox();
this.EncryptionLabel = new System.Windows.Forms.Label(); this.EncryptionLabel = new System.Windows.Forms.Label();
this.EncryptionSelect = new System.Windows.Forms.ComboBox(); this.EncryptionSelect = new System.Windows.Forms.ComboBox();
this.OneTimeAuth = new System.Windows.Forms.CheckBox();
this.TimeoutLabel = new System.Windows.Forms.Label();
this.TimeoutTextBox = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.OKButton = new System.Windows.Forms.Button(); this.OKButton = new System.Windows.Forms.Button();
this.MyCancelButton = new System.Windows.Forms.Button(); this.MyCancelButton = new System.Windows.Forms.Button();
@@ -57,8 +58,6 @@
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.DuplicateButton = new System.Windows.Forms.Button(); this.DuplicateButton = new System.Windows.Forms.Button();
this.TimeoutLabel = new System.Windows.Forms.Label();
this.TimeoutTextBox = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.ServerGroupBox.SuspendLayout(); this.ServerGroupBox.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout();
@@ -85,15 +84,13 @@
this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2); this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 3); this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 3); this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.OneTimeAuth, 1, 7);
this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 6); this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 6); this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 6);
this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21); this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3);
this.tableLayoutPanel1.RowCount = 8;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowCount = 7;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
@@ -101,7 +98,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(255, 189);
this.tableLayoutPanel1.Size = new System.Drawing.Size(255, 167);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// RemarksTextBox // RemarksTextBox
@@ -217,21 +214,35 @@
"bf-cfb", "bf-cfb",
"camellia-128-cfb", "camellia-128-cfb",
"camellia-192-cfb", "camellia-192-cfb",
"camellia-256-cfb"});
"camellia-256-cfb",
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
"chacha20-ietf-poly1305"});
this.EncryptionSelect.Location = new System.Drawing.Point(89, 87); this.EncryptionSelect.Location = new System.Drawing.Point(89, 87);
this.EncryptionSelect.Name = "EncryptionSelect"; this.EncryptionSelect.Name = "EncryptionSelect";
this.EncryptionSelect.Size = new System.Drawing.Size(160, 20); this.EncryptionSelect.Size = new System.Drawing.Size(160, 20);
this.EncryptionSelect.TabIndex = 3; this.EncryptionSelect.TabIndex = 3;
// //
// OneTimeAuth
// TimeoutLabel
//
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.TimeoutLabel.AutoSize = true;
this.TimeoutLabel.Location = new System.Drawing.Point(6, 144);
this.TimeoutLabel.Name = "TimeoutLabel";
this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TimeoutLabel.Size = new System.Drawing.Size(77, 12);
this.TimeoutLabel.TabIndex = 10;
this.TimeoutLabel.Text = "Timeout(Sec)";
// //
this.OneTimeAuth.AutoSize = true;
this.OneTimeAuth.Location = new System.Drawing.Point(89, 167);
this.OneTimeAuth.Name = "OneTimeAuth";
this.OneTimeAuth.Size = new System.Drawing.Size(156, 16);
this.OneTimeAuth.TabIndex = 5;
this.OneTimeAuth.Text = "Onetime Authentication";
this.OneTimeAuth.UseVisualStyleBackColor = true;
// TimeoutTextBox
//
this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.TimeoutTextBox.Location = new System.Drawing.Point(89, 140);
this.TimeoutTextBox.MaxLength = 5;
this.TimeoutTextBox.Name = "TimeoutTextBox";
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21);
this.TimeoutTextBox.TabIndex = 11;
// //
// panel2 // panel2
// //
@@ -301,7 +312,7 @@
this.ServerGroupBox.Location = new System.Drawing.Point(178, 0); this.ServerGroupBox.Location = new System.Drawing.Point(178, 0);
this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0); this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0);
this.ServerGroupBox.Name = "ServerGroupBox"; this.ServerGroupBox.Name = "ServerGroupBox";
this.ServerGroupBox.Size = new System.Drawing.Size(266, 227);
this.ServerGroupBox.Size = new System.Drawing.Size(266, 205);
this.ServerGroupBox.TabIndex = 0; this.ServerGroupBox.TabIndex = 0;
this.ServerGroupBox.TabStop = false; this.ServerGroupBox.TabStop = false;
this.ServerGroupBox.Text = "Server"; this.ServerGroupBox.Text = "Server";
@@ -338,7 +349,7 @@
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.Size = new System.Drawing.Size(444, 323);
this.tableLayoutPanel2.Size = new System.Drawing.Size(444, 301);
this.tableLayoutPanel2.TabIndex = 7; this.tableLayoutPanel2.TabIndex = 7;
// //
// tableLayoutPanel6 // tableLayoutPanel6
@@ -351,7 +362,7 @@
this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0); this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0);
this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0); this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0);
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 291);
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 269);
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 1; this.tableLayoutPanel6.RowCount = 1;
@@ -394,7 +405,7 @@
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0);
this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0);
this.tableLayoutPanel5.Location = new System.Drawing.Point(248, 227);
this.tableLayoutPanel5.Location = new System.Drawing.Point(248, 205);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel5.Name = "tableLayoutPanel5"; this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3);
@@ -438,7 +449,7 @@
this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0); this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0); this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right;
this.tableLayoutPanel3.Location = new System.Drawing.Point(285, 294);
this.tableLayoutPanel3.Location = new System.Drawing.Point(285, 272);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowCount = 1;
@@ -457,7 +468,7 @@
this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0); this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0); this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 227);
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 205);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowCount = 2;
@@ -478,26 +489,6 @@
this.DuplicateButton.UseVisualStyleBackColor = true; this.DuplicateButton.UseVisualStyleBackColor = true;
this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click); this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click);
// //
// TimeoutLabel
//
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.TimeoutLabel.AutoSize = true;
this.TimeoutLabel.Location = new System.Drawing.Point(6, 144);
this.TimeoutLabel.Name = "TimeoutLabel";
this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TimeoutLabel.Size = new System.Drawing.Size(77, 12);
this.TimeoutLabel.TabIndex = 10;
this.TimeoutLabel.Text = "Timeout(Sec)";
//
// TimeoutTextBox
//
this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.TimeoutTextBox.Location = new System.Drawing.Point(89, 140);
this.TimeoutTextBox.MaxLength = 5;
this.TimeoutTextBox.Name = "TimeoutTextBox";
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21);
this.TimeoutTextBox.TabIndex = 11;
//
// ConfigForm // ConfigForm
// //
this.AcceptButton = this.OKButton; this.AcceptButton = this.OKButton;
@@ -565,7 +556,6 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6;
private System.Windows.Forms.Button MoveDownButton; private System.Windows.Forms.Button MoveDownButton;
private System.Windows.Forms.Button MoveUpButton; private System.Windows.Forms.Button MoveUpButton;
private System.Windows.Forms.CheckBox OneTimeAuth;
private System.Windows.Forms.Button DuplicateButton; private System.Windows.Forms.Button DuplicateButton;
private System.Windows.Forms.Label TimeoutLabel; private System.Windows.Forms.Label TimeoutLabel;
private System.Windows.Forms.TextBox TimeoutTextBox; private System.Windows.Forms.TextBox TimeoutTextBox;


+ 0
- 3
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -50,7 +50,6 @@ namespace Shadowsocks.View
ProxyPortLabel.Text = I18N.GetString("Proxy Port"); ProxyPortLabel.Text = I18N.GetString("Proxy Port");
RemarksLabel.Text = I18N.GetString("Remarks"); RemarksLabel.Text = I18N.GetString("Remarks");
TimeoutLabel.Text = I18N.GetString("Timeout(Sec)"); TimeoutLabel.Text = I18N.GetString("Timeout(Sec)");
OneTimeAuth.Text = I18N.GetString("Onetime Authentication");
ServerGroupBox.Text = I18N.GetString("Server"); ServerGroupBox.Text = I18N.GetString("Server");
OKButton.Text = I18N.GetString("OK"); OKButton.Text = I18N.GetString("OK");
MyCancelButton.Text = I18N.GetString("Cancel"); MyCancelButton.Text = I18N.GetString("Cancel");
@@ -102,7 +101,6 @@ namespace Shadowsocks.View
TimeoutTextBox.Focus(); TimeoutTextBox.Focus();
return false; return false;
} }
server.auth = OneTimeAuth.Checked;
int localPort = int.Parse(ProxyPortTextBox.Text); int localPort = int.Parse(ProxyPortTextBox.Text);
Configuration.CheckServer(server); Configuration.CheckServer(server);
Configuration.CheckLocalPort(localPort); Configuration.CheckLocalPort(localPort);
@@ -131,7 +129,6 @@ namespace Shadowsocks.View
EncryptionSelect.Text = server.method ?? "aes-256-cfb"; EncryptionSelect.Text = server.method ?? "aes-256-cfb";
RemarksTextBox.Text = server.remarks; RemarksTextBox.Text = server.remarks;
TimeoutTextBox.Text = server.timeout.ToString(); TimeoutTextBox.Text = server.timeout.ToString();
OneTimeAuth.Checked = server.auth;
} }
} }


Loading…
Cancel
Save