@@ -124,7 +124,7 @@ namespace Shadowsocks.Controller | |||
{ | |||
throw new ArgumentException("No server configured"); | |||
} | |||
this.encryptor = EncryptorFactory.GetEncryptor(server.method, server.password); | |||
this.encryptor = EncryptorFactory.GetEncryptor(server.method, server.password, server.one_time_auth); | |||
this.server = server; | |||
} | |||
@@ -39,6 +39,7 @@ Password=密码 | |||
Encryption=加密 | |||
Proxy Port=代理端口 | |||
Remarks=备注 | |||
One-time authorization=一次性授权 | |||
OK=确定 | |||
Cancel=取消 | |||
New server=未配置的服务器 | |||
@@ -8,14 +8,16 @@ namespace Shadowsocks.Encryption | |||
{ | |||
public const int MAX_INPUT_SIZE = 32768; | |||
protected EncryptorBase(string method, string password) | |||
protected EncryptorBase(string method, string password, bool onetimeauth) | |||
{ | |||
Method = method; | |||
Password = password; | |||
OnetimeAuth = onetimeauth; | |||
} | |||
protected string Method; | |||
protected string Password; | |||
protected bool OnetimeAuth; | |||
protected byte[] GetPasswordHash() | |||
{ | |||
@@ -8,7 +8,7 @@ namespace Shadowsocks.Encryption | |||
{ | |||
private static Dictionary<string, Type> _registeredEncryptors; | |||
private static Type[] _constructorTypes = new Type[] { typeof(string), typeof(string) }; | |||
private static Type[] _constructorTypes = new Type[] { typeof(string), typeof(string), typeof(bool) }; | |||
static EncryptorFactory() | |||
{ | |||
@@ -27,7 +27,7 @@ namespace Shadowsocks.Encryption | |||
} | |||
} | |||
public static IEncryptor GetEncryptor(string method, string password) | |||
public static IEncryptor GetEncryptor(string method, string password, bool onetimeauth = false) | |||
{ | |||
if (string.IsNullOrEmpty(method)) | |||
{ | |||
@@ -36,7 +36,7 @@ namespace Shadowsocks.Encryption | |||
method = method.ToLowerInvariant(); | |||
Type t = _registeredEncryptors[method]; | |||
ConstructorInfo c = t.GetConstructor(_constructorTypes); | |||
IEncryptor result = (IEncryptor)c.Invoke(new object[] { method, password }); | |||
IEncryptor result = (IEncryptor)c.Invoke(new object[] { method, password, onetimeauth }); | |||
return result; | |||
} | |||
} | |||
@@ -2,12 +2,19 @@ | |||
using System.Collections.Generic; | |||
using System.Security.Cryptography; | |||
using System.Text; | |||
using System.Net; | |||
namespace Shadowsocks.Encryption | |||
{ | |||
public abstract class IVEncryptor | |||
: EncryptorBase | |||
{ | |||
public const int ONETIMEAUTH_FLAG = 0x10; | |||
public const int ADDRTYPE_MASK = 0xF; | |||
public const int ONETIMEAUTH_BYTES = 16; | |||
public const int CRC_BUF_LEN = 128; | |||
public const int CRC_BYTES = 2; | |||
protected static byte[] tempbuf = new byte[MAX_INPUT_SIZE]; | |||
protected Dictionary<string, int[]> ciphers; | |||
@@ -25,11 +32,17 @@ namespace Shadowsocks.Encryption | |||
protected byte[] _key; | |||
protected int keyLen; | |||
protected int ivLen; | |||
protected byte[] crc_buf; | |||
protected int crc_idx = 0; | |||
public IVEncryptor(string method, string password) | |||
: base(method, password) | |||
public IVEncryptor(string method, string password, bool onetimeauth) | |||
: base(method, password, onetimeauth) | |||
{ | |||
InitKey(method, password); | |||
if (OnetimeAuth) | |||
{ | |||
crc_buf = new byte[CRC_BUF_LEN]; | |||
} | |||
} | |||
protected abstract Dictionary<string, int[]> getCiphers(); | |||
@@ -112,6 +125,28 @@ namespace Shadowsocks.Encryption | |||
protected abstract void cipherUpdate(bool isCipher, int length, byte[] buf, byte[] outbuf); | |||
protected int GetSSHeadLength(byte[] buf, int length) | |||
{ | |||
int len = 0; | |||
int atyp = length > 0 ? (buf[0] & ADDRTYPE_MASK) : 0; | |||
if (atyp == 1) | |||
{ | |||
len = 7; // atyp (1 bytes) + ipv4 (4 bytes) + port (2 bytes) | |||
} | |||
else if (atyp == 3 && length > 1) | |||
{ | |||
int nameLen = buf[1]; | |||
len = 4 + nameLen; // atyp (1 bytes) + name length (1 bytes) + name (n bytes) + port (2 bytes) | |||
} | |||
else if (atyp == 4) | |||
{ | |||
len = 19; // atyp (1 bytes) + ipv6 (16 bytes) + port (2 bytes) | |||
} | |||
if (len == 0 || len > length) | |||
throw new Exception($"invalid header with addr type {atyp}"); | |||
return len; | |||
} | |||
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength) | |||
{ | |||
if (!_encryptIVSent) | |||
@@ -122,6 +157,24 @@ namespace Shadowsocks.Encryption | |||
outlength = length + ivLen; | |||
lock (tempbuf) | |||
{ | |||
if (OnetimeAuth) | |||
{ | |||
lock(crc_buf) | |||
{ | |||
int headLen = GetSSHeadLength(buf, length); | |||
int data_len = length - headLen; | |||
Buffer.BlockCopy(buf, headLen, buf, headLen + ONETIMEAUTH_BYTES, data_len); | |||
buf[0] |= ONETIMEAUTH_FLAG; | |||
byte[] auth = new byte[ONETIMEAUTH_BYTES]; | |||
Sodium.ss_onetimeauth(auth, buf, headLen, _encryptIV, ivLen, _key, keyLen); | |||
Buffer.BlockCopy(auth, 0, buf, headLen, ONETIMEAUTH_BYTES); | |||
int buf_offset = headLen + ONETIMEAUTH_BYTES; | |||
int rc = Sodium.ss_gen_crc(buf, ref buf_offset, ref data_len, crc_buf, ref crc_idx, buf.Length); | |||
if (rc != 0) | |||
throw new Exception("failed to generate crc"); | |||
length = headLen + ONETIMEAUTH_BYTES + data_len; | |||
} | |||
} | |||
cipherUpdate(true, length, buf, tempbuf); | |||
outlength = length + ivLen; | |||
Buffer.BlockCopy(tempbuf, 0, outbuf, ivLen, length); | |||
@@ -129,6 +182,16 @@ namespace Shadowsocks.Encryption | |||
} | |||
else | |||
{ | |||
if (OnetimeAuth) | |||
{ | |||
lock(crc_buf) | |||
{ | |||
int buf_offset = 0; | |||
int rc = Sodium.ss_gen_crc(buf, ref buf_offset, ref length, crc_buf, ref crc_idx, buf.Length); | |||
if (rc != 0) | |||
throw new Exception("failed to generate crc"); | |||
} | |||
} | |||
outlength = length; | |||
cipherUpdate(true, length, buf, outbuf); | |||
} | |||
@@ -154,5 +217,6 @@ namespace Shadowsocks.Encryption | |||
cipherUpdate(false, length, buf, outbuf); | |||
} | |||
} | |||
} | |||
} |
@@ -16,8 +16,8 @@ namespace Shadowsocks.Encryption | |||
private IntPtr _encryptCtx = IntPtr.Zero; | |||
private IntPtr _decryptCtx = IntPtr.Zero; | |||
public PolarSSLEncryptor(string method, string password) | |||
: base(method, password) | |||
public PolarSSLEncryptor(string method, string password, bool onetimeauth) | |||
: base(method, password, onetimeauth) | |||
{ | |||
InitKey(method, password); | |||
} | |||
@@ -12,8 +12,15 @@ namespace Shadowsocks.Encryption | |||
public class Sodium | |||
{ | |||
const string DLLNAME = "libsscrypto"; | |||
const string DLLNAME2 = "libsscrypto2"; | |||
static Sodium() | |||
{ | |||
LoadSSCryptoLibrary(); | |||
LoadSSCrypto2Library(); | |||
} | |||
static void LoadSSCryptoLibrary() | |||
{ | |||
string tempPath = Utils.GetTempPath(); | |||
string dllPath = tempPath + "/libsscrypto.dll"; | |||
@@ -29,7 +36,24 @@ namespace Shadowsocks.Encryption | |||
{ | |||
Console.WriteLine(e.ToString()); | |||
} | |||
LoadLibrary(dllPath); | |||
} | |||
static void LoadSSCrypto2Library() | |||
{ | |||
string tempPath = Utils.GetTempPath(); | |||
string dllPath = tempPath + "/libsscrypto2.dll"; | |||
try | |||
{ | |||
FileManager.UncompressFile(dllPath, Resources.libsscrypto2_dll); | |||
LoadLibrary(dllPath); | |||
} | |||
catch (IOException) | |||
{ | |||
} | |||
catch (Exception e) | |||
{ | |||
Console.WriteLine(e.ToString()); | |||
} | |||
} | |||
[DllImport("Kernel32.dll")] | |||
@@ -40,5 +64,16 @@ namespace Shadowsocks.Encryption | |||
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] | |||
public extern static void crypto_stream_chacha20_xor_ic(byte[] c, byte[] m, ulong mlen, byte[] n, ulong ic, byte[] k); | |||
[DllImport(DLLNAME2, CallingConvention = CallingConvention.Cdecl)] | |||
public extern static int ss_gen_crc(byte[] buf, ref int buf_offset, ref int data_len, | |||
byte[] crc_buf, ref int crc_idx, int buf_size); | |||
[DllImport(DLLNAME2, CallingConvention = CallingConvention.Cdecl)] | |||
public extern static int ss_onetimeauth(byte[] auth, | |||
byte[] msg, int msg_len, | |||
byte[] iv, int iv_len, | |||
byte[] key, int key_len); | |||
} | |||
} | |||
@@ -20,8 +20,8 @@ namespace Shadowsocks.Encryption | |||
protected ulong _encryptIC; | |||
protected ulong _decryptIC; | |||
public SodiumEncryptor(string method, string password) | |||
: base(method, password) | |||
public SodiumEncryptor(string method, string password, bool onetimeauth) | |||
: base(method, password, onetimeauth) | |||
{ | |||
InitKey(method, password); | |||
} | |||
@@ -6,8 +6,8 @@ namespace Shadowsocks.Encryption | |||
public class TableEncryptor | |||
: EncryptorBase | |||
{ | |||
public TableEncryptor(string method, string password) | |||
: base(method, password) | |||
public TableEncryptor(string method, string password, bool onetimeauth) | |||
: base(method, password, onetimeauth) | |||
{ | |||
byte[] hash = GetPasswordHash(); | |||
// TODO endian | |||
@@ -17,6 +17,7 @@ namespace Shadowsocks.Model | |||
public string password; | |||
public string method; | |||
public string remarks; | |||
public bool one_time_auth; | |||
public override int GetHashCode() | |||
{ | |||
@@ -52,6 +53,7 @@ namespace Shadowsocks.Model | |||
this.method = "aes-256-cfb"; | |||
this.password = ""; | |||
this.remarks = ""; | |||
this.one_time_auth = false; | |||
} | |||
public Server(string ssURL) : this() | |||
@@ -88,6 +90,9 @@ namespace Shadowsocks.Model | |||
string[] parts = beforeAt.Split(new[] { ':' }); | |||
this.method = parts[0]; | |||
this.password = parts[1]; | |||
//TODO: read one_time_auth | |||
} | |||
catch (IndexOutOfRangeException) | |||
{ | |||
@@ -1,10 +1,10 @@ | |||
//------------------------------------------------------------------------------ | |||
// <auto-generated> | |||
// This code was generated by a tool. | |||
// Runtime Version:4.0.30319.42000 | |||
// 此代码由工具生成。 | |||
// 运行时版本:4.0.30319.42000 | |||
// | |||
// Changes to this file may cause incorrect behavior and will be lost if | |||
// the code is regenerated. | |||
// 对此文件的更改可能会导致不正确的行为,并且如果 | |||
// 重新生成代码,这些更改将会丢失。 | |||
// </auto-generated> | |||
//------------------------------------------------------------------------------ | |||
@@ -13,12 +13,12 @@ namespace Shadowsocks.Properties { | |||
/// <summary> | |||
/// A strongly-typed resource class, for looking up localized strings, etc. | |||
/// 一个强类型的资源类,用于查找本地化的字符串等。 | |||
/// </summary> | |||
// This class was auto-generated by the StronglyTypedResourceBuilder | |||
// class via a tool like ResGen or Visual Studio. | |||
// To add or remove a member, edit your .ResX file then rerun ResGen | |||
// with the /str option, or rebuild your VS project. | |||
// 此类是由 StronglyTypedResourceBuilder | |||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 | |||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen | |||
// (以 /str 作为命令选项),或重新生成 VS 项目。 | |||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
@@ -33,7 +33,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Returns the cached ResourceManager instance used by this class. | |||
/// 返回此类使用的缓存的 ResourceManager 实例。 | |||
/// </summary> | |||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
internal static global::System.Resources.ResourceManager ResourceManager { | |||
@@ -47,8 +47,8 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Overrides the current thread's CurrentUICulture property for all | |||
/// resource lookups using this strongly typed resource class. | |||
/// 使用此强类型资源类,为所有资源查找 | |||
/// 重写当前线程的 CurrentUICulture 属性。 | |||
/// </summary> | |||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
internal static global::System.Globalization.CultureInfo Culture { | |||
@@ -61,7 +61,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] abp_js { | |||
get { | |||
@@ -71,30 +71,28 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to # translation for Simplified Chinese | |||
/// | |||
///Shadowsocks=Shadowsocks | |||
/// | |||
///# Menu items | |||
/// | |||
///Enable System Proxy=启用系统代理 | |||
///Mode=系统代理模式 | |||
///PAC=PAC 模式 | |||
///Global=全局模式 | |||
///Servers=服务器 | |||
///Edit Servers...=编辑服务器... | |||
///Start on Boot=开机启动 | |||
///Allow Clients from LAN=允许来自局域网的连接 | |||
///Local PAC=使用本地 PAC | |||
///Online PAC=使用在线 PAC | |||
///Edit Local PAC File...=编辑本地 PAC 文件... | |||
///Update Local PAC from GFWList=从 GFWList 更新本地 PAC | |||
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则... | |||
///Show QRCode...=显示二维码... | |||
///Scan QRCode from Screen...=扫描屏幕上的二维码... | |||
///Show Logs...=显示日志... | |||
///About...=关于... | |||
///Quit=退出 [rest of string was truncated]";. | |||
/// 查找类似 # translation for Simplified Chinese | |||
/// | |||
///Shadowsocks=Shadowsocks | |||
/// | |||
///# Menu items | |||
/// | |||
///Enable System Proxy=启用系统代理 | |||
///Mode=系统代理模式 | |||
///PAC=PAC 模式 | |||
///Global=全局模式 | |||
///Servers=服务器 | |||
///Edit Servers...=编辑服务器... | |||
///Start on Boot=开机启动 | |||
///Allow Clients from LAN=允许来自局域网的连接 | |||
///Local PAC=使用本地 PAC | |||
///Online PAC=使用在线 PAC | |||
///Edit Local PAC File...=编辑本地 PAC 文件... | |||
///Update Local PAC from GFWList=从 GFWList 更新本地 PAC | |||
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则... | |||
///Show QRCode...=显示二维码... | |||
///Scan QRCode from Screen...=扫描屏幕上的二维码... | |||
///Availability Statistic [字符串的其余部分被截断]"; 的本地化字符串。 | |||
/// </summary> | |||
internal static string cn { | |||
get { | |||
@@ -103,7 +101,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] libsscrypto_dll { | |||
get { | |||
@@ -113,7 +111,17 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] libsscrypto2_dll { | |||
get { | |||
object obj = ResourceManager.GetObject("libsscrypto2_dll", resourceCulture); | |||
return ((byte[])(obj)); | |||
} | |||
} | |||
/// <summary> | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] mgwz_dll { | |||
get { | |||
@@ -123,11 +131,11 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to listen-address __POLIPO_BIND_IP__:8123 | |||
/// 查找类似 listen-address __POLIPO_BIND_IP__:8123 | |||
///show-on-task-bar 0 | |||
///activity-animation 0 | |||
///forward-socks5 / 127.0.0.1:__SOCKS_PORT__ . | |||
///hide-console. | |||
///hide-console 的本地化字符串。 | |||
/// </summary> | |||
internal static string privoxy_conf { | |||
get { | |||
@@ -136,7 +144,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] privoxy_exe { | |||
get { | |||
@@ -146,7 +154,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] proxy_pac_txt { | |||
get { | |||
@@ -156,7 +164,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss16 { | |||
get { | |||
@@ -166,7 +174,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss20 { | |||
get { | |||
@@ -176,7 +184,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss24 { | |||
get { | |||
@@ -186,7 +194,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ssw128 { | |||
get { | |||
@@ -196,9 +204,9 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to ! Put user rules line by line in this file. | |||
/// 查找类似 ! Put user rules line by line in this file. | |||
///! See https://adblockplus.org/en/filter-cheatsheet | |||
///. | |||
/// 的本地化字符串。 | |||
/// </summary> | |||
internal static string user_rule { | |||
get { | |||
@@ -124,6 +124,9 @@ | |||
<data name="cn" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\data\cn.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | |||
</data> | |||
<data name="libsscrypto2_dll" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\Data\libsscrypto2.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</data> | |||
<data name="libsscrypto_dll" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</data> | |||
@@ -55,6 +55,7 @@ | |||
this.ProxyPortLabel = new System.Windows.Forms.Label(); | |||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); | |||
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); | |||
this.OneTimeAuth = new System.Windows.Forms.CheckBox(); | |||
this.tableLayoutPanel1.SuspendLayout(); | |||
this.ServerGroupBox.SuspendLayout(); | |||
this.tableLayoutPanel2.SuspendLayout(); | |||
@@ -81,18 +82,20 @@ | |||
this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2); | |||
this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 3); | |||
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 3); | |||
this.tableLayoutPanel1.Controls.Add(this.OneTimeAuth, 1, 6); | |||
this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21); | |||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); | |||
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; | |||
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); | |||
this.tableLayoutPanel1.RowCount = 6; | |||
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()); | |||
this.tableLayoutPanel1.Size = new System.Drawing.Size(238, 137); | |||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); | |||
this.tableLayoutPanel1.Size = new System.Drawing.Size(238, 160); | |||
this.tableLayoutPanel1.TabIndex = 0; | |||
// | |||
// RemarksTextBox | |||
@@ -102,7 +105,7 @@ | |||
this.RemarksTextBox.MaxLength = 32; | |||
this.RemarksTextBox.Name = "RemarksTextBox"; | |||
this.RemarksTextBox.Size = new System.Drawing.Size(160, 20); | |||
this.RemarksTextBox.TabIndex = 10; | |||
this.RemarksTextBox.TabIndex = 4; | |||
this.RemarksTextBox.WordWrap = false; | |||
// | |||
// RemarksLabel | |||
@@ -188,7 +191,7 @@ | |||
// | |||
// EncryptionSelect | |||
// | |||
this.EncryptionSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |||
this.EncryptionSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |||
| System.Windows.Forms.AnchorStyles.Right))); | |||
this.EncryptionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; | |||
this.EncryptionSelect.FormattingEnabled = true; | |||
@@ -226,7 +229,7 @@ | |||
this.OKButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); | |||
this.OKButton.Name = "OKButton"; | |||
this.OKButton.Size = new System.Drawing.Size(75, 23); | |||
this.OKButton.TabIndex = 8; | |||
this.OKButton.TabIndex = 12; | |||
this.OKButton.Text = "OK"; | |||
this.OKButton.UseVisualStyleBackColor = true; | |||
this.OKButton.Click += new System.EventHandler(this.OKButton_Click); | |||
@@ -239,7 +242,7 @@ | |||
this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); | |||
this.MyCancelButton.Name = "MyCancelButton"; | |||
this.MyCancelButton.Size = new System.Drawing.Size(75, 23); | |||
this.MyCancelButton.TabIndex = 9; | |||
this.MyCancelButton.TabIndex = 13; | |||
this.MyCancelButton.Text = "Cancel"; | |||
this.MyCancelButton.UseVisualStyleBackColor = true; | |||
this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click); | |||
@@ -251,7 +254,7 @@ | |||
this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3); | |||
this.DeleteButton.Name = "DeleteButton"; | |||
this.DeleteButton.Size = new System.Drawing.Size(80, 23); | |||
this.DeleteButton.TabIndex = 7; | |||
this.DeleteButton.TabIndex = 9; | |||
this.DeleteButton.Text = "&Delete"; | |||
this.DeleteButton.UseVisualStyleBackColor = true; | |||
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); | |||
@@ -263,7 +266,7 @@ | |||
this.AddButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); | |||
this.AddButton.Name = "AddButton"; | |||
this.AddButton.Size = new System.Drawing.Size(80, 23); | |||
this.AddButton.TabIndex = 6; | |||
this.AddButton.TabIndex = 8; | |||
this.AddButton.Text = "&Add"; | |||
this.AddButton.UseVisualStyleBackColor = true; | |||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click); | |||
@@ -276,8 +279,8 @@ | |||
this.ServerGroupBox.Location = new System.Drawing.Point(178, 0); | |||
this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0); | |||
this.ServerGroupBox.Name = "ServerGroupBox"; | |||
this.ServerGroupBox.Size = new System.Drawing.Size(249, 174); | |||
this.ServerGroupBox.TabIndex = 6; | |||
this.ServerGroupBox.Size = new System.Drawing.Size(249, 197); | |||
this.ServerGroupBox.TabIndex = 0; | |||
this.ServerGroupBox.TabStop = false; | |||
this.ServerGroupBox.Text = "Server"; | |||
// | |||
@@ -285,12 +288,11 @@ | |||
// | |||
this.ServersListBox.FormattingEnabled = true; | |||
this.ServersListBox.IntegralHeight = false; | |||
this.ServersListBox.ItemHeight = 12; | |||
this.ServersListBox.Location = new System.Drawing.Point(0, 0); | |||
this.ServersListBox.Margin = new System.Windows.Forms.Padding(0); | |||
this.ServersListBox.Name = "ServersListBox"; | |||
this.ServersListBox.Size = new System.Drawing.Size(166, 148); | |||
this.ServersListBox.TabIndex = 5; | |||
this.ServersListBox.TabIndex = 7; | |||
this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); | |||
// | |||
// tableLayoutPanel2 | |||
@@ -313,7 +315,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.Size = new System.Drawing.Size(427, 238); | |||
this.tableLayoutPanel2.Size = new System.Drawing.Size(427, 261); | |||
this.tableLayoutPanel2.TabIndex = 7; | |||
// | |||
// tableLayoutPanel6 | |||
@@ -326,7 +328,7 @@ | |||
this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0); | |||
this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0); | |||
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top; | |||
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 211); | |||
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 229); | |||
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); | |||
this.tableLayoutPanel6.Name = "tableLayoutPanel6"; | |||
this.tableLayoutPanel6.RowCount = 1; | |||
@@ -341,7 +343,7 @@ | |||
this.MoveDownButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3); | |||
this.MoveDownButton.Name = "MoveDownButton"; | |||
this.MoveDownButton.Size = new System.Drawing.Size(80, 23); | |||
this.MoveDownButton.TabIndex = 7; | |||
this.MoveDownButton.TabIndex = 11; | |||
this.MoveDownButton.Text = "Move D&own"; | |||
this.MoveDownButton.UseVisualStyleBackColor = true; | |||
this.MoveDownButton.Click += new System.EventHandler(this.MoveDownButton_Click); | |||
@@ -353,7 +355,7 @@ | |||
this.MoveUpButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); | |||
this.MoveUpButton.Name = "MoveUpButton"; | |||
this.MoveUpButton.Size = new System.Drawing.Size(80, 23); | |||
this.MoveUpButton.TabIndex = 6; | |||
this.MoveUpButton.TabIndex = 10; | |||
this.MoveUpButton.Text = "Move &Up"; | |||
this.MoveUpButton.UseVisualStyleBackColor = true; | |||
this.MoveUpButton.Click += new System.EventHandler(this.MoveUpButton_Click); | |||
@@ -369,7 +371,7 @@ | |||
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); | |||
this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0); | |||
this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0); | |||
this.tableLayoutPanel5.Location = new System.Drawing.Point(241, 174); | |||
this.tableLayoutPanel5.Location = new System.Drawing.Point(241, 197); | |||
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); | |||
this.tableLayoutPanel5.Name = "tableLayoutPanel5"; | |||
this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3); | |||
@@ -389,7 +391,7 @@ | |||
this.ProxyPortTextBox.MaxLength = 10; | |||
this.ProxyPortTextBox.Name = "ProxyPortTextBox"; | |||
this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 20); | |||
this.ProxyPortTextBox.TabIndex = 4; | |||
this.ProxyPortTextBox.TabIndex = 6; | |||
this.ProxyPortTextBox.WordWrap = false; | |||
// | |||
// ProxyPortLabel | |||
@@ -413,7 +415,7 @@ | |||
this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0); | |||
this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0); | |||
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; | |||
this.tableLayoutPanel3.Location = new System.Drawing.Point(268, 209); | |||
this.tableLayoutPanel3.Location = new System.Drawing.Point(268, 232); | |||
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); | |||
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; | |||
this.tableLayoutPanel3.RowCount = 1; | |||
@@ -431,7 +433,7 @@ | |||
this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0); | |||
this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0); | |||
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top; | |||
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 174); | |||
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 197); | |||
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); | |||
this.tableLayoutPanel4.Name = "tableLayoutPanel4"; | |||
this.tableLayoutPanel4.RowCount = 1; | |||
@@ -439,6 +441,16 @@ | |||
this.tableLayoutPanel4.Size = new System.Drawing.Size(166, 32); | |||
this.tableLayoutPanel4.TabIndex = 8; | |||
// | |||
// OneTimeAuth | |||
// | |||
this.OneTimeAuth.AutoSize = true; | |||
this.OneTimeAuth.Location = new System.Drawing.Point(72, 137); | |||
this.OneTimeAuth.Name = "OneTimeAuth"; | |||
this.OneTimeAuth.Size = new System.Drawing.Size(131, 17); | |||
this.OneTimeAuth.TabIndex = 5; | |||
this.OneTimeAuth.Text = "One-time authorization"; | |||
this.OneTimeAuth.UseVisualStyleBackColor = true; | |||
// | |||
// ConfigForm | |||
// | |||
this.AcceptButton = this.OKButton; | |||
@@ -505,6 +517,7 @@ | |||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6; | |||
private System.Windows.Forms.Button MoveDownButton; | |||
private System.Windows.Forms.Button MoveUpButton; | |||
private System.Windows.Forms.CheckBox OneTimeAuth; | |||
} | |||
} | |||
@@ -48,6 +48,7 @@ namespace Shadowsocks.View | |||
EncryptionLabel.Text = I18N.GetString("Encryption"); | |||
ProxyPortLabel.Text = I18N.GetString("Proxy Port"); | |||
RemarksLabel.Text = I18N.GetString("Remarks"); | |||
OneTimeAuth.Text = I18N.GetString("One-time authorization"); | |||
ServerGroupBox.Text = I18N.GetString("Server"); | |||
OKButton.Text = I18N.GetString("OK"); | |||
MyCancelButton.Text = I18N.GetString("Cancel"); | |||
@@ -82,7 +83,8 @@ namespace Shadowsocks.View | |||
server_port = int.Parse(ServerPortTextBox.Text), | |||
password = PasswordTextBox.Text, | |||
method = EncryptionSelect.Text, | |||
remarks = RemarksTextBox.Text | |||
remarks = RemarksTextBox.Text, | |||
one_time_auth = OneTimeAuth.Checked | |||
}; | |||
int localPort = int.Parse(ProxyPortTextBox.Text); | |||
Configuration.CheckServer(server); | |||
@@ -115,6 +117,7 @@ namespace Shadowsocks.View | |||
ProxyPortTextBox.Text = _modifiedConfiguration.localPort.ToString(); | |||
EncryptionSelect.Text = server.method ?? "aes-256-cfb"; | |||
RemarksTextBox.Text = server.remarks; | |||
OneTimeAuth.Checked = server.one_time_auth; | |||
} | |||
} | |||
@@ -205,6 +205,7 @@ | |||
</None> | |||
<None Include="Data\abp.js.gz" /> | |||
<None Include="Data\libsscrypto.dll.gz" /> | |||
<None Include="Data\libsscrypto2.dll.gz" /> | |||
<None Include="Data\mgwz.dll.gz" /> | |||
<None Include="Data\privoxy.exe.gz" /> | |||
<None Include="Data\proxy.pac.txt.gz" /> | |||