This commit is contained in:
GoEdgeLab
2024-07-27 15:42:50 +08:00
parent d511145bc5
commit c19be78e0d
524 changed files with 1817 additions and 1346 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package compressions
+2 -1
View File
@@ -4,9 +4,10 @@
package compressions
import (
"github.com/andybalholm/brotli"
"io"
"strings"
"github.com/andybalholm/brotli"
)
type BrotliReader struct {
+2 -1
View File
@@ -4,10 +4,11 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"io"
"os"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
)
func TestBrotliReader(t *testing.T) {
+2 -1
View File
@@ -4,9 +4,10 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"io"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
)
func TestDeflateReader(t *testing.T) {
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
"github.com/klauspost/compress/gzip"
"io"
"github.com/klauspost/compress/gzip"
)
type GzipReader struct {
+4 -3
View File
@@ -4,12 +4,13 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
"io"
"strings"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
)
func TestGzipReader(t *testing.T) {
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedBrotliReaderPool *ReaderPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedDeflateReaderPool *ReaderPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedGzipReaderPool *ReaderPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedZSTDReaderPool *ReaderPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
"github.com/klauspost/compress/zstd"
"io"
"github.com/klauspost/compress/zstd"
)
type ZSTDReader struct {
+4 -3
View File
@@ -4,12 +4,13 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
"io"
"strings"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
)
func TestZSTDReader(t *testing.T) {
+3 -2
View File
@@ -4,11 +4,12 @@ package compressions
import (
"errors"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
"io"
"net/http"
"runtime"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
)
type ContentEncoding = string
+3 -2
View File
@@ -1,11 +1,12 @@
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cloud .
package compressions_test
import (
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestGenerateCompressLevel(t *testing.T) {
+2 -1
View File
@@ -4,8 +4,9 @@
package compressions
import (
"github.com/andybalholm/brotli"
"io"
"github.com/andybalholm/brotli"
)
type BrotliWriter struct {
+3 -2
View File
@@ -4,11 +4,12 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
stringutil "github.com/iwind/TeaGo/utils/string"
"strings"
"testing"
"time"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
stringutil "github.com/iwind/TeaGo/utils/string"
)
func TestBrotliWriter_LargeFile(t *testing.T) {
+2 -1
View File
@@ -4,9 +4,10 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"strings"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
)
func BenchmarkDeflateWriter_Write(b *testing.B) {
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
"github.com/klauspost/compress/gzip"
"io"
"github.com/klauspost/compress/gzip"
)
type GzipWriter struct {
+2 -1
View File
@@ -4,8 +4,9 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
)
func BenchmarkGzipWriter_Write(b *testing.B) {
+3 -2
View File
@@ -3,10 +3,11 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
"io"
"time"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
)
const maxWriterHits = 1 << 20
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedBrotliWriterPool *WriterPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedDeflateWriterPool *WriterPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedGzipWriterPool *WriterPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"io"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
)
var sharedZSTDWriterPool *WriterPool
+2 -1
View File
@@ -3,8 +3,9 @@
package compressions
import (
"github.com/klauspost/compress/zstd"
"io"
"github.com/klauspost/compress/zstd"
)
type ZSTDWriter struct {
+2 -1
View File
@@ -4,9 +4,10 @@ package compressions_test
import (
"bytes"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
"strings"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/compressions"
)
func TestNewZSTDWriter_Level0(t *testing.T) {