This commit is contained in:
Gang Zhuo
2015-09-25 04:42:56 -04:00
parent c5e27486fb
commit 098640e792
10 changed files with 85 additions and 64 deletions
@@ -8,7 +8,7 @@ namespace Shadowsocks.Encryption
{
private static Dictionary<string, Type> _registeredEncryptors;
private static Type[] _constructorTypes = new Type[] { typeof(string), typeof(string), typeof(bool) };
private static Type[] _constructorTypes = new Type[] { typeof(string), typeof(string), typeof(bool), typeof(bool) };
static EncryptorFactory()
{
@@ -27,7 +27,7 @@ namespace Shadowsocks.Encryption
}
}
public static IEncryptor GetEncryptor(string method, string password, bool onetimeauth)
public static IEncryptor GetEncryptor(string method, string password, bool onetimeauth, bool isudp)
{
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, onetimeauth });
IEncryptor result = (IEncryptor)c.Invoke(new object[] { method, password, onetimeauth, isudp });
return result;
}
}