pull/1219/head
刘河 2019-01-11 11:27:37 +08:00
parent 478226e479
commit 03aa58cd77
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,9 @@ func NewCryptConn(conn net.Conn, crypt bool) *CryptConn {
//加密写
func (s *CryptConn) Write(b []byte) (n int, err error) {
n = len(b)
if n == 0 {
return
}
if s.crypt {
if b, err = AesEncrypt(b, []byte(cryptKey)); err != nil {
return
@ -92,6 +95,9 @@ func NewSnappyConn(conn net.Conn, crypt bool) *SnappyConn {
//snappy压缩写 包含加密
func (s *SnappyConn) Write(b []byte) (n int, err error) {
n = len(b)
if n == 0 {
return
}
if s.crypt {
if b, err = AesEncrypt(b, []byte(cryptKey)); err != nil {
log.Println("encode crypt error:", err)