@@ -53,7 +53,7 @@ namespace Shadowsocks.Controller | |||||
private Socket _remote; | private Socket _remote; | ||||
private Server _server; | private Server _server; | ||||
private byte[] _buffer = new byte[1500]; | |||||
private byte[] _buffer = new byte[65536]; | |||||
private IPEndPoint _localEndPoint; | private IPEndPoint _localEndPoint; | ||||
private IPEndPoint _remoteEndPoint; | private IPEndPoint _remoteEndPoint; | ||||
@@ -81,7 +81,7 @@ namespace Shadowsocks.Controller | |||||
IEncryptor encryptor = EncryptorFactory.GetEncryptor(_server.method, _server.password); | IEncryptor encryptor = EncryptorFactory.GetEncryptor(_server.method, _server.password); | ||||
byte[] dataIn = new byte[length - 3]; | byte[] dataIn = new byte[length - 3]; | ||||
Array.Copy(data, 3, dataIn, 0, length - 3); | Array.Copy(data, 3, dataIn, 0, length - 3); | ||||
byte[] dataOut = new byte[length - 3 + 16]; | |||||
byte[] dataOut = new byte[65536]; // enough space for AEAD ciphers | |||||
int outlen; | int outlen; | ||||
encryptor.EncryptUDP(dataIn, length - 3, dataOut, out outlen); | encryptor.EncryptUDP(dataIn, length - 3, dataOut, out outlen); | ||||
Logging.Debug(_localEndPoint, _remoteEndPoint, outlen, "UDP Relay"); | Logging.Debug(_localEndPoint, _remoteEndPoint, outlen, "UDP Relay"); | ||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.Encryption.AEAD | |||||
private static readonly byte[] InfoBytes = Encoding.ASCII.GetBytes(Info); | private static readonly byte[] InfoBytes = Encoding.ASCII.GetBytes(Info); | ||||
// for UDP only | // for UDP only | ||||
protected static byte[] _udpTmpBuf = new byte[MAX_INPUT_SIZE]; | |||||
protected static byte[] _udpTmpBuf = new byte[65536]; | |||||
// every connection should create its own buffer | // every connection should create its own buffer | ||||
private CircularBuffer<byte> _encCircularBuffer = new CircularBuffer<byte>(MAX_INPUT_SIZE * 2, false); | private CircularBuffer<byte> _encCircularBuffer = new CircularBuffer<byte>(MAX_INPUT_SIZE * 2, false); | ||||
@@ -11,7 +11,7 @@ namespace Shadowsocks.Encryption.Stream | |||||
: EncryptorBase | : EncryptorBase | ||||
{ | { | ||||
// for UDP only | // for UDP only | ||||
protected static byte[] _udpTmpBuf = new byte[MAX_INPUT_SIZE]; | |||||
protected static byte[] _udpTmpBuf = new byte[65536]; | |||||
// every connection should create its own buffer | // every connection should create its own buffer | ||||
private CircularBuffer<byte> _encCircularBuffer = new CircularBuffer<byte>(TCPHandler.BufferSize * 2, false); | private CircularBuffer<byte> _encCircularBuffer = new CircularBuffer<byte>(TCPHandler.BufferSize * 2, false); | ||||