ss: added chacha20 and xchacha20-ietf-poly1305 support. #21 #30

This commit is contained in:
nadoo committed 2018-09-02 19:18:51 +08:00
1 parent 7367e41cd1
commit 3c8a451d94
104 files changed
+10 -18050

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ import (
"sync"
"time"
"github.com/shadowsocks/go-shadowsocks2/core"
"github.com/nadoo/go-shadowsocks2/core"
"github.com/nadoo/glider/common/conn"
"github.com/nadoo/glider/common/log"
+4 -4
View File
@@ -105,13 +105,13 @@ func (r *aeadReader) Read(b []byte) (int, error) {
}
// if length == 0, then this is the end
len := binary.BigEndian.Uint16(r.buf[:lenSize])
if len == 0 {
l := binary.BigEndian.Uint16(r.buf[:lenSize])
if l == 0 {
return 0, nil
}
// get payload
buf := r.buf[:len]
buf := r.buf[:l]
_, err = io.ReadFull(r.Reader, buf)
if err != nil {
return 0, err
@@ -126,7 +126,7 @@ func (r *aeadReader) Read(b []byte) (int, error) {
return 0, err
}
dataLen := int(len) - r.Overhead()
dataLen := int(l) - r.Overhead()
m := copy(b, r.buf[:dataLen])
if m < int(dataLen) {
r.leftover = r.buf[m:dataLen]