Compare commits

..
16 Commits
Author SHA1 Message Date
icylogic 391b1de2cf Merge pull request #316 from icylogic/release/2.5.7
Release/2.5.7
2015-09-19 16:24:24 +08:00
icylogic 8d2574b003 bump 2.5.7 2015-09-19 16:16:05 +08:00
icylogic 8e1c2193e4 replace Appveyor badges 2015-09-19 16:15:45 +08:00
icylogic 86bf0b3b2c Merge pull request #315 from icylogic/hotfix/repeated_iv
no repeat random number generator by GangZhuo
2015-09-19 15:53:01 +08:00
Gang Zhuo 72ea01d566 no repeat random number generator
The stock code use class Random to generate IV, the Random is pseudo random number generator. The IV maybe repeat, this will cause shadowsocks-libev closed the sockets with the error message 'invalid password or cipher'. Reference https://github.com/shadowsocks/shadowsocks-libev/issues/389

Solution is use class RNGCryptoServiceProvider to generate IV, of course it's lower performance, but a little bit.
2015-09-19 15:49:19 +08:00
icylogic b4699492ad Merge pull request #309 from huhu2207/master
Fix a tiny bug
2015-09-04 18:58:40 +08:00
Jackson Ming Hu 2fdb26c063 Fix a tiny bug
Sometimes the users may hit enter key by mistake, and the form will
close without saving entries.
2015-09-04 11:59:23 +10:00
icylogic 0f72ba1e48 Merge pull request #308 from icylogic/master
Add more clear log for exceptions occured in ICMP tests
2015-09-02 01:47:08 +08:00
icylogic 968c9deca0 Merge branch 'hotfix/more_clear_log' 2015-09-02 01:38:12 +08:00
icylogic 879163dc2b Add more clear log 2015-09-02 01:23:32 +08:00
clowwindy b07a9ef3b0 Merge pull request #300 from kimw/master
improved `log viewer` windows
2015-08-19 07:42:45 -07:00
clowwindy c095030041 Update README.md 2015-08-19 22:36:38 +08:00
kimw 14381cf887 update version number 2015-08-19 22:23:54 +08:00
kimw e8fd92b9f7 Merge remote-tracking branch 'upstream/master' 2015-08-19 21:59:01 +08:00
kimw 99fe540e53 Merge remote-tracking branch 'upstream/master' 2015-08-19 21:55:40 +08:00
kimw cec6f79e7e improved log viewer:
1. add `clean log` feature
2. add `change font` feature
3. add `wrap text` feature
4. add `top most` feature
2015-08-19 21:52:16 +08:00
9 changed files with 225 additions and 60 deletions
+3
View File
@@ -1,3 +1,6 @@
2.5.7 2015-09-19
- Fix repeated IV.
2.5.6 2015-08-19
- Add portable mode. Create shadowsocks_portable_mode.txt to use it
- Support server reorder
+7 -2
View File
@@ -61,6 +61,11 @@ one HTTP proxy instance.
Please visit [Servers] for more information.
#### Portable Mode
If you want to put all temporary files into shadowsocks/temp folder instead of
system temp folder, create a `shadowsocks_portable_mode.txt` into shadowsocks folder.
#### Develop
Visual Studio 2015 is required.
@@ -70,8 +75,8 @@ Visual Studio 2015 is required.
GPLv3
[Appveyor]: https://ci.appveyor.com/project/clowwindy/shadowsocks-csharp
[Build Status]: https://ci.appveyor.com/api/projects/status/gknc8l1lxy423ehv/branch/master
[Appveyor]: https://ci.appveyor.com/project/icylogic/shadowsocks-windows-l9mwe
[Build Status]: https://ci.appveyor.com/api/projects/status/ytllr9yjkbpc2tu2/branch/master
[latest release]: https://github.com/shadowsocks/shadowsocks-csharp/releases
[GFWList]: https://github.com/gfwlist/gfwlist
[Servers]: https://github.com/shadowsocks/shadowsocks/wiki/Ports-and-Clients#linux--server-side
@@ -6,8 +6,8 @@ using System.Net.NetworkInformation;
using System.Threading;
using Shadowsocks.Model;
using System.Reflection;
using Shadowsocks.Util;
using Shadowsocks.Util;
namespace Shadowsocks.Controller
{
class AvailabilityStatistics
@@ -81,6 +81,7 @@ namespace Shadowsocks.Controller
}
catch (Exception e)
{
Console.WriteLine($"An exception occured when eveluating {server.FriendlyName()}");
Logging.LogUsefulException(e);
}
}
@@ -18,7 +18,7 @@ namespace Shadowsocks.Controller
public string LatestVersionURL;
public event EventHandler NewVersionFound;
public const string Version = "2.5.6";
public const string Version = "2.5.7";
public void CheckUpdate(Configuration config)
{
+11
View File
@@ -45,6 +45,17 @@ New server=未配置的服务器
Move &Up=上移(&U)
Move D&own=下移(&O)
# Log Form
&File=文件(&F)
&Open Location=在资源管理器中打开(&O)
E&xit=退出(&X)
&Clean logs=清空(&C)
&Font=字体(&F)
&Wrap text=自动换行(&W)
&Top most=置顶(&T)
Log Viewer=日志查看器
# QRCode Form
QRCode=二维码
+2 -1
View File
@@ -88,7 +88,8 @@ namespace Shadowsocks.Encryption
protected static void randBytes(byte[] buf, int length)
{
byte[] temp = new byte[length];
new Random().NextBytes(temp);
RNGCryptoServiceProvider rngServiceProvider = new RNGCryptoServiceProvider();
rngServiceProvider.GetBytes(temp);
temp.CopyTo(buf, 0);
}
+22
View File
@@ -146,6 +146,28 @@ namespace Shadowsocks.View
}
private void ConfigForm_KeyDown(object sender, KeyEventArgs e)
{
// Sometimes the users may hit enter key by mistake, and the form will close without saving entries.
if (e.KeyCode == Keys.Enter)
{
Server server = controller.GetCurrentServer();
if (!SaveOldSelectedServer())
{
return;
}
if (_modifiedConfiguration.configs.Count == 0)
{
MessageBox.Show(I18N.GetString("Please add at least one server"));
return;
}
controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.localPort);
controller.SelectServerIndex(_modifiedConfiguration.configs.IndexOf(server));
}
}
private void ServersListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (!ServersListBox.CanSelect)
+127 -41
View File
@@ -29,29 +29,37 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.textBox1 = new System.Windows.Forms.TextBox();
this.LogMessageTextBox = new System.Windows.Forms.TextBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.FileMenuItem = new System.Windows.Forms.MenuItem();
this.OpenLocationMenuItem = new System.Windows.Forms.MenuItem();
this.ExitMenuItem = new System.Windows.Forms.MenuItem();
this.panel1 = new System.Windows.Forms.Panel();
this.ChangeFontButton = new System.Windows.Forms.Button();
this.CleanLogsButton = new System.Windows.Forms.Button();
this.WrapTextCheckBox = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.TopMostCheckBox = new System.Windows.Forms.CheckBox();
this.panel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// textBox1
// LogMessageTextBox
//
this.textBox1.BackColor = System.Drawing.Color.Black;
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.ForeColor = System.Drawing.Color.White;
this.textBox1.Location = new System.Drawing.Point(0, 0);
this.textBox1.MaxLength = 2147483647;
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(547, 382);
this.textBox1.TabIndex = 0;
this.textBox1.WordWrap = false;
this.LogMessageTextBox.BackColor = System.Drawing.Color.Black;
this.LogMessageTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.LogMessageTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LogMessageTextBox.ForeColor = System.Drawing.Color.White;
this.LogMessageTextBox.Location = new System.Drawing.Point(3, 43);
this.LogMessageTextBox.MaxLength = 2147483647;
this.LogMessageTextBox.Multiline = true;
this.LogMessageTextBox.Name = "LogMessageTextBox";
this.LogMessageTextBox.ReadOnly = true;
this.LogMessageTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.LogMessageTextBox.Size = new System.Drawing.Size(541, 307);
this.LogMessageTextBox.TabIndex = 0;
this.LogMessageTextBox.WordWrap = false;
//
// contextMenuStrip1
//
@@ -61,34 +69,103 @@
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1});
this.FileMenuItem});
//
// menuItem1
// FileMenuItem
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem4});
this.menuItem1.Text = "&File";
this.FileMenuItem.Index = 0;
this.FileMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.OpenLocationMenuItem,
this.ExitMenuItem});
this.FileMenuItem.Text = "&File";
//
// menuItem2
// OpenLocationMenuItem
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "&Open Location";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
this.OpenLocationMenuItem.Index = 0;
this.OpenLocationMenuItem.Text = "&Open Location";
this.OpenLocationMenuItem.Click += new System.EventHandler(this.OpenLocationMenuItem_Click);
//
// menuItem4
// ExitMenuItem
//
this.menuItem4.Index = 1;
this.menuItem4.Text = "E&xit";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
this.ExitMenuItem.Index = 1;
this.ExitMenuItem.Text = "E&xit";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// panel1
//
this.panel1.Controls.Add(this.TopMostCheckBox);
this.panel1.Controls.Add(this.ChangeFontButton);
this.panel1.Controls.Add(this.CleanLogsButton);
this.panel1.Controls.Add(this.WrapTextCheckBox);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(541, 34);
this.panel1.TabIndex = 1;
//
// ChangeFontButton
//
this.ChangeFontButton.Location = new System.Drawing.Point(107, 4);
this.ChangeFontButton.Name = "ChangeFontButton";
this.ChangeFontButton.Size = new System.Drawing.Size(75, 23);
this.ChangeFontButton.TabIndex = 2;
this.ChangeFontButton.Text = "&Font";
this.ChangeFontButton.UseVisualStyleBackColor = true;
this.ChangeFontButton.Click += new System.EventHandler(this.ChangeFontButton_Click);
//
// CleanLogsButton
//
this.CleanLogsButton.Location = new System.Drawing.Point(9, 4);
this.CleanLogsButton.Name = "CleanLogsButton";
this.CleanLogsButton.Size = new System.Drawing.Size(75, 23);
this.CleanLogsButton.TabIndex = 1;
this.CleanLogsButton.Text = "&Clean logs";
this.CleanLogsButton.UseVisualStyleBackColor = true;
this.CleanLogsButton.Click += new System.EventHandler(this.CleanLogsButton_Click);
//
// WrapTextCheckBox
//
this.WrapTextCheckBox.AutoSize = true;
this.WrapTextCheckBox.Location = new System.Drawing.Point(209, 9);
this.WrapTextCheckBox.Name = "WrapTextCheckBox";
this.WrapTextCheckBox.Size = new System.Drawing.Size(78, 16);
this.WrapTextCheckBox.TabIndex = 0;
this.WrapTextCheckBox.Text = "&Wrap text";
this.WrapTextCheckBox.UseVisualStyleBackColor = true;
this.WrapTextCheckBox.CheckedChanged += new System.EventHandler(this.WrapTextCheckBox_CheckedChanged);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.LogMessageTextBox, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(547, 353);
this.tableLayoutPanel1.TabIndex = 2;
//
// TopMostCheckBox
//
this.TopMostCheckBox.AutoSize = true;
this.TopMostCheckBox.Location = new System.Drawing.Point(311, 9);
this.TopMostCheckBox.Name = "TopMostCheckBox";
this.TopMostCheckBox.Size = new System.Drawing.Size(72, 16);
this.TopMostCheckBox.TabIndex = 3;
this.TopMostCheckBox.Text = "&Top most";
this.TopMostCheckBox.UseVisualStyleBackColor = true;
this.TopMostCheckBox.CheckedChanged += new System.EventHandler(this.TopMostCheckBox_CheckedChanged);
//
// LogForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(547, 382);
this.Controls.Add(this.textBox1);
this.ClientSize = new System.Drawing.Size(547, 353);
this.Controls.Add(this.tableLayoutPanel1);
this.Menu = this.mainMenu1;
this.Name = "LogForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
@@ -96,18 +173,27 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LogForm_FormClosing);
this.Load += new System.EventHandler(this.LogForm_Load);
this.Shown += new System.EventHandler(this.LogForm_Shown);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox LogMessageTextBox;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem FileMenuItem;
private System.Windows.Forms.MenuItem OpenLocationMenuItem;
private System.Windows.Forms.MenuItem ExitMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.CheckBox WrapTextCheckBox;
private System.Windows.Forms.Button CleanLogsButton;
private System.Windows.Forms.Button ChangeFontButton;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.CheckBox TopMostCheckBox;
}
}
+49 -13
View File
@@ -1,4 +1,5 @@
using Shadowsocks.Properties;
using Shadowsocks.Controller;
using Shadowsocks.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -23,6 +24,20 @@ namespace Shadowsocks.View
this.filename = filename;
InitializeComponent();
this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
UpdateTexts();
}
private void UpdateTexts()
{
FileMenuItem.Text = I18N.GetString("&File");
OpenLocationMenuItem.Text = I18N.GetString("&Open Location");
ExitMenuItem.Text = I18N.GetString("E&xit");
CleanLogsButton.Text = I18N.GetString("&Clean logs");
ChangeFontButton.Text = I18N.GetString("&Font");
WrapTextCheckBox.Text = I18N.GetString("&Wrap text");
TopMostCheckBox.Text = I18N.GetString("&Top most");
this.Text = I18N.GetString("Log Viewer");
}
private void Timer_Tick(object sender, EventArgs e)
@@ -43,9 +58,9 @@ namespace Shadowsocks.View
string line = "";
while ((line = reader.ReadLine()) != null)
textBox1.AppendText(line + "\r\n");
LogMessageTextBox.AppendText(line + "\r\n");
textBox1.ScrollToCaret();
LogMessageTextBox.ScrollToCaret();
lastOffset = reader.BaseStream.Position;
}
@@ -63,12 +78,12 @@ namespace Shadowsocks.View
while ((line = reader.ReadLine()) != null)
{
changed = true;
textBox1.AppendText(line + "\r\n");
LogMessageTextBox.AppendText(line + "\r\n");
}
if (changed)
{
textBox1.ScrollToCaret();
LogMessageTextBox.ScrollToCaret();
}
lastOffset = reader.BaseStream.Position;
@@ -89,26 +104,47 @@ namespace Shadowsocks.View
timer.Stop();
}
private void menuItem2_Click(object sender, EventArgs e)
private void OpenLocationMenuItem_Click(object sender, EventArgs e)
{
string argument = "/select, \"" + filename + "\"";
Console.WriteLine(argument);
System.Diagnostics.Process.Start("explorer.exe", argument);
}
private void menuItem3_Click(object sender, EventArgs e)
{
}
private void menuItem4_Click(object sender, EventArgs e)
private void ExitMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void LogForm_Shown(object sender, EventArgs e)
{
textBox1.ScrollToCaret();
LogMessageTextBox.ScrollToCaret();
}
private void WrapTextCheckBox_CheckedChanged(object sender, EventArgs e)
{
LogMessageTextBox.WordWrap = WrapTextCheckBox.Checked;
LogMessageTextBox.ScrollToCaret();
}
private void CleanLogsButton_Click(object sender, EventArgs e)
{
LogMessageTextBox.Clear();
}
private void ChangeFontButton_Click(object sender, EventArgs e)
{
FontDialog fd = new FontDialog();
fd.Font = LogMessageTextBox.Font;
if (fd.ShowDialog() == DialogResult.OK)
{
LogMessageTextBox.Font = fd.Font;
}
}
private void TopMostCheckBox_CheckedChanged(object sender, EventArgs e)
{
this.TopMost = TopMostCheckBox.Checked;
}
}
}