|
|
@ -3,8 +3,9 @@ package msggateway
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
|
"compress/gzip"
|
|
|
|
"compress/gzip"
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type Compressor interface {
|
|
|
|
type Compressor interface {
|
|
|
@ -29,6 +30,7 @@ func (g *GzipCompressor) Compress(rawData []byte) ([]byte, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return gzipBuffer.Bytes(), nil
|
|
|
|
return gzipBuffer.Bytes(), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (g *GzipCompressor) DeCompress(compressedData []byte) ([]byte, error) {
|
|
|
|
func (g *GzipCompressor) DeCompress(compressedData []byte) ([]byte, error) {
|
|
|
|
buff := bytes.NewBuffer(compressedData)
|
|
|
|
buff := bytes.NewBuffer(compressedData)
|
|
|
|
reader, err := gzip.NewReader(buff)
|
|
|
|
reader, err := gzip.NewReader(buff)
|
|
|
|