Compare commits

...
14 Commits
Author SHA1 Message Date
celeron533 25c1d02395 Update CHANGES and bump version 2018-03-14 22:32:31 +08:00
celeron533 897934c233 Add comments in app.config 2018-03-11 21:46:01 +08:00
Allen Zhu fdbd3a975b Merge pull request #1732 from wongsyrone/patch-1
add official way to dump network tracing info
2018-03-11 08:34:45 -05:00
Syrone Wong 7fd9ce2bc3 add official way to dump network tracing info
just uncomment the specific node in app.config, no need to recompile
to take effect. It will be shipped as Shadowsocks.exe.config after built.

This is for debugging only.
2018-03-11 16:05:37 +08:00
Allen Zhu c168af6975 Merge pull request #1725 from celeron533/master
add xchacha20-ietf-poly1305
2018-03-07 06:27:57 -06:00
Syrone Wong 3329291ab9 add xchacha20-ietf-poly1305
- update mbedtls to 2.7.0, use new md5 api
- update libsodium to 1.0.16
- static link to openssl 1.1.0g, check libsscrypto repo for detail
2018-03-03 22:22:01 +08:00
celeron533 1e04279d37 Update issue template 2018-03-03 20:37:18 +08:00
celeron533 20fa87ba89 Fix proxy bypass list #1674 2018-02-22 10:29:46 +08:00
celeron533 5db7c79407 Minor changes on Forward Proxy 2018-02-20 18:27:26 +08:00
HYec 85bd65e021 Only start the current server's plugin 2018-02-20 12:32:01 +08:00
HYec 7197e46b53 Close sockets before stop plugins 2018-02-20 12:31:53 +08:00
Allen Zhu b2c0bba953 Merge pull request #1682 from chenshaoju/patch-1
Add new requirement
2018-02-17 09:06:05 -06:00
Chen Shaoju d266ea2e39 fix 2018-02-17 11:28:01 +08:00
Chen Shaoju a5b11aee34 Add new requirements 2018-02-17 11:21:16 +08:00
18 changed files with 130 additions and 83 deletions
+9 -8
View File
@@ -1,19 +1,20 @@
Please read Wiki carefully, especially https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting.
Please answer these questions before submitting your issue. Thanks!
Please read Wiki carefully, especially / 提问前请先阅读wiki https://github.com/shadowsocks/shadowsocks-windows/wiki/Troubleshooting.
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) / 配置文件和日志文件(请隐去敏感信息)
+6
View File
@@ -1,3 +1,9 @@
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
+2 -1
View File
@@ -21,7 +21,7 @@ Download the [latest release].
#### Requirements
Microsoft [.NET Framework 4.6.2] or higher.
Microsoft [.NET Framework 4.6.2] or higher, Microsoft [Visual C++ 2015 Redistributable] (x86) .
#### Basic
@@ -118,3 +118,4 @@ GPLv3
[.NET Framework 4.6.2]: https://www.microsoft.com/en-US/download/details.aspx?id=53344
[Visual Studio 2015]: https://www.visualstudio.com/downloads/
[.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
@@ -24,7 +24,7 @@ namespace Shadowsocks.Controller
public string LatestVersionLocalName;
public event EventHandler CheckUpdateCompleted;
public const string Version = "4.0.8";
public const string Version = "4.0.9";
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;
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;
_config.proxy = proxyConfig;
SaveConfig(_config);
}
@@ -490,8 +480,6 @@ namespace Shadowsocks.Controller
protected void Reload()
{
StopPlugins();
Encryption.RNG.Reload();
// some logic in configuration updated the config when saving, we need to read it again
_config = Configuration.Load();
@@ -521,6 +509,9 @@ namespace Shadowsocks.Controller
{
_listener.Stop();
}
StopPlugins();
// 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
// though UseShellExecute is set to true now
@@ -534,7 +525,7 @@ namespace Shadowsocks.Controller
strategy.ReloadServers();
}
StartPlugins();
StartPlugin();
privoxyRunner.Start(_config);
TCPRelay tcpRelay = new TCPRelay(this, _config);
@@ -572,13 +563,10 @@ namespace Shadowsocks.Controller
Utils.ReleaseMemory(true);
}
private void StartPlugins()
private void StartPlugin()
{
foreach (var server in _config.configs)
{
// Early start plugin processes
GetPluginLocalEndPointIfConfigured(server);
}
var server = _config.GetCurrentServer();
GetPluginLocalEndPointIfConfigured(server);
}
protected void SaveConfig(Configuration newConfig)
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,8 @@ namespace Shadowsocks.Encryption.AEAD
: AEADEncryptor, IDisposable
{
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[] _sodiumDecSubkey;
@@ -25,6 +26,7 @@ namespace Shadowsocks.Encryption.AEAD
private static readonly Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo>
{
{"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)},
};
@@ -65,6 +67,13 @@ namespace Shadowsocks.Encryption.AEAD
null, _encNonce,
_sodiumEncSubkey);
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:
ret = Sodium.crypto_aead_aes256gcm_encrypt(ciphertext, ref encClen,
plaintext, (ulong)plen,
@@ -99,6 +108,13 @@ namespace Shadowsocks.Encryption.AEAD
null, 0,
_decNonce, _sodiumDecSubkey);
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:
ret = Sodium.crypto_aead_aes256gcm_decrypt(plaintext, ref decPlen,
null,
+3 -2
View File
@@ -34,7 +34,8 @@ namespace Shadowsocks.Encryption
public static byte[] MD5(byte[] input)
{
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;
}
@@ -42,7 +43,7 @@ namespace Shadowsocks.Encryption
private static extern IntPtr LoadLibrary(string path);
[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>
/// Get cipher ctx size for unmanaged memory allocation
+2 -2
View File
@@ -13,7 +13,7 @@ namespace Shadowsocks.Encryption
// XXX: only for OpenSSL 1.1.0 and higher
public static class OpenSSL
{
private const string DLLNAME = "libcrypto-1_1.dll";
private const string DLLNAME = "libsscrypto.dll";
public const int OPENSSL_ENCRYPT = 1;
public const int OPENSSL_DECRYPT = 0;
@@ -27,7 +27,7 @@ namespace Shadowsocks.Encryption
string dllPath = Utils.GetTempPath(DLLNAME);
try
{
FileManager.UncompressFile(dllPath, Resources.libcrypto_1_1_dll);
FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll);
}
catch (IOException)
{
+8
View File
@@ -73,6 +73,14 @@ namespace Shadowsocks.Encryption
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);
[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)]
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);
-10
View File
@@ -100,16 +100,6 @@ namespace Shadowsocks.Properties {
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] libcrypto_1_1_dll {
get {
object obj = ResourceManager.GetObject("libcrypto_1_1_dll", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
+1 -4
View File
@@ -124,11 +124,8 @@
<data name="ja" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\ja.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="libcrypto_1_1_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\libcrypto-1_1.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="libsscrypto_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>..\Data\libsscrypto.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<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>
@@ -60,7 +60,7 @@ namespace Shadowsocks.Util.SystemProxy
if (enable)
{
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}";
}
else
+2 -1
View File
@@ -252,7 +252,8 @@
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
"chacha20-ietf-poly1305"});
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305"});
this.EncryptionSelect.Location = new System.Drawing.Point(101, 109);
this.EncryptionSelect.Name = "EncryptionSelect";
this.EncryptionSelect.Size = new System.Drawing.Size(160, 20);
+24 -30
View File
@@ -12,7 +12,7 @@ namespace Shadowsocks.View
private ShadowsocksController controller;
// this is a copy of configuration that we are working on
private ProxyConfig _modifiedConfiguration;
private ProxyConfig _modifiedProxyConfig;
public ProxyForm(ShadowsocksController controller)
{
@@ -49,53 +49,47 @@ namespace Shadowsocks.View
private void LoadCurrentConfiguration()
{
_modifiedConfiguration = controller.GetConfigurationCopy().proxy;
UseProxyCheckBox.Checked = _modifiedConfiguration.useProxy;
ProxyServerTextBox.Text = _modifiedConfiguration.proxyServer;
ProxyPortTextBox.Text = _modifiedConfiguration.proxyPort.ToString();
ProxyTimeoutTextBox.Text = _modifiedConfiguration.proxyTimeout.ToString();
ProxyTypeComboBox.SelectedIndex = _modifiedConfiguration.proxyType;
_modifiedProxyConfig = controller.GetConfigurationCopy().proxy;
UseProxyCheckBox.Checked = _modifiedProxyConfig.useProxy;
ProxyServerTextBox.Text = _modifiedProxyConfig.proxyServer;
ProxyPortTextBox.Text = _modifiedProxyConfig.proxyPort.ToString();
ProxyTimeoutTextBox.Text = _modifiedProxyConfig.proxyTimeout.ToString();
ProxyTypeComboBox.SelectedIndex = _modifiedProxyConfig.proxyType;
}
private void OKButton_Click(object sender, EventArgs e)
{
if (UseProxyCheckBox.Checked)
if (_modifiedProxyConfig.useProxy=UseProxyCheckBox.Checked)
{
int port;
int timeout;
if (!int.TryParse(ProxyPortTextBox.Text, out port))
if (!int.TryParse(ProxyPortTextBox.Text, out _modifiedProxyConfig.proxyPort))
{
MessageBox.Show(I18N.GetString("Illegal port number format"));
return;
}
if (!int.TryParse(ProxyTimeoutTextBox.Text, out timeout))
if (!int.TryParse(ProxyTimeoutTextBox.Text, out _modifiedProxyConfig.proxyTimeout))
{
MessageBox.Show(I18N.GetString("Illegal timeout format"));
return;
}
var type = ProxyTypeComboBox.SelectedIndex;
var proxy = ProxyServerTextBox.Text;
_modifiedProxyConfig.proxyType = ProxyTypeComboBox.SelectedIndex;
try
{
Configuration.CheckServer(proxy);
Configuration.CheckPort(port);
Configuration.CheckTimeout(timeout, ProxyConfig.MaxProxyTimeoutSec);
Configuration.CheckServer(_modifiedProxyConfig.proxyServer = ProxyServerTextBox.Text);
Configuration.CheckPort(_modifiedProxyConfig.proxyPort);
Configuration.CheckTimeout(_modifiedProxyConfig.proxyTimeout, ProxyConfig.MaxProxyTimeoutSec);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}
controller.EnableProxy(type, proxy, port, timeout);
}
else
{
controller.DisableProxy();
}
controller.SaveProxy(_modifiedProxyConfig);
this.Close();
}
@@ -119,17 +113,17 @@ namespace Shadowsocks.View
{
if (UseProxyCheckBox.Checked)
{
ProxyServerTextBox.Enabled = true;
ProxyPortTextBox.Enabled = true;
ProxyTimeoutTextBox.Enabled = true;
ProxyServerTextBox.Enabled =
ProxyPortTextBox.Enabled =
ProxyTimeoutTextBox.Enabled =
ProxyTypeComboBox.Enabled = true;
}
else
{
ProxyServerTextBox.Enabled = false;
ProxyPortTextBox.Enabled = false;
ProxyTimeoutTextBox.Enabled = false;
ProxyTypeComboBox.Enabled = false;
ProxyServerTextBox.Enabled =
ProxyPortTextBox.Enabled =
ProxyTimeoutTextBox.Enabled =
ProxyTypeComboBox.Enabled = false;
}
}
}
+45
View File
@@ -39,4 +39,49 @@
</setting>
</Shadowsocks.Properties.Settings>
</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>
@@ -253,7 +253,6 @@
<SubType>Designer</SubType>
</None>
<None Include="Data\abp.js.gz" />
<None Include="Data\libcrypto-1_1.dll.gz" />
<None Include="Data\libsscrypto.dll.gz" />
<None Include="Data\mgwz.dll.gz" />
<None Include="Data\privoxy.exe.gz" />