Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25c1d02395 | ||
|
|
897934c233 | ||
|
|
fdbd3a975b | ||
|
|
7fd9ce2bc3 | ||
|
|
c168af6975 | ||
|
|
3329291ab9 | ||
|
|
1e04279d37 | ||
|
|
20fa87ba89 | ||
|
|
5db7c79407 | ||
|
|
85bd65e021 | ||
|
|
7197e46b53 | ||
|
|
b2c0bba953 | ||
|
|
d266ea2e39 | ||
|
|
a5b11aee34 | ||
|
|
e2b9822224 | ||
|
|
a12a70ccf0 | ||
|
|
b2645f9f0a | ||
|
|
4d4f1753c7 | ||
|
|
502397b5f9 | ||
|
|
f042e91305 | ||
|
|
d1219bbfca | ||
|
|
7564e79ede | ||
|
|
511feb2e31 | ||
|
|
647f986003 | ||
|
|
8cd64d4022 | ||
|
|
7021edd61f | ||
|
|
f7cd2390b2 | ||
|
|
218925e191 | ||
|
|
dc718a583b |
@@ -1,19 +1,20 @@
|
|||||||
Please read Wiki carefully, especially https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting.
|
Please read Wiki carefully, especially / 提问前请先阅读wiki https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting.
|
||||||
Please answer these questions before submitting your issue. Thanks!
|
Or search from issue board / 或在issue board中搜索 https://github.com/shadowsocks/shadowsocks-windows/issues?utf8=%E2%9C%93&q=is%3Aissue
|
||||||
|
Please answer these questions before submitting your issue. Thanks! / 请按照以下格式描述你的问题
|
||||||
|
|
||||||
### Version(release version or AppVeyor link)
|
### Version(release version or AppVeyor link) / 版本(正式版或基于AppVeyor的链接)
|
||||||
|
|
||||||
|
|
||||||
### Environment(Operating system, .NET Framework, etc)
|
### Environment(Operating system, .NET Framework, etc) / 操作环境(操作系统,.NET Framework等)
|
||||||
|
|
||||||
|
|
||||||
### Steps you have tried
|
### Steps you have tried / 操作步骤
|
||||||
|
|
||||||
|
|
||||||
### What did you expect to see?
|
### What did you expect to see? / 期望的结果
|
||||||
|
|
||||||
|
|
||||||
### What did you see instead?
|
### What did you see instead? / 实际结果
|
||||||
|
|
||||||
|
|
||||||
### Config and error log in detail (with all sensitive info masked)
|
### Config and error log in detail (with all sensitive info masked) / 配置文件和日志文件(请隐去敏感信息)
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
4.0.9 2018-03-14
|
||||||
|
- Fix port occupied issue
|
||||||
|
- Add xchacha20-ietf-poly1305
|
||||||
|
- Update cryptographic libraries
|
||||||
|
- Bug fixes and improvements
|
||||||
|
|
||||||
|
4.0.8 2018-02-16
|
||||||
|
- Add OpenSSL 1.1.0g support #1671
|
||||||
|
- Update nuget packages
|
||||||
|
- Bug fixes and improvements
|
||||||
|
|
||||||
4.0.7 2017-12-09
|
4.0.7 2017-12-09
|
||||||
- Fix QR code and ss:// protocol import issue
|
- Fix QR code and ss:// protocol import issue
|
||||||
- Add an option to show password
|
- Add an option to show password
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
OpenSSL library guide for VS2017
|
||||||
|
|
||||||
|
# Read NOTES.WIN and NOTES.PERL
|
||||||
|
|
||||||
|
# use Visual Studio native tools command prompt
|
||||||
|
# use activeperl, install NASM assembler
|
||||||
|
ppm install dmake
|
||||||
|
|
||||||
|
# Win32 x86
|
||||||
|
set PATH=D:\NASM-32;%PATH%
|
||||||
|
perl Configure VC-WIN32 --release --prefix=C:\Users\home\Downloads\openssl-1.1.0g\x86-build --openssldir=C:\Users\home\Downloads\openssl-1.1.0g\x86-install
|
||||||
|
nmake
|
||||||
|
nmake test
|
||||||
|
# to rebuild
|
||||||
|
nmake distclean
|
||||||
@@ -21,7 +21,7 @@ Download the [latest release].
|
|||||||
|
|
||||||
#### Requirements
|
#### Requirements
|
||||||
|
|
||||||
Microsoft [.NET Framework 4.6.2] or higher.
|
Microsoft [.NET Framework 4.6.2] or higher, Microsoft [Visual C++ 2015 Redistributable] (x86) .
|
||||||
|
|
||||||
#### Basic
|
#### Basic
|
||||||
|
|
||||||
@@ -118,3 +118,4 @@ GPLv3
|
|||||||
[.NET Framework 4.6.2]: https://www.microsoft.com/en-US/download/details.aspx?id=53344
|
[.NET Framework 4.6.2]: https://www.microsoft.com/en-US/download/details.aspx?id=53344
|
||||||
[Visual Studio 2015]: https://www.visualstudio.com/downloads/
|
[Visual Studio 2015]: https://www.visualstudio.com/downloads/
|
||||||
[.NET Framework 4.6.2 Developer Pack]: https://www.microsoft.com/download/details.aspx?id=53321
|
[.NET Framework 4.6.2 Developer Pack]: https://www.microsoft.com/download/details.aspx?id=53321
|
||||||
|
[Visual C++ 2015 Redistributable]: https://www.microsoft.com/en-us/download/details.aspx?id=53840
|
||||||
|
|||||||
@@ -36,52 +36,52 @@ namespace Shadowsocks.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), e.Result, Encoding.UTF8);
|
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), e.Result, Encoding.UTF8);
|
||||||
List<string> lines = ParseResult(e.Result);
|
bool pacFileChanged = MergeAndWritePACFile(e.Result);
|
||||||
if (File.Exists(PACServer.USER_RULE_FILE))
|
UpdateCompleted?.Invoke(this, new ResultEventArgs(pacFileChanged));
|
||||||
{
|
|
||||||
string local = FileManager.NonExclusiveReadAllText(PACServer.USER_RULE_FILE, Encoding.UTF8);
|
|
||||||
using (var sr = new StringReader(local))
|
|
||||||
{
|
|
||||||
foreach (var rule in sr.NonWhiteSpaceLines())
|
|
||||||
{
|
|
||||||
if (rule.BeginWithAny(IgnoredLineBegins))
|
|
||||||
continue;
|
|
||||||
lines.Add(rule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string abpContent;
|
|
||||||
if (File.Exists(PACServer.USER_ABP_FILE))
|
|
||||||
{
|
|
||||||
abpContent = FileManager.NonExclusiveReadAllText(PACServer.USER_ABP_FILE, Encoding.UTF8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
abpContent = Utils.UnGzip(Resources.abp_js);
|
|
||||||
}
|
|
||||||
abpContent = abpContent.Replace("__RULES__", JsonConvert.SerializeObject(lines, Formatting.Indented));
|
|
||||||
if (File.Exists(PACServer.PAC_FILE))
|
|
||||||
{
|
|
||||||
string original = FileManager.NonExclusiveReadAllText(PACServer.PAC_FILE, Encoding.UTF8);
|
|
||||||
if (original == abpContent)
|
|
||||||
{
|
|
||||||
UpdateCompleted(this, new ResultEventArgs(false));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File.WriteAllText(PACServer.PAC_FILE, abpContent, Encoding.UTF8);
|
|
||||||
if (UpdateCompleted != null)
|
|
||||||
{
|
|
||||||
UpdateCompleted(this, new ResultEventArgs(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (Error != null)
|
Error?.Invoke(this, new ErrorEventArgs(ex));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool MergeAndWritePACFile(string gfwListResult)
|
||||||
|
{
|
||||||
|
List<string> lines = new List<string>();
|
||||||
|
if (File.Exists(PACServer.USER_RULE_FILE))
|
||||||
|
{
|
||||||
|
string local = FileManager.NonExclusiveReadAllText(PACServer.USER_RULE_FILE, Encoding.UTF8);
|
||||||
|
using (var sr = new StringReader(local))
|
||||||
{
|
{
|
||||||
Error(this, new ErrorEventArgs(ex));
|
foreach (var rule in sr.NonWhiteSpaceLines())
|
||||||
|
{
|
||||||
|
if (rule.BeginWithAny(IgnoredLineBegins))
|
||||||
|
continue;
|
||||||
|
lines.Add(rule);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lines.AddRange(ParseResult(gfwListResult));
|
||||||
|
string abpContent;
|
||||||
|
if (File.Exists(PACServer.USER_ABP_FILE))
|
||||||
|
{
|
||||||
|
abpContent = FileManager.NonExclusiveReadAllText(PACServer.USER_ABP_FILE, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abpContent = Utils.UnGzip(Resources.abp_js);
|
||||||
|
}
|
||||||
|
abpContent = abpContent.Replace("__RULES__", JsonConvert.SerializeObject(lines, Formatting.Indented));
|
||||||
|
if (File.Exists(PACServer.PAC_FILE))
|
||||||
|
{
|
||||||
|
string original = FileManager.NonExclusiveReadAllText(PACServer.PAC_FILE, Encoding.UTF8);
|
||||||
|
if (original == abpContent)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File.WriteAllText(PACServer.PAC_FILE, abpContent, Encoding.UTF8);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePACFromGFWList(Configuration config)
|
public void UpdatePACFromGFWList(Configuration config)
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ namespace Shadowsocks.Controller
|
|||||||
|
|
||||||
// Start an asynchronous socket to listen for connections.
|
// Start an asynchronous socket to listen for connections.
|
||||||
Logging.Info("Shadowsocks started");
|
Logging.Info("Shadowsocks started");
|
||||||
|
Logging.Info(Encryption.EncryptorFactory.DumpRegisteredEncryptor());
|
||||||
_tcpSocket.BeginAccept(new AsyncCallback(AcceptCallback), _tcpSocket);
|
_tcpSocket.BeginAccept(new AsyncCallback(AcceptCallback), _tcpSocket);
|
||||||
UDPState udpState = new UDPState();
|
UDPState udpState = new UDPState();
|
||||||
udpState.socket = _udpSocket;
|
udpState.socket = _udpSocket;
|
||||||
@@ -202,6 +203,7 @@ namespace Shadowsocks.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int bytesRead = conn.EndReceive(ar);
|
int bytesRead = conn.EndReceive(ar);
|
||||||
|
if (bytesRead <= 0) goto Shutdown;
|
||||||
foreach (IService service in _services)
|
foreach (IService service in _services)
|
||||||
{
|
{
|
||||||
if (service.Handle(buf, bytesRead, conn, null))
|
if (service.Handle(buf, bytesRead, conn, null))
|
||||||
@@ -209,6 +211,7 @@ namespace Shadowsocks.Controller
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Shutdown:
|
||||||
// no service found for this
|
// no service found for this
|
||||||
if (conn.ProtocolType == ProtocolType.Tcp)
|
if (conn.ProtocolType == ProtocolType.Tcp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Shadowsocks.Encryption;
|
|||||||
using Shadowsocks.Model;
|
using Shadowsocks.Model;
|
||||||
using Shadowsocks.Properties;
|
using Shadowsocks.Properties;
|
||||||
using Shadowsocks.Util;
|
using Shadowsocks.Util;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Shadowsocks.Controller
|
namespace Shadowsocks.Controller
|
||||||
{
|
{
|
||||||
@@ -241,42 +242,34 @@ Connection: Close
|
|||||||
#region FileSystemWatcher.OnChanged()
|
#region FileSystemWatcher.OnChanged()
|
||||||
// FileSystemWatcher Changed event is raised twice
|
// FileSystemWatcher Changed event is raised twice
|
||||||
// http://stackoverflow.com/questions/1764809/filesystemwatcher-changed-event-is-raised-twice
|
// http://stackoverflow.com/questions/1764809/filesystemwatcher-changed-event-is-raised-twice
|
||||||
private static Hashtable fileChangedTime = new Hashtable();
|
// Add a short delay to avoid raise event twice in a short period
|
||||||
|
|
||||||
private void PACFileWatcher_Changed(object sender, FileSystemEventArgs e)
|
private void PACFileWatcher_Changed(object sender, FileSystemEventArgs e)
|
||||||
{
|
{
|
||||||
string path = e.FullPath.ToString();
|
if (PACFileChanged != null)
|
||||||
string currentLastWriteTime = File.GetLastWriteTime(e.FullPath).ToString(CultureInfo.InvariantCulture);
|
|
||||||
|
|
||||||
// if there is no path info stored yet or stored path has different time of write then the one now is inspected
|
|
||||||
if (!fileChangedTime.ContainsKey(path) || fileChangedTime[path].ToString() != currentLastWriteTime)
|
|
||||||
{
|
{
|
||||||
if (PACFileChanged != null)
|
Logging.Info($"Detected: PAC file '{e.Name}' was {e.ChangeType.ToString().ToLower()}.");
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
Logging.Info($"Detected: PAC file '{e.Name}' was {e.ChangeType.ToString().ToLower()}.");
|
((FileSystemWatcher)sender).EnableRaisingEvents = false;
|
||||||
|
System.Threading.Thread.Sleep(10);
|
||||||
PACFileChanged(this, new EventArgs());
|
PACFileChanged(this, new EventArgs());
|
||||||
}
|
((FileSystemWatcher)sender).EnableRaisingEvents = true;
|
||||||
|
});
|
||||||
// lastly we update the last write time in the hashtable
|
|
||||||
fileChangedTime[path] = currentLastWriteTime;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserRuleFileWatcher_Changed(object sender, FileSystemEventArgs e)
|
private void UserRuleFileWatcher_Changed(object sender, FileSystemEventArgs e)
|
||||||
{
|
{
|
||||||
string path = e.FullPath.ToString();
|
if (UserRuleFileChanged != null)
|
||||||
string currentLastWriteTime = File.GetLastWriteTime(e.FullPath).ToString(CultureInfo.InvariantCulture);
|
|
||||||
|
|
||||||
// if there is no path info stored yet or stored path has different time of write then the one now is inspected
|
|
||||||
if (!fileChangedTime.ContainsKey(path) || fileChangedTime[path].ToString() != currentLastWriteTime)
|
|
||||||
{
|
{
|
||||||
if (UserRuleFileChanged != null)
|
Logging.Info($"Detected: User Rule file '{e.Name}' was {e.ChangeType.ToString().ToLower()}.");
|
||||||
|
Task.Factory.StartNew(()=>
|
||||||
{
|
{
|
||||||
Logging.Info($"Detected: User Rule file '{e.Name}' was {e.ChangeType.ToString().ToLower()}.");
|
((FileSystemWatcher)sender).EnableRaisingEvents = false;
|
||||||
|
System.Threading.Thread.Sleep(10);
|
||||||
UserRuleFileChanged(this, new EventArgs());
|
UserRuleFileChanged(this, new EventArgs());
|
||||||
}
|
((FileSystemWatcher)sender).EnableRaisingEvents = true;
|
||||||
// lastly we update the last write time in the hashtable
|
});
|
||||||
fileChangedTime[path] = currentLastWriteTime;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Shadowsocks.Controller.Service
|
|||||||
{
|
{
|
||||||
throw new ArgumentException("Value cannot be null or whitespace.", nameof(serverAddress));
|
throw new ArgumentException("Value cannot be null or whitespace.", nameof(serverAddress));
|
||||||
}
|
}
|
||||||
if ((ushort)serverPort != serverPort)
|
if (serverPort <= 0 || serverPort > 65535)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("serverPort");
|
throw new ArgumentOutOfRangeException("serverPort");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Shadowsocks.Controller
|
|||||||
public string LatestVersionLocalName;
|
public string LatestVersionLocalName;
|
||||||
public event EventHandler CheckUpdateCompleted;
|
public event EventHandler CheckUpdateCompleted;
|
||||||
|
|
||||||
public const string Version = "4.0.7";
|
public const string Version = "4.0.9";
|
||||||
|
|
||||||
private class CheckUpdateTimer : System.Timers.Timer
|
private class CheckUpdateTimer : System.Timers.Timer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -240,19 +240,9 @@ namespace Shadowsocks.Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisableProxy()
|
public void SaveProxy(ProxyConfig proxyConfig)
|
||||||
{
|
{
|
||||||
_config.proxy.useProxy = false;
|
_config.proxy = proxyConfig;
|
||||||
SaveConfig(_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnableProxy(int type, string proxy, int port, int timeout)
|
|
||||||
{
|
|
||||||
_config.proxy.useProxy = true;
|
|
||||||
_config.proxy.proxyType = type;
|
|
||||||
_config.proxy.proxyServer = proxy;
|
|
||||||
_config.proxy.proxyPort = port;
|
|
||||||
_config.proxy.proxyTimeout = timeout;
|
|
||||||
SaveConfig(_config);
|
SaveConfig(_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,8 +480,6 @@ namespace Shadowsocks.Controller
|
|||||||
|
|
||||||
protected void Reload()
|
protected void Reload()
|
||||||
{
|
{
|
||||||
StopPlugins();
|
|
||||||
|
|
||||||
Encryption.RNG.Reload();
|
Encryption.RNG.Reload();
|
||||||
// some logic in configuration updated the config when saving, we need to read it again
|
// some logic in configuration updated the config when saving, we need to read it again
|
||||||
_config = Configuration.Load();
|
_config = Configuration.Load();
|
||||||
@@ -521,6 +509,9 @@ namespace Shadowsocks.Controller
|
|||||||
{
|
{
|
||||||
_listener.Stop();
|
_listener.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StopPlugins();
|
||||||
|
|
||||||
// don't put PrivoxyRunner.Start() before pacServer.Stop()
|
// don't put PrivoxyRunner.Start() before pacServer.Stop()
|
||||||
// or bind will fail when switching bind address from 0.0.0.0 to 127.0.0.1
|
// or bind will fail when switching bind address from 0.0.0.0 to 127.0.0.1
|
||||||
// though UseShellExecute is set to true now
|
// though UseShellExecute is set to true now
|
||||||
@@ -534,7 +525,7 @@ namespace Shadowsocks.Controller
|
|||||||
strategy.ReloadServers();
|
strategy.ReloadServers();
|
||||||
}
|
}
|
||||||
|
|
||||||
StartPlugins();
|
StartPlugin();
|
||||||
privoxyRunner.Start(_config);
|
privoxyRunner.Start(_config);
|
||||||
|
|
||||||
TCPRelay tcpRelay = new TCPRelay(this, _config);
|
TCPRelay tcpRelay = new TCPRelay(this, _config);
|
||||||
@@ -572,13 +563,10 @@ namespace Shadowsocks.Controller
|
|||||||
Utils.ReleaseMemory(true);
|
Utils.ReleaseMemory(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartPlugins()
|
private void StartPlugin()
|
||||||
{
|
{
|
||||||
foreach (var server in _config.configs)
|
var server = _config.GetCurrentServer();
|
||||||
{
|
GetPluginLocalEndPointIfConfigured(server);
|
||||||
// Early start plugin processes
|
|
||||||
GetPluginLocalEndPointIfConfigured(server);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SaveConfig(Configuration newConfig)
|
protected void SaveConfig(Configuration newConfig)
|
||||||
@@ -612,46 +600,14 @@ namespace Shadowsocks.Controller
|
|||||||
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' };
|
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' };
|
||||||
private void pacServer_UserRuleFileChanged(object sender, EventArgs e)
|
private void pacServer_UserRuleFileChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO: this is a dirty hack. (from code GListUpdater.http_DownloadStringCompleted())
|
|
||||||
if (!File.Exists(Utils.GetTempPath("gfwlist.txt")))
|
if (!File.Exists(Utils.GetTempPath("gfwlist.txt")))
|
||||||
{
|
{
|
||||||
UpdatePACFromGFWList();
|
UpdatePACFromGFWList();
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<string> lines = new List<string>();
|
|
||||||
if (File.Exists(PACServer.USER_RULE_FILE))
|
|
||||||
{
|
|
||||||
string local = FileManager.NonExclusiveReadAllText(PACServer.USER_RULE_FILE, Encoding.UTF8);
|
|
||||||
using (var sr = new StringReader(local))
|
|
||||||
{
|
|
||||||
foreach (var rule in sr.NonWhiteSpaceLines())
|
|
||||||
{
|
|
||||||
if (rule.BeginWithAny(IgnoredLineBegins))
|
|
||||||
continue;
|
|
||||||
lines.Add(rule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lines.AddRange(GFWListUpdater.ParseResult(FileManager.NonExclusiveReadAllText(Utils.GetTempPath("gfwlist.txt"))));
|
|
||||||
string abpContent;
|
|
||||||
if (File.Exists(PACServer.USER_ABP_FILE))
|
|
||||||
{
|
|
||||||
abpContent = FileManager.NonExclusiveReadAllText(PACServer.USER_ABP_FILE, Encoding.UTF8);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
abpContent = Utils.UnGzip(Resources.abp_js);
|
GFWListUpdater.MergeAndWritePACFile(FileManager.NonExclusiveReadAllText(Utils.GetTempPath("gfwlist.txt")));
|
||||||
}
|
}
|
||||||
abpContent = abpContent.Replace("__RULES__", JsonConvert.SerializeObject(lines, Formatting.Indented));
|
|
||||||
if (File.Exists(PACServer.PAC_FILE))
|
|
||||||
{
|
|
||||||
string original = FileManager.NonExclusiveReadAllText(PACServer.PAC_FILE, Encoding.UTF8);
|
|
||||||
if (original == abpContent)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File.WriteAllText(PACServer.PAC_FILE, abpContent, Encoding.UTF8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyPacUrl()
|
public void CopyPacUrl()
|
||||||
|
|||||||
Binary file not shown.
@@ -127,9 +127,9 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
|
|
||||||
public static void randBytes(byte[] buf, int length) { RNG.GetBytes(buf, length); }
|
public static void randBytes(byte[] buf, int length) { RNG.GetBytes(buf, length); }
|
||||||
|
|
||||||
public abstract int cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen);
|
public abstract void cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen);
|
||||||
|
|
||||||
public abstract int cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen);
|
public abstract void cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen);
|
||||||
|
|
||||||
#region TCP
|
#region TCP
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
|
private static readonly Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
|
||||||
{
|
{
|
||||||
{"aes-128-gcm", new EncryptorInfo("AES-128-GCM", 16, 16, 12, 16, CIPHER_AES)},
|
{"aes-128-gcm", new EncryptorInfo("AES-128-GCM", 16, 16, 12, 16, CIPHER_AES)},
|
||||||
{"aes-192-gcm", new EncryptorInfo("AES-192-GCM", 24, 24, 12, 16, CIPHER_AES)},
|
{"aes-192-gcm", new EncryptorInfo("AES-192-GCM", 24, 24, 12, 16, CIPHER_AES)},
|
||||||
@@ -48,6 +48,7 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
{
|
{
|
||||||
_decryptCtx = ctx;
|
_decryptCtx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
MbedTLS.cipher_init(ctx);
|
MbedTLS.cipher_init(ctx);
|
||||||
if (MbedTLS.cipher_setup(ctx, MbedTLS.cipher_info_from_string(_innerLibName)) != 0)
|
if (MbedTLS.cipher_setup(ctx, MbedTLS.cipher_info_from_string(_innerLibName)) != 0)
|
||||||
throw new System.Exception("Cannot initialize mbed TLS cipher context");
|
throw new System.Exception("Cannot initialize mbed TLS cipher context");
|
||||||
@@ -67,7 +68,7 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
if (ret != 0) throw new System.Exception("failed to finish preparation");
|
if (ret != 0) throw new System.Exception("failed to finish preparation");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen)
|
public override void cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen)
|
||||||
{
|
{
|
||||||
// buf: all plaintext
|
// buf: all plaintext
|
||||||
// outbuf: ciphertext + tag
|
// outbuf: ciphertext + tag
|
||||||
@@ -87,18 +88,18 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
/* cipher */
|
/* cipher */
|
||||||
ciphertext, ref olen,
|
ciphertext, ref olen,
|
||||||
tagbuf, (uint) tagLen);
|
tagbuf, (uint) tagLen);
|
||||||
if (ret != 0) throw new CryptoErrorException();
|
if (ret != 0) throw new CryptoErrorException(String.Format("ret is {0}", ret));
|
||||||
Debug.Assert(olen == plen);
|
Debug.Assert(olen == plen);
|
||||||
// attach tag to ciphertext
|
// attach tag to ciphertext
|
||||||
Array.Copy(tagbuf, 0, ciphertext, (int) plen, tagLen);
|
Array.Copy(tagbuf, 0, ciphertext, (int) plen, tagLen);
|
||||||
clen = olen + (uint) tagLen;
|
clen = olen + (uint) tagLen;
|
||||||
return ret;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new System.Exception("not implemented");
|
throw new System.Exception("not implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen)
|
public override void cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen)
|
||||||
{
|
{
|
||||||
// buf: ciphertext + tag
|
// buf: ciphertext + tag
|
||||||
// outbuf: plaintext
|
// outbuf: plaintext
|
||||||
@@ -116,10 +117,10 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
ciphertext, (uint) (clen - tagLen),
|
ciphertext, (uint) (clen - tagLen),
|
||||||
plaintext, ref olen,
|
plaintext, ref olen,
|
||||||
tagbuf, (uint) tagLen);
|
tagbuf, (uint) tagLen);
|
||||||
if (ret != 0) throw new CryptoErrorException();
|
if (ret != 0) throw new CryptoErrorException(String.Format("ret is {0}", ret));
|
||||||
Debug.Assert(olen == clen - tagLen);
|
Debug.Assert(olen == clen - tagLen);
|
||||||
plen = olen;
|
plen = olen;
|
||||||
return ret;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new System.Exception("not implemented");
|
throw new System.Exception("not implemented");
|
||||||
}
|
}
|
||||||
@@ -163,6 +164,7 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
Marshal.FreeHGlobal(_encryptCtx);
|
Marshal.FreeHGlobal(_encryptCtx);
|
||||||
_encryptCtx = IntPtr.Zero;
|
_encryptCtx = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_decryptCtx != IntPtr.Zero)
|
if (_decryptCtx != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
MbedTLS.cipher_free(_decryptCtx);
|
MbedTLS.cipher_free(_decryptCtx);
|
||||||
|
|||||||
@@ -0,0 +1,192 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Shadowsocks.Encryption.Exception;
|
||||||
|
|
||||||
|
namespace Shadowsocks.Encryption.AEAD
|
||||||
|
{
|
||||||
|
public class AEADOpenSSLEncryptor
|
||||||
|
: AEADEncryptor, IDisposable
|
||||||
|
{
|
||||||
|
const int CIPHER_AES = 1;
|
||||||
|
const int CIPHER_CHACHA20IETFPOLY1305 = 2;
|
||||||
|
|
||||||
|
private byte[] _opensslEncSubkey;
|
||||||
|
private byte[] _opensslDecSubkey;
|
||||||
|
|
||||||
|
private IntPtr _encryptCtx = IntPtr.Zero;
|
||||||
|
private IntPtr _decryptCtx = IntPtr.Zero;
|
||||||
|
|
||||||
|
private IntPtr _cipherInfoPtr = IntPtr.Zero;
|
||||||
|
|
||||||
|
public AEADOpenSSLEncryptor(string method, string password)
|
||||||
|
: base(method, password)
|
||||||
|
{
|
||||||
|
_opensslEncSubkey = new byte[keyLen];
|
||||||
|
_opensslDecSubkey = new byte[keyLen];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
|
||||||
|
{
|
||||||
|
{"aes-128-gcm", new EncryptorInfo("aes-128-gcm", 16, 16, 12, 16, CIPHER_AES)},
|
||||||
|
{"aes-192-gcm", new EncryptorInfo("aes-192-gcm", 24, 24, 12, 16, CIPHER_AES)},
|
||||||
|
{"aes-256-gcm", new EncryptorInfo("aes-256-gcm", 32, 32, 12, 16, CIPHER_AES)},
|
||||||
|
{"chacha20-ietf-poly1305", new EncryptorInfo("chacha20-poly1305", 32, 32, 12, 16, CIPHER_CHACHA20IETFPOLY1305)}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static List<string> SupportedCiphers()
|
||||||
|
{
|
||||||
|
return new List<string>(_ciphers.Keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<string, EncryptorInfo> getCiphers()
|
||||||
|
{
|
||||||
|
return _ciphers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void InitCipher(byte[] salt, bool isEncrypt, bool isUdp)
|
||||||
|
{
|
||||||
|
base.InitCipher(salt, isEncrypt, isUdp);
|
||||||
|
_cipherInfoPtr = OpenSSL.GetCipherInfo(_innerLibName);
|
||||||
|
if (_cipherInfoPtr == IntPtr.Zero) throw new System.Exception("openssl: cipher not found");
|
||||||
|
IntPtr ctx = OpenSSL.EVP_CIPHER_CTX_new();
|
||||||
|
if (ctx == IntPtr.Zero) throw new System.Exception("openssl: fail to create ctx");
|
||||||
|
|
||||||
|
if (isEncrypt)
|
||||||
|
{
|
||||||
|
_encryptCtx = ctx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_decryptCtx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeriveSessionKey(isEncrypt ? _encryptSalt : _decryptSalt, _Masterkey,
|
||||||
|
isEncrypt ? _opensslEncSubkey : _opensslDecSubkey);
|
||||||
|
|
||||||
|
var ret = OpenSSL.EVP_CipherInit_ex(ctx, _cipherInfoPtr, IntPtr.Zero, null, null,
|
||||||
|
isEncrypt ? OpenSSL.OPENSSL_ENCRYPT : OpenSSL.OPENSSL_DECRYPT);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: fail to init ctx");
|
||||||
|
|
||||||
|
ret = OpenSSL.EVP_CIPHER_CTX_set_key_length(ctx, keyLen);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: fail to set key length");
|
||||||
|
|
||||||
|
ret = OpenSSL.EVP_CIPHER_CTX_ctrl(ctx, OpenSSL.EVP_CTRL_AEAD_SET_IVLEN,
|
||||||
|
nonceLen, IntPtr.Zero);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: fail to set AEAD nonce length");
|
||||||
|
|
||||||
|
ret = OpenSSL.EVP_CipherInit_ex(ctx, IntPtr.Zero, IntPtr.Zero,
|
||||||
|
isEncrypt ? _opensslEncSubkey : _opensslDecSubkey,
|
||||||
|
null,
|
||||||
|
isEncrypt ? OpenSSL.OPENSSL_ENCRYPT : OpenSSL.OPENSSL_DECRYPT);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: cannot set key");
|
||||||
|
OpenSSL.EVP_CIPHER_CTX_set_padding(ctx, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen)
|
||||||
|
{
|
||||||
|
OpenSSL.SetCtxNonce(_encryptCtx, _encNonce, true);
|
||||||
|
// buf: all plaintext
|
||||||
|
// outbuf: ciphertext + tag
|
||||||
|
int ret;
|
||||||
|
int tmpLen = 0;
|
||||||
|
clen = 0;
|
||||||
|
var tagBuf = new byte[tagLen];
|
||||||
|
|
||||||
|
ret = OpenSSL.EVP_CipherUpdate(_encryptCtx, ciphertext, out tmpLen,
|
||||||
|
plaintext, (int) plen);
|
||||||
|
if (ret != 1) throw new CryptoErrorException("openssl: fail to encrypt AEAD");
|
||||||
|
clen += (uint) tmpLen;
|
||||||
|
// For AEAD cipher, it should not output anything
|
||||||
|
ret = OpenSSL.EVP_CipherFinal_ex(_encryptCtx, ciphertext, ref tmpLen);
|
||||||
|
if (ret != 1) throw new CryptoErrorException("openssl: fail to finalize AEAD");
|
||||||
|
if (tmpLen > 0)
|
||||||
|
{
|
||||||
|
throw new System.Exception("openssl: fail to finish AEAD");
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenSSL.AEADGetTag(_encryptCtx, tagBuf, tagLen);
|
||||||
|
Array.Copy(tagBuf, 0, ciphertext, clen, tagLen);
|
||||||
|
clen += (uint) tagLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen)
|
||||||
|
{
|
||||||
|
OpenSSL.SetCtxNonce(_decryptCtx, _decNonce, false);
|
||||||
|
// buf: ciphertext + tag
|
||||||
|
// outbuf: plaintext
|
||||||
|
int ret;
|
||||||
|
int tmpLen = 0;
|
||||||
|
plen = 0;
|
||||||
|
|
||||||
|
// split tag
|
||||||
|
byte[] tagbuf = new byte[tagLen];
|
||||||
|
Array.Copy(ciphertext, (int) (clen - tagLen), tagbuf, 0, tagLen);
|
||||||
|
OpenSSL.AEADSetTag(_decryptCtx, tagbuf, tagLen);
|
||||||
|
|
||||||
|
ret = OpenSSL.EVP_CipherUpdate(_decryptCtx,
|
||||||
|
plaintext, out tmpLen, ciphertext, (int) (clen - tagLen));
|
||||||
|
if (ret != 1) throw new CryptoErrorException("openssl: fail to decrypt AEAD");
|
||||||
|
plen += (uint) tmpLen;
|
||||||
|
|
||||||
|
// For AEAD cipher, it should not output anything
|
||||||
|
ret = OpenSSL.EVP_CipherFinal_ex(_decryptCtx, plaintext, ref tmpLen);
|
||||||
|
if (ret <= 0)
|
||||||
|
{
|
||||||
|
// If this is not successful authenticated
|
||||||
|
throw new CryptoErrorException(String.Format("ret is {0}", ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmpLen > 0)
|
||||||
|
{
|
||||||
|
throw new System.Exception("openssl: fail to finish AEAD");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IDisposable
|
||||||
|
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
// instance based lock
|
||||||
|
private readonly object _lock = new object();
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~AEADOpenSSLEncryptor()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
if (_disposed) return;
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
// free managed objects
|
||||||
|
}
|
||||||
|
|
||||||
|
// free unmanaged objects
|
||||||
|
if (_encryptCtx != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
OpenSSL.EVP_CIPHER_CTX_free(_encryptCtx);
|
||||||
|
_encryptCtx = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_decryptCtx != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
OpenSSL.EVP_CIPHER_CTX_free(_decryptCtx);
|
||||||
|
_decryptCtx = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,8 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
: AEADEncryptor, IDisposable
|
: AEADEncryptor, IDisposable
|
||||||
{
|
{
|
||||||
private const int CIPHER_CHACHA20IETFPOLY1305 = 1;
|
private const int CIPHER_CHACHA20IETFPOLY1305 = 1;
|
||||||
private const int CIPHER_AES256GCM = 2;
|
private const int CIPHER_XCHACHA20IETFPOLY1305 = 2;
|
||||||
|
private const int CIPHER_AES256GCM = 3;
|
||||||
|
|
||||||
private byte[] _sodiumEncSubkey;
|
private byte[] _sodiumEncSubkey;
|
||||||
private byte[] _sodiumDecSubkey;
|
private byte[] _sodiumDecSubkey;
|
||||||
@@ -22,9 +23,10 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
_sodiumDecSubkey = new byte[keyLen];
|
_sodiumDecSubkey = new byte[keyLen];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
|
private static readonly Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
|
||||||
{
|
{
|
||||||
{"chacha20-ietf-poly1305", new EncryptorInfo(32, 32, 12, 16, CIPHER_CHACHA20IETFPOLY1305)},
|
{"chacha20-ietf-poly1305", new EncryptorInfo(32, 32, 12, 16, CIPHER_CHACHA20IETFPOLY1305)},
|
||||||
|
{"xchacha20-ietf-poly1305", new EncryptorInfo(32, 32, 24, 16, CIPHER_XCHACHA20IETFPOLY1305)},
|
||||||
{"aes-256-gcm", new EncryptorInfo(32, 32, 12, 16, CIPHER_AES256GCM)},
|
{"aes-256-gcm", new EncryptorInfo(32, 32, 12, 16, CIPHER_AES256GCM)},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override int cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen)
|
public override void cipherEncrypt(byte[] plaintext, uint plen, byte[] ciphertext, ref uint clen)
|
||||||
{
|
{
|
||||||
Debug.Assert(_sodiumEncSubkey != null);
|
Debug.Assert(_sodiumEncSubkey != null);
|
||||||
// buf: all plaintext
|
// buf: all plaintext
|
||||||
@@ -65,6 +67,13 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
null, _encNonce,
|
null, _encNonce,
|
||||||
_sodiumEncSubkey);
|
_sodiumEncSubkey);
|
||||||
break;
|
break;
|
||||||
|
case CIPHER_XCHACHA20IETFPOLY1305:
|
||||||
|
ret = Sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(ciphertext, ref encClen,
|
||||||
|
plaintext, (ulong)plen,
|
||||||
|
null, 0,
|
||||||
|
null, _encNonce,
|
||||||
|
_sodiumEncSubkey);
|
||||||
|
break;
|
||||||
case CIPHER_AES256GCM:
|
case CIPHER_AES256GCM:
|
||||||
ret = Sodium.crypto_aead_aes256gcm_encrypt(ciphertext, ref encClen,
|
ret = Sodium.crypto_aead_aes256gcm_encrypt(ciphertext, ref encClen,
|
||||||
plaintext, (ulong)plen,
|
plaintext, (ulong)plen,
|
||||||
@@ -75,13 +84,12 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
default:
|
default:
|
||||||
throw new System.Exception("not implemented");
|
throw new System.Exception("not implemented");
|
||||||
}
|
}
|
||||||
if (ret != 0) throw new CryptoErrorException();
|
if (ret != 0) throw new CryptoErrorException(String.Format("ret is {0}", ret));
|
||||||
Logging.Dump("after cipherEncrypt: cipher", ciphertext, (int) encClen);
|
Logging.Dump("after cipherEncrypt: cipher", ciphertext, (int) encClen);
|
||||||
clen = (uint) encClen;
|
clen = (uint) encClen;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen)
|
public override void cipherDecrypt(byte[] ciphertext, uint clen, byte[] plaintext, ref uint plen)
|
||||||
{
|
{
|
||||||
Debug.Assert(_sodiumDecSubkey != null);
|
Debug.Assert(_sodiumDecSubkey != null);
|
||||||
// buf: ciphertext + tag
|
// buf: ciphertext + tag
|
||||||
@@ -100,6 +108,13 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
null, 0,
|
null, 0,
|
||||||
_decNonce, _sodiumDecSubkey);
|
_decNonce, _sodiumDecSubkey);
|
||||||
break;
|
break;
|
||||||
|
case CIPHER_XCHACHA20IETFPOLY1305:
|
||||||
|
ret = Sodium.crypto_aead_xchacha20poly1305_ietf_decrypt(plaintext, ref decPlen,
|
||||||
|
null,
|
||||||
|
ciphertext, (ulong)clen,
|
||||||
|
null, 0,
|
||||||
|
_decNonce, _sodiumDecSubkey);
|
||||||
|
break;
|
||||||
case CIPHER_AES256GCM:
|
case CIPHER_AES256GCM:
|
||||||
ret = Sodium.crypto_aead_aes256gcm_decrypt(plaintext, ref decPlen,
|
ret = Sodium.crypto_aead_aes256gcm_decrypt(plaintext, ref decPlen,
|
||||||
null,
|
null,
|
||||||
@@ -111,10 +126,9 @@ namespace Shadowsocks.Encryption.AEAD
|
|||||||
throw new System.Exception("not implemented");
|
throw new System.Exception("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != 0) throw new CryptoErrorException();
|
if (ret != 0) throw new CryptoErrorException(String.Format("ret is {0}", ret));
|
||||||
Logging.Dump("after cipherDecrypt: plain", plaintext, (int) decPlen);
|
Logging.Dump("after cipherDecrypt: plain", plaintext, (int) decPlen);
|
||||||
plen = (uint) decPlen;
|
plen = (uint) decPlen;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using Shadowsocks.Encryption.AEAD;
|
using Shadowsocks.Encryption.AEAD;
|
||||||
using Shadowsocks.Encryption.Stream;
|
using Shadowsocks.Encryption.Stream;
|
||||||
|
|
||||||
@@ -26,21 +27,42 @@ namespace Shadowsocks.Encryption
|
|||||||
AEADSodiumEncryptorSupportedCiphers.Remove("aes-256-gcm");
|
AEADSodiumEncryptorSupportedCiphers.Remove("aes-256-gcm");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string method in StreamMbedTLSEncryptor.SupportedCiphers())
|
// XXX: sequence matters, OpenSSL > Sodium > MbedTLS
|
||||||
|
foreach (string method in StreamOpenSSLEncryptor.SupportedCiphers())
|
||||||
{
|
{
|
||||||
_registeredEncryptors.Add(method, typeof(StreamMbedTLSEncryptor));
|
if (!_registeredEncryptors.ContainsKey(method))
|
||||||
|
_registeredEncryptors.Add(method, typeof(StreamOpenSSLEncryptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string method in StreamSodiumEncryptor.SupportedCiphers())
|
foreach (string method in StreamSodiumEncryptor.SupportedCiphers())
|
||||||
{
|
{
|
||||||
_registeredEncryptors.Add(method, typeof(StreamSodiumEncryptor));
|
if (!_registeredEncryptors.ContainsKey(method))
|
||||||
|
_registeredEncryptors.Add(method, typeof(StreamSodiumEncryptor));
|
||||||
}
|
}
|
||||||
foreach (string method in AEADMbedTLSEncryptorSupportedCiphers)
|
|
||||||
|
foreach (string method in StreamMbedTLSEncryptor.SupportedCiphers())
|
||||||
{
|
{
|
||||||
_registeredEncryptors.Add(method, typeof(AEADMbedTLSEncryptor));
|
if (!_registeredEncryptors.ContainsKey(method))
|
||||||
|
_registeredEncryptors.Add(method, typeof(StreamMbedTLSEncryptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (string method in AEADOpenSSLEncryptor.SupportedCiphers())
|
||||||
|
{
|
||||||
|
if (!_registeredEncryptors.ContainsKey(method))
|
||||||
|
_registeredEncryptors.Add(method, typeof(AEADOpenSSLEncryptor));
|
||||||
|
}
|
||||||
|
|
||||||
foreach (string method in AEADSodiumEncryptorSupportedCiphers)
|
foreach (string method in AEADSodiumEncryptorSupportedCiphers)
|
||||||
{
|
{
|
||||||
_registeredEncryptors.Add(method, typeof(AEADSodiumEncryptor));
|
if (!_registeredEncryptors.ContainsKey(method))
|
||||||
|
_registeredEncryptors.Add(method, typeof(AEADSodiumEncryptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string method in AEADMbedTLSEncryptorSupportedCiphers)
|
||||||
|
{
|
||||||
|
if (!_registeredEncryptors.ContainsKey(method))
|
||||||
|
_registeredEncryptors.Add(method, typeof(AEADMbedTLSEncryptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,12 +72,29 @@ namespace Shadowsocks.Encryption
|
|||||||
{
|
{
|
||||||
method = "aes-256-cfb";
|
method = "aes-256-cfb";
|
||||||
}
|
}
|
||||||
|
|
||||||
method = method.ToLowerInvariant();
|
method = method.ToLowerInvariant();
|
||||||
Type t = _registeredEncryptors[method];
|
Type t = _registeredEncryptors[method];
|
||||||
|
|
||||||
ConstructorInfo c = t.GetConstructor(ConstructorTypes);
|
ConstructorInfo c = t.GetConstructor(ConstructorTypes);
|
||||||
if (c == null) throw new System.Exception("Invalid ctor");
|
if (c == null) throw new System.Exception("Invalid ctor");
|
||||||
IEncryptor result = (IEncryptor) c.Invoke(new object[] {method, password});
|
IEncryptor result = (IEncryptor) c.Invoke(new object[] {method, password});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string DumpRegisteredEncryptor()
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.Append(Environment.NewLine);
|
||||||
|
sb.AppendLine("=========================");
|
||||||
|
sb.AppendLine("Registered Encryptor Info");
|
||||||
|
foreach (var encryptor in _registeredEncryptors)
|
||||||
|
{
|
||||||
|
sb.AppendLine(String.Format("{0}=>{1}", encryptor.Key, encryptor.Value.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine("=========================");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,8 @@ namespace Shadowsocks.Encryption
|
|||||||
public static byte[] MD5(byte[] input)
|
public static byte[] MD5(byte[] input)
|
||||||
{
|
{
|
||||||
byte[] output = new byte[16];
|
byte[] output = new byte[16];
|
||||||
md5(input, (uint) input.Length, output);
|
if (md5_ret(input, (uint) input.Length, output) != 0)
|
||||||
|
throw new System.Exception("mbedtls: MD5 failure");
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ namespace Shadowsocks.Encryption
|
|||||||
private static extern IntPtr LoadLibrary(string path);
|
private static extern IntPtr LoadLibrary(string path);
|
||||||
|
|
||||||
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void md5(byte[] input, uint ilen, byte[] output);
|
public static extern int md5_ret(byte[] input, uint ilen, byte[] output);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get cipher ctx size for unmanaged memory allocation
|
/// Get cipher ctx size for unmanaged memory allocation
|
||||||
|
|||||||
@@ -0,0 +1,161 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security;
|
||||||
|
using System.Text;
|
||||||
|
using Shadowsocks.Controller;
|
||||||
|
using Shadowsocks.Encryption.Exception;
|
||||||
|
using Shadowsocks.Properties;
|
||||||
|
using Shadowsocks.Util;
|
||||||
|
|
||||||
|
namespace Shadowsocks.Encryption
|
||||||
|
{
|
||||||
|
// XXX: only for OpenSSL 1.1.0 and higher
|
||||||
|
public static class OpenSSL
|
||||||
|
{
|
||||||
|
private const string DLLNAME = "libsscrypto.dll";
|
||||||
|
|
||||||
|
public const int OPENSSL_ENCRYPT = 1;
|
||||||
|
public const int OPENSSL_DECRYPT = 0;
|
||||||
|
|
||||||
|
public const int EVP_CTRL_AEAD_SET_IVLEN = 0x9;
|
||||||
|
public const int EVP_CTRL_AEAD_GET_TAG = 0x10;
|
||||||
|
public const int EVP_CTRL_AEAD_SET_TAG = 0x11;
|
||||||
|
|
||||||
|
static OpenSSL()
|
||||||
|
{
|
||||||
|
string dllPath = Utils.GetTempPath(DLLNAME);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll);
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Logging.LogUsefulException(e);
|
||||||
|
}
|
||||||
|
LoadLibrary(dllPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntPtr GetCipherInfo(string cipherName)
|
||||||
|
{
|
||||||
|
var name = Encoding.ASCII.GetBytes(cipherName);
|
||||||
|
Array.Resize(ref name, name.Length + 1);
|
||||||
|
return EVP_get_cipherbyname(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Need init cipher context after EVP_CipherFinal_ex to reuse context
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ctx"></param>
|
||||||
|
/// <param name="cipherType"></param>
|
||||||
|
/// <param name="nonce"></param>
|
||||||
|
public static void SetCtxNonce(IntPtr ctx, byte[] nonce, bool isEncrypt)
|
||||||
|
{
|
||||||
|
var ret = EVP_CipherInit_ex(ctx, IntPtr.Zero,
|
||||||
|
IntPtr.Zero, null,
|
||||||
|
nonce,
|
||||||
|
isEncrypt ? OPENSSL_ENCRYPT : OPENSSL_DECRYPT);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: fail to set AEAD nonce");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AEADGetTag(IntPtr ctx, byte[] tagbuf, int taglen)
|
||||||
|
{
|
||||||
|
IntPtr tagBufIntPtr = IntPtr.Zero;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tagBufIntPtr = Marshal.AllocHGlobal(taglen);
|
||||||
|
var ret = EVP_CIPHER_CTX_ctrl(ctx,
|
||||||
|
EVP_CTRL_AEAD_GET_TAG, taglen, tagBufIntPtr);
|
||||||
|
if (ret != 1) throw new CryptoErrorException("openssl: fail to get AEAD tag");
|
||||||
|
// take tag from unmanaged memory
|
||||||
|
Marshal.Copy(tagBufIntPtr, tagbuf, 0, taglen);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tagBufIntPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(tagBufIntPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AEADSetTag(IntPtr ctx, byte[] tagbuf, int taglen)
|
||||||
|
{
|
||||||
|
IntPtr tagBufIntPtr = IntPtr.Zero;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// allocate unmanaged memory for tag
|
||||||
|
tagBufIntPtr = Marshal.AllocHGlobal(taglen);
|
||||||
|
|
||||||
|
// copy tag to unmanaged memory
|
||||||
|
Marshal.Copy(tagbuf, 0, tagBufIntPtr, taglen);
|
||||||
|
|
||||||
|
var ret = EVP_CIPHER_CTX_ctrl(ctx,
|
||||||
|
EVP_CTRL_AEAD_SET_TAG, taglen, tagBufIntPtr);
|
||||||
|
|
||||||
|
if (ret != 1) throw new CryptoErrorException("openssl: fail to set AEAD tag");
|
||||||
|
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tagBufIntPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(tagBufIntPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("Kernel32.dll")]
|
||||||
|
private static extern IntPtr LoadLibrary(string path);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr EVP_CIPHER_CTX_new();
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void EVP_CIPHER_CTX_free(IntPtr ctx);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CIPHER_CTX_reset(IntPtr ctx);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CipherInit_ex(IntPtr ctx, IntPtr type,
|
||||||
|
IntPtr impl, byte[] key, byte[] iv, int enc);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CipherUpdate(IntPtr ctx, byte[] outb,
|
||||||
|
out int outl, byte[] inb, int inl);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CipherFinal_ex(IntPtr ctx, byte[] outm, ref int outl);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CIPHER_CTX_set_padding(IntPtr x, int padding);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CIPHER_CTX_set_key_length(IntPtr x, int keylen);
|
||||||
|
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int EVP_CIPHER_CTX_ctrl(IntPtr ctx, int type, int arg, IntPtr ptr);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// simulate NUL-terminated string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern IntPtr EVP_get_cipherbyname(byte[] name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -73,6 +73,14 @@ namespace Shadowsocks.Encryption
|
|||||||
public static extern int crypto_aead_chacha20poly1305_ietf_decrypt(byte[] m, ref ulong mlen_p,
|
public static extern int crypto_aead_chacha20poly1305_ietf_decrypt(byte[] m, ref ulong mlen_p,
|
||||||
byte[] nsec, byte[] c, ulong clen, byte[] ad, ulong adlen, byte[] npub, byte[] k);
|
byte[] nsec, byte[] c, ulong clen, byte[] ad, ulong adlen, byte[] npub, byte[] k);
|
||||||
|
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int crypto_aead_xchacha20poly1305_ietf_encrypt(byte[] c, ref ulong clen_p, byte[] m, ulong mlen,
|
||||||
|
byte[] ad, ulong adlen, byte[] nsec, byte[] npub, byte[] k);
|
||||||
|
|
||||||
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int crypto_aead_xchacha20poly1305_ietf_decrypt(byte[] m, ref ulong mlen_p, byte[] nsec, byte[] c,
|
||||||
|
ulong clen, byte[] ad, ulong adlen, byte[] npub, byte[] k);
|
||||||
|
|
||||||
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int crypto_aead_aes256gcm_encrypt(byte[] c, ref ulong clen_p, byte[] m, ulong mlen,
|
public static extern int crypto_aead_aes256gcm_encrypt(byte[] c, ref ulong clen_p, byte[] m, ulong mlen,
|
||||||
byte[] ad, ulong adlen, byte[] nsec, byte[] npub, byte[] k);
|
byte[] ad, ulong adlen, byte[] nsec, byte[] npub, byte[] k);
|
||||||
|
|||||||
@@ -0,0 +1,160 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Shadowsocks.Encryption.Exception;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Shadowsocks.Encryption.Stream
|
||||||
|
{
|
||||||
|
public class StreamOpenSSLEncryptor
|
||||||
|
: StreamEncryptor, IDisposable
|
||||||
|
{
|
||||||
|
const int CIPHER_RC4 = 1;
|
||||||
|
const int CIPHER_AES = 2;
|
||||||
|
const int CIPHER_CAMELLIA = 3;
|
||||||
|
const int CIPHER_BLOWFISH = 4;
|
||||||
|
const int CIPHER_CHACHA20_IETF = 5;
|
||||||
|
|
||||||
|
private IntPtr _encryptCtx = IntPtr.Zero;
|
||||||
|
private IntPtr _decryptCtx = IntPtr.Zero;
|
||||||
|
|
||||||
|
public StreamOpenSSLEncryptor(string method, string password)
|
||||||
|
: base(method, password)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX: name=RC4,blkSz=1,keyLen=16,ivLen=0, do NOT pass IV to it
|
||||||
|
private static readonly Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
|
||||||
|
{
|
||||||
|
{ "aes-128-cfb", new EncryptorInfo("AES-128-CFB", 16, 16, CIPHER_AES) },
|
||||||
|
{ "aes-192-cfb", new EncryptorInfo("AES-192-CFB", 24, 16, CIPHER_AES) },
|
||||||
|
{ "aes-256-cfb", new EncryptorInfo("AES-256-CFB", 32, 16, CIPHER_AES) },
|
||||||
|
{ "aes-128-ctr", new EncryptorInfo("aes-128-ctr", 16, 16, CIPHER_AES) },
|
||||||
|
{ "aes-192-ctr", new EncryptorInfo("aes-192-ctr", 24, 16, CIPHER_AES) },
|
||||||
|
{ "aes-256-ctr", new EncryptorInfo("aes-256-ctr", 32, 16, CIPHER_AES) },
|
||||||
|
{ "bf-cfb", new EncryptorInfo("bf-cfb", 16, 8, CIPHER_BLOWFISH) },
|
||||||
|
{ "camellia-128-cfb", new EncryptorInfo("CAMELLIA-128-CFB", 16, 16, CIPHER_CAMELLIA) },
|
||||||
|
{ "camellia-192-cfb", new EncryptorInfo("CAMELLIA-192-CFB", 24, 16, CIPHER_CAMELLIA) },
|
||||||
|
{ "camellia-256-cfb", new EncryptorInfo("CAMELLIA-256-CFB", 32, 16, CIPHER_CAMELLIA) },
|
||||||
|
{ "rc4-md5", new EncryptorInfo("RC4", 16, 16, CIPHER_RC4) },
|
||||||
|
// it's using ivLen=16, not compatible
|
||||||
|
//{ "chacha20-ietf", new EncryptorInfo("chacha20", 32, 12, CIPHER_CHACHA20_IETF) }
|
||||||
|
};
|
||||||
|
|
||||||
|
public static List<string> SupportedCiphers()
|
||||||
|
{
|
||||||
|
return new List<string>(_ciphers.Keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Dictionary<string, EncryptorInfo> getCiphers()
|
||||||
|
{
|
||||||
|
return _ciphers;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void initCipher(byte[] iv, bool isEncrypt)
|
||||||
|
{
|
||||||
|
base.initCipher(iv, isEncrypt);
|
||||||
|
IntPtr cipherInfo = OpenSSL.GetCipherInfo(_innerLibName);
|
||||||
|
if (cipherInfo == IntPtr.Zero) throw new System.Exception("openssl: cipher not found");
|
||||||
|
IntPtr ctx = OpenSSL.EVP_CIPHER_CTX_new();
|
||||||
|
if (ctx == IntPtr.Zero) throw new System.Exception("fail to create ctx");
|
||||||
|
|
||||||
|
if (isEncrypt)
|
||||||
|
{
|
||||||
|
_encryptCtx = ctx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_decryptCtx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] realkey;
|
||||||
|
if (_method == "rc4-md5")
|
||||||
|
{
|
||||||
|
byte[] temp = new byte[keyLen + ivLen];
|
||||||
|
realkey = new byte[keyLen];
|
||||||
|
Array.Copy(_key, 0, temp, 0, keyLen);
|
||||||
|
Array.Copy(iv, 0, temp, keyLen, ivLen);
|
||||||
|
realkey = MbedTLS.MD5(temp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realkey = _key;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ret = OpenSSL.EVP_CipherInit_ex(ctx, cipherInfo, IntPtr.Zero, null,null,
|
||||||
|
isEncrypt ? OpenSSL.OPENSSL_ENCRYPT : OpenSSL.OPENSSL_DECRYPT);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: fail to set key length");
|
||||||
|
ret = OpenSSL.EVP_CIPHER_CTX_set_key_length(ctx, keyLen);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: fail to set key length");
|
||||||
|
ret = OpenSSL.EVP_CipherInit_ex(ctx, IntPtr.Zero, IntPtr.Zero, realkey,
|
||||||
|
_method == "rc4-md5" ? null : iv,
|
||||||
|
isEncrypt ? OpenSSL.OPENSSL_ENCRYPT : OpenSSL.OPENSSL_DECRYPT);
|
||||||
|
if (ret != 1) throw new System.Exception("openssl: cannot set key and iv");
|
||||||
|
OpenSSL.EVP_CIPHER_CTX_set_padding(ctx, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void cipherUpdate(bool isEncrypt, int length, byte[] buf, byte[] outbuf)
|
||||||
|
{
|
||||||
|
// C# could be multi-threaded
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
throw new ObjectDisposedException(this.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
int outlen = 0;
|
||||||
|
var ret = OpenSSL.EVP_CipherUpdate(isEncrypt ? _encryptCtx : _decryptCtx,
|
||||||
|
outbuf, out outlen, buf, length);
|
||||||
|
if (ret != 1)
|
||||||
|
throw new CryptoErrorException(String.Format("ret is {0}", ret));
|
||||||
|
Debug.Assert(outlen == length);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IDisposable
|
||||||
|
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
// instance based lock
|
||||||
|
private readonly object _lock = new object();
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~StreamOpenSSLEncryptor()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
if (_disposed) return;
|
||||||
|
_disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
// free managed objects
|
||||||
|
}
|
||||||
|
|
||||||
|
// free unmanaged objects
|
||||||
|
if (_encryptCtx != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
OpenSSL.EVP_CIPHER_CTX_free(_encryptCtx);
|
||||||
|
_encryptCtx = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_decryptCtx != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
OpenSSL.EVP_CIPHER_CTX_free(_decryptCtx);
|
||||||
|
_decryptCtx = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ namespace Shadowsocks.Encryption.Stream
|
|||||||
_decryptBuf = new byte[MAX_INPUT_SIZE + SODIUM_BLOCK_SIZE];
|
_decryptBuf = new byte[MAX_INPUT_SIZE + SODIUM_BLOCK_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo> {
|
private static readonly Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo> {
|
||||||
{ "salsa20", new EncryptorInfo(32, 8, CIPHER_SALSA20) },
|
{ "salsa20", new EncryptorInfo(32, 8, CIPHER_SALSA20) },
|
||||||
{ "chacha20", new EncryptorInfo(32, 8, CIPHER_CHACHA20) },
|
{ "chacha20", new EncryptorInfo(32, 8, CIPHER_CHACHA20) },
|
||||||
{ "chacha20-ietf", new EncryptorInfo(32, 12, CIPHER_CHACHA20_IETF) }
|
{ "chacha20-ietf", new EncryptorInfo(32, 12, CIPHER_CHACHA20_IETF) }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("Shadowsocks")]
|
[assembly: AssemblyProduct("Shadowsocks")]
|
||||||
[assembly: AssemblyCopyright("clowwindy & community 2017")]
|
[assembly: AssemblyCopyright("clowwindy & community 2018")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|||||||
+44
-44
@@ -1,10 +1,10 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <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>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -13,13 +13,13 @@ namespace Shadowsocks.Properties {
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
// class via a tool like ResGen or Visual Studio.
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
internal class Resources {
|
||||||
@@ -33,7 +33,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
@@ -47,8 +47,8 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overrides the current thread's CurrentUICulture property for all
|
/// 使用此强类型资源类,为所有资源查找
|
||||||
/// resource lookups using this strongly typed resource class.
|
/// 重写当前线程的 CurrentUICulture 属性。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
@@ -61,7 +61,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] abp_js {
|
internal static byte[] abp_js {
|
||||||
get {
|
get {
|
||||||
@@ -71,28 +71,28 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to # translation for Japanese
|
/// 查找类似 # translation for Japanese
|
||||||
///
|
///
|
||||||
///Shadowsocks=Shadowsocks
|
///Shadowsocks=Shadowsocks
|
||||||
///
|
///
|
||||||
///# Menu items
|
///# Menu items
|
||||||
///
|
///
|
||||||
///Enable System Proxy=システムの代理を有効にする
|
///Enable System Proxy=システム プロキシを有効にする
|
||||||
///Mode=モード
|
///Mode=モード
|
||||||
///PAC=PAC
|
///PAC=PAC
|
||||||
///Global=全般
|
///Global=全般
|
||||||
///Servers=サーバ
|
///Servers=サーバー
|
||||||
///Edit Servers...=サーバーを編集する...
|
///Edit Servers...=サーバーの編集...
|
||||||
///Statistics Config...=統計情報の設定...
|
///Statistics Config...=統計情報の設定...
|
||||||
///Start on Boot=システムと同時に起動
|
///Start on Boot=システムと同時に起動
|
||||||
///Forward Proxy...=代理を転送する...
|
///Forward Proxy...=フォワードプロキシの設定...
|
||||||
///Allow Clients from LAN=LANからのクライアントを許可する
|
///Allow Clients from LAN=LAN からのアクセスを許可
|
||||||
///Local PAC=ローカル PAC
|
///Local PAC=ローカル PAC
|
||||||
///Online PAC=オンライン PAC
|
///Online PAC=オンライン PAC
|
||||||
///Edit Local PAC File...=ローカル PAC ファイルを編集する...
|
///Edit Local PAC File...=ローカル PAC ファイルの編集...
|
||||||
///Update Local PAC from GFWList=GFWList から、ローカル PACを更新する
|
///Update Local PAC from GFWList=GFWList からローカル PAC を更新
|
||||||
///Edit User Rule for GFWList...=利用者規則を編集する...
|
///Edit User Rule for GFWList...=ユーザールールの編集...
|
||||||
///Secure Local [rest of string was truncated]";.
|
///Secure Local [字符串的其余部分被截断]"; 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string ja {
|
internal static string ja {
|
||||||
get {
|
get {
|
||||||
@@ -101,7 +101,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] libsscrypto_dll {
|
internal static byte[] libsscrypto_dll {
|
||||||
get {
|
get {
|
||||||
@@ -111,7 +111,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] mgwz_dll {
|
internal static byte[] mgwz_dll {
|
||||||
get {
|
get {
|
||||||
@@ -121,14 +121,14 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__
|
/// 查找类似 listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__
|
||||||
///toggle 0
|
///toggle 0
|
||||||
///logfile ss_privoxy.log
|
///logfile ss_privoxy.log
|
||||||
///show-on-task-bar 0
|
///show-on-task-bar 0
|
||||||
///activity-animation 0
|
///activity-animation 0
|
||||||
///forward-socks5 / 127.0.0.1:__SOCKS_PORT__ .
|
///forward-socks5 / 127.0.0.1:__SOCKS_PORT__ .
|
||||||
///hide-console
|
///hide-console
|
||||||
///.
|
/// 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string privoxy_conf {
|
internal static string privoxy_conf {
|
||||||
get {
|
get {
|
||||||
@@ -137,7 +137,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] privoxy_exe {
|
internal static byte[] privoxy_exe {
|
||||||
get {
|
get {
|
||||||
@@ -147,7 +147,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] proxy_pac_txt {
|
internal static byte[] proxy_pac_txt {
|
||||||
get {
|
get {
|
||||||
@@ -157,7 +157,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static System.Drawing.Bitmap ss16 {
|
internal static System.Drawing.Bitmap ss16 {
|
||||||
get {
|
get {
|
||||||
@@ -167,7 +167,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static System.Drawing.Bitmap ss20 {
|
internal static System.Drawing.Bitmap ss20 {
|
||||||
get {
|
get {
|
||||||
@@ -177,7 +177,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static System.Drawing.Bitmap ss24 {
|
internal static System.Drawing.Bitmap ss24 {
|
||||||
get {
|
get {
|
||||||
@@ -187,7 +187,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static System.Drawing.Bitmap ssIn24 {
|
internal static System.Drawing.Bitmap ssIn24 {
|
||||||
get {
|
get {
|
||||||
@@ -197,7 +197,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static System.Drawing.Bitmap ssOut24 {
|
internal static System.Drawing.Bitmap ssOut24 {
|
||||||
get {
|
get {
|
||||||
@@ -207,7 +207,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static System.Drawing.Bitmap ssw128 {
|
internal static System.Drawing.Bitmap ssw128 {
|
||||||
get {
|
get {
|
||||||
@@ -217,7 +217,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] sysproxy_exe {
|
internal static byte[] sysproxy_exe {
|
||||||
get {
|
get {
|
||||||
@@ -227,7 +227,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static byte[] sysproxy64_exe {
|
internal static byte[] sysproxy64_exe {
|
||||||
get {
|
get {
|
||||||
@@ -237,9 +237,9 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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
|
///! See https://adblockplus.org/en/filter-cheatsheet
|
||||||
///.
|
/// 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string user_rule {
|
internal static string user_rule {
|
||||||
get {
|
get {
|
||||||
@@ -248,7 +248,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to # translation for Simplified Chinese
|
/// 查找类似 # translation for Simplified Chinese
|
||||||
///
|
///
|
||||||
///Shadowsocks=Shadowsocks
|
///Shadowsocks=Shadowsocks
|
||||||
///
|
///
|
||||||
@@ -270,7 +270,7 @@ namespace Shadowsocks.Properties {
|
|||||||
///Update Local PAC from GFWList=从 GFWList 更新本地 PAC
|
///Update Local PAC from GFWList=从 GFWList 更新本地 PAC
|
||||||
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
|
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
|
||||||
///Secure Local PAC=保护本地 PAC
|
///Secure Local PAC=保护本地 PAC
|
||||||
///Cop [rest of string was truncated]";.
|
///Cop [字符串的其余部分被截断]"; 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string zh_CN {
|
internal static string zh_CN {
|
||||||
get {
|
get {
|
||||||
@@ -279,7 +279,7 @@ namespace Shadowsocks.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to # translation for Traditional Chinese
|
/// 查找类似 # translation for Traditional Chinese
|
||||||
///
|
///
|
||||||
///Shadowsocks=Shadowsocks
|
///Shadowsocks=Shadowsocks
|
||||||
///
|
///
|
||||||
@@ -300,7 +300,7 @@ namespace Shadowsocks.Properties {
|
|||||||
///Edit Local PAC File...=編輯本機 PAC 檔案...
|
///Edit Local PAC File...=編輯本機 PAC 檔案...
|
||||||
///Update Local PAC from GFWList=從 GFWList 更新本機 PAC
|
///Update Local PAC from GFWList=從 GFWList 更新本機 PAC
|
||||||
///Edit User Rule for GFWList...=編輯 GFWList 的使用者規則...
|
///Edit User Rule for GFWList...=編輯 GFWList 的使用者規則...
|
||||||
///Secure Local PAC=安全本機 [rest of string was truncated]";.
|
///Secure Local PAC=安全本機 [字符串的其余部分被截断]"; 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string zh_TW {
|
internal static string zh_TW {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
<value>..\Data\ja.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
<value>..\Data\ja.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="libsscrypto_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<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>
|
<value>..\Data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="mgwz_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="mgwz_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\data\mgwz.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>..\data\mgwz.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Shadowsocks.Util.SystemProxy
|
|||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
arguments = global
|
arguments = global
|
||||||
? $"global {proxyServer} <local>;localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;172.32.*;192.168.*"
|
? $"global {proxyServer} <local>;localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*"
|
||||||
: $"pac {pacURL}";
|
: $"pac {pacURL}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+2
-1
@@ -252,7 +252,8 @@
|
|||||||
"aes-128-gcm",
|
"aes-128-gcm",
|
||||||
"aes-192-gcm",
|
"aes-192-gcm",
|
||||||
"aes-256-gcm",
|
"aes-256-gcm",
|
||||||
"chacha20-ietf-poly1305"});
|
"chacha20-ietf-poly1305",
|
||||||
|
"xchacha20-ietf-poly1305"});
|
||||||
this.EncryptionSelect.Location = new System.Drawing.Point(101, 109);
|
this.EncryptionSelect.Location = new System.Drawing.Point(101, 109);
|
||||||
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);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Shadowsocks.View
|
|||||||
private ShadowsocksController controller;
|
private ShadowsocksController controller;
|
||||||
|
|
||||||
// this is a copy of configuration that we are working on
|
// this is a copy of configuration that we are working on
|
||||||
private ProxyConfig _modifiedConfiguration;
|
private ProxyConfig _modifiedProxyConfig;
|
||||||
|
|
||||||
public ProxyForm(ShadowsocksController controller)
|
public ProxyForm(ShadowsocksController controller)
|
||||||
{
|
{
|
||||||
@@ -49,53 +49,47 @@ namespace Shadowsocks.View
|
|||||||
|
|
||||||
private void LoadCurrentConfiguration()
|
private void LoadCurrentConfiguration()
|
||||||
{
|
{
|
||||||
_modifiedConfiguration = controller.GetConfigurationCopy().proxy;
|
_modifiedProxyConfig = controller.GetConfigurationCopy().proxy;
|
||||||
UseProxyCheckBox.Checked = _modifiedConfiguration.useProxy;
|
UseProxyCheckBox.Checked = _modifiedProxyConfig.useProxy;
|
||||||
ProxyServerTextBox.Text = _modifiedConfiguration.proxyServer;
|
ProxyServerTextBox.Text = _modifiedProxyConfig.proxyServer;
|
||||||
ProxyPortTextBox.Text = _modifiedConfiguration.proxyPort.ToString();
|
ProxyPortTextBox.Text = _modifiedProxyConfig.proxyPort.ToString();
|
||||||
ProxyTimeoutTextBox.Text = _modifiedConfiguration.proxyTimeout.ToString();
|
ProxyTimeoutTextBox.Text = _modifiedProxyConfig.proxyTimeout.ToString();
|
||||||
ProxyTypeComboBox.SelectedIndex = _modifiedConfiguration.proxyType;
|
ProxyTypeComboBox.SelectedIndex = _modifiedProxyConfig.proxyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OKButton_Click(object sender, EventArgs e)
|
private void OKButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (UseProxyCheckBox.Checked)
|
if (_modifiedProxyConfig.useProxy=UseProxyCheckBox.Checked)
|
||||||
{
|
{
|
||||||
int port;
|
if (!int.TryParse(ProxyPortTextBox.Text, out _modifiedProxyConfig.proxyPort))
|
||||||
int timeout;
|
|
||||||
if (!int.TryParse(ProxyPortTextBox.Text, out port))
|
|
||||||
{
|
{
|
||||||
MessageBox.Show(I18N.GetString("Illegal port number format"));
|
MessageBox.Show(I18N.GetString("Illegal port number format"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!int.TryParse(ProxyTimeoutTextBox.Text, out timeout))
|
if (!int.TryParse(ProxyTimeoutTextBox.Text, out _modifiedProxyConfig.proxyTimeout))
|
||||||
{
|
{
|
||||||
MessageBox.Show(I18N.GetString("Illegal timeout format"));
|
MessageBox.Show(I18N.GetString("Illegal timeout format"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var type = ProxyTypeComboBox.SelectedIndex;
|
_modifiedProxyConfig.proxyType = ProxyTypeComboBox.SelectedIndex;
|
||||||
var proxy = ProxyServerTextBox.Text;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Configuration.CheckServer(proxy);
|
Configuration.CheckServer(_modifiedProxyConfig.proxyServer = ProxyServerTextBox.Text);
|
||||||
Configuration.CheckPort(port);
|
Configuration.CheckPort(_modifiedProxyConfig.proxyPort);
|
||||||
Configuration.CheckTimeout(timeout, ProxyConfig.MaxProxyTimeoutSec);
|
Configuration.CheckTimeout(_modifiedProxyConfig.proxyTimeout, ProxyConfig.MaxProxyTimeoutSec);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message);
|
MessageBox.Show(ex.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
controller.EnableProxy(type, proxy, port, timeout);
|
controller.SaveProxy(_modifiedProxyConfig);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
controller.DisableProxy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
@@ -119,17 +113,17 @@ namespace Shadowsocks.View
|
|||||||
{
|
{
|
||||||
if (UseProxyCheckBox.Checked)
|
if (UseProxyCheckBox.Checked)
|
||||||
{
|
{
|
||||||
ProxyServerTextBox.Enabled = true;
|
ProxyServerTextBox.Enabled =
|
||||||
ProxyPortTextBox.Enabled = true;
|
ProxyPortTextBox.Enabled =
|
||||||
ProxyTimeoutTextBox.Enabled = true;
|
ProxyTimeoutTextBox.Enabled =
|
||||||
ProxyTypeComboBox.Enabled = true;
|
ProxyTypeComboBox.Enabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProxyServerTextBox.Enabled = false;
|
ProxyServerTextBox.Enabled =
|
||||||
ProxyPortTextBox.Enabled = false;
|
ProxyPortTextBox.Enabled =
|
||||||
ProxyTimeoutTextBox.Enabled = false;
|
ProxyTimeoutTextBox.Enabled =
|
||||||
ProxyTypeComboBox.Enabled = false;
|
ProxyTypeComboBox.Enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,49 @@
|
|||||||
</setting>
|
</setting>
|
||||||
</Shadowsocks.Properties.Settings>
|
</Shadowsocks.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
|
<!-- Uncomment to dump network tracing info
|
||||||
|
<system.diagnostics>
|
||||||
|
<sources>
|
||||||
|
<source name="System.Net" tracemode="includehex" maxdatasize="1024">
|
||||||
|
<listeners>
|
||||||
|
<add name="System.Net"/>
|
||||||
|
</listeners>
|
||||||
|
</source>
|
||||||
|
<source name="System.Net.Cache">
|
||||||
|
<listeners>
|
||||||
|
<add name="System.Net"/>
|
||||||
|
</listeners>
|
||||||
|
</source>
|
||||||
|
<source name="System.Net.Http">
|
||||||
|
<listeners>
|
||||||
|
<add name="System.Net"/>
|
||||||
|
</listeners>
|
||||||
|
</source>
|
||||||
|
<source name="System.Net.Sockets">
|
||||||
|
<listeners>
|
||||||
|
<add name="System.Net"/>
|
||||||
|
</listeners>
|
||||||
|
</source>
|
||||||
|
<source name="System.Net.WebSockets">
|
||||||
|
<listeners>
|
||||||
|
<add name="System.Net"/>
|
||||||
|
</listeners>
|
||||||
|
</source>
|
||||||
|
</sources>
|
||||||
|
<switches>
|
||||||
|
<add name="System.Net" value="Verbose"/>
|
||||||
|
<add name="System.Net.Cache" value="Verbose"/>
|
||||||
|
<add name="System.Net.Http" value="Verbose"/>
|
||||||
|
<add name="System.Net.Sockets" value="Verbose"/>
|
||||||
|
<add name="System.Net.WebSockets" value="Verbose"/>
|
||||||
|
</switches>
|
||||||
|
<sharedListeners>
|
||||||
|
<add name="System.Net"
|
||||||
|
type="System.Diagnostics.TextWriterTraceListener"
|
||||||
|
initializeData="network-tracing.log"
|
||||||
|
/>
|
||||||
|
</sharedListeners>
|
||||||
|
<trace autoflush="true"/>
|
||||||
|
</system.diagnostics>
|
||||||
|
-->
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Caseless.Fody" version="1.5.0" targetFramework="net462" developmentDependency="true" />
|
<package id="Caseless.Fody" version="1.7.3" targetFramework="net462" developmentDependency="true" />
|
||||||
<package id="Costura.Fody" version="1.4.1" targetFramework="net462" developmentDependency="true" />
|
<package id="Costura.Fody" version="1.6.2" targetFramework="net462" developmentDependency="true" />
|
||||||
<package id="Fody" version="2.0.9" targetFramework="net462" developmentDependency="true" />
|
<package id="Fody" version="2.3.23" targetFramework="net462" developmentDependency="true" />
|
||||||
<package id="GlobalHotKey" version="1.1.0" targetFramework="net462" />
|
<package id="GlobalHotKey" version="1.1.0" targetFramework="net462" />
|
||||||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net462" />
|
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
|
||||||
<package id="StringEx.CS" version="0.3.1" targetFramework="net462" developmentDependency="true" />
|
<package id="StringEx.CS" version="0.3.1" targetFramework="net462" developmentDependency="true" />
|
||||||
<package id="ZXing.Net" version="0.15.0" targetFramework="net462" />
|
<package id="ZXing.Net" version="0.16.2" targetFramework="net462" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -66,6 +66,13 @@
|
|||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Caseless, Version=0.0.0.0, Culture=neutral, PublicKeyToken=409b3227471b0f0d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>3rd\Caseless.Fody.1.7.3\lib\net452\Caseless.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>3rd\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>3rd\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
|
<HintPath>3rd\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@@ -73,7 +80,7 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Microsoft.VisualBasic" />
|
<Reference Include="Microsoft.VisualBasic" />
|
||||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>3rd\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>3rd\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
@@ -85,17 +92,18 @@
|
|||||||
<Reference Include="System.Windows.Forms.DataVisualization" />
|
<Reference Include="System.Windows.Forms.DataVisualization" />
|
||||||
<Reference Include="System.XML" />
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
<Reference Include="zxing, Version=0.15.0.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
|
<Reference Include="zxing, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
|
||||||
<HintPath>3rd\ZXing.Net.0.15.0\lib\net461\zxing.dll</HintPath>
|
<HintPath>3rd\ZXing.Net.0.16.2\lib\net461\zxing.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="zxing.presentation, Version=0.15.0.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
|
<Reference Include="zxing.presentation, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
|
||||||
<HintPath>3rd\ZXing.Net.0.15.0\lib\net461\zxing.presentation.dll</HintPath>
|
<HintPath>3rd\ZXing.Net.0.16.2\lib\net461\zxing.presentation.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Controller\System\Hotkeys\HotkeyCallbacks.cs" />
|
<Compile Include="Controller\System\Hotkeys\HotkeyCallbacks.cs" />
|
||||||
<Compile Include="Encryption\AEAD\AEADEncryptor.cs" />
|
<Compile Include="Encryption\AEAD\AEADEncryptor.cs" />
|
||||||
<Compile Include="Encryption\AEAD\AEADMbedTLSEncryptor.cs" />
|
<Compile Include="Encryption\AEAD\AEADMbedTLSEncryptor.cs" />
|
||||||
|
<Compile Include="Encryption\AEAD\AEADOpenSSLEncryptor.cs" />
|
||||||
<Compile Include="Encryption\AEAD\AEADSodiumEncryptor.cs" />
|
<Compile Include="Encryption\AEAD\AEADSodiumEncryptor.cs" />
|
||||||
<Compile Include="Encryption\CircularBuffer\ByteCircularBuffer.cs" />
|
<Compile Include="Encryption\CircularBuffer\ByteCircularBuffer.cs" />
|
||||||
<Compile Include="Encryption\EncryptorBase.cs" />
|
<Compile Include="Encryption\EncryptorBase.cs" />
|
||||||
@@ -103,10 +111,12 @@
|
|||||||
<Compile Include="Encryption\Exception\CryptoException.cs" />
|
<Compile Include="Encryption\Exception\CryptoException.cs" />
|
||||||
<Compile Include="Encryption\IEncryptor.cs" />
|
<Compile Include="Encryption\IEncryptor.cs" />
|
||||||
<Compile Include="Encryption\MbedTLS.cs" />
|
<Compile Include="Encryption\MbedTLS.cs" />
|
||||||
|
<Compile Include="Encryption\OpenSSL.cs" />
|
||||||
<Compile Include="Encryption\RNG.cs" />
|
<Compile Include="Encryption\RNG.cs" />
|
||||||
<Compile Include="Encryption\Sodium.cs" />
|
<Compile Include="Encryption\Sodium.cs" />
|
||||||
<Compile Include="Encryption\Stream\StreamEncryptor.cs" />
|
<Compile Include="Encryption\Stream\StreamEncryptor.cs" />
|
||||||
<Compile Include="Encryption\Stream\StreamMbedTLSEncryptor.cs" />
|
<Compile Include="Encryption\Stream\StreamMbedTLSEncryptor.cs" />
|
||||||
|
<Compile Include="Encryption\Stream\StreamOpenSSLEncryptor.cs" />
|
||||||
<Compile Include="Encryption\Stream\StreamSodiumEncryptor.cs" />
|
<Compile Include="Encryption\Stream\StreamSodiumEncryptor.cs" />
|
||||||
<Compile Include="Model\HotKeyConfig.cs" />
|
<Compile Include="Model\HotKeyConfig.cs" />
|
||||||
<Compile Include="Model\ProxyConfig.cs" />
|
<Compile Include="Model\ProxyConfig.cs" />
|
||||||
@@ -342,13 +352,15 @@ foreach (var item in filesToCleanup)
|
|||||||
<Target Name="CleanReferenceCopyLocalPaths" AfterTargets="AfterBuild;NonWinFodyTarget">
|
<Target Name="CleanReferenceCopyLocalPaths" AfterTargets="AfterBuild;NonWinFodyTarget">
|
||||||
<CosturaCleanup Config="FodyWeavers.xml" Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
|
<CosturaCleanup Config="FodyWeavers.xml" Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="3rd\Fody.2.0.9\build\netstandard1.4\Fody.targets" Condition="Exists('3rd\Fody.2.0.9\build\netstandard1.4\Fody.targets')" />
|
<Import Project="3rd\Fody.2.3.23\build\Fody.targets" Condition="Exists('3rd\Fody.2.3.23\build\Fody.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>此项目引用这台计算机上缺少的 NuGet 程序包。使用 NuGet 程序包还原可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('3rd\Fody.2.0.9\build\netstandard1.4\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '3rd\Fody.2.0.9\build\netstandard1.4\Fody.targets'))" />
|
<Error Condition="!Exists('3rd\Fody.2.3.23\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '3rd\Fody.2.3.23\build\Fody.targets'))" />
|
||||||
|
<Error Condition="!Exists('3rd\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '3rd\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
|
<Import Project="3rd\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('3rd\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
|||||||
@@ -227,6 +227,47 @@ namespace test
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestOpenSSLEncryption()
|
||||||
|
{
|
||||||
|
// run it once before the multi-threading test to initialize global tables
|
||||||
|
RunSingleOpenSSLEncryptionThread();
|
||||||
|
List<Thread> threads = new List<Thread>();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
Thread t = new Thread(new ThreadStart(RunSingleOpenSSLEncryptionThread));
|
||||||
|
threads.Add(t);
|
||||||
|
t.Start();
|
||||||
|
}
|
||||||
|
foreach (Thread t in threads)
|
||||||
|
{
|
||||||
|
t.Join();
|
||||||
|
}
|
||||||
|
RNG.Close();
|
||||||
|
Assert.IsFalse(encryptionFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RunSingleOpenSSLEncryptionThread()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
var random = new Random();
|
||||||
|
IEncryptor encryptor;
|
||||||
|
IEncryptor decryptor;
|
||||||
|
encryptor = new StreamOpenSSLEncryptor("aes-256-cfb", "barfoo!");
|
||||||
|
decryptor = new StreamOpenSSLEncryptor("aes-256-cfb", "barfoo!");
|
||||||
|
RunEncryptionRound(encryptor, decryptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
encryptionFailed = true;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void ParseAndGenerateShadowsocksUrl()
|
public void ParseAndGenerateShadowsocksUrl()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user