feat(backend): use github.com/klauspost/compress for gzip

This commit is contained in:
Łukasz Mierzwa
2022-07-07 13:35:25 +01:00
committed by Łukasz Mierzwa
parent 98ea0dc5fe
commit fcc9cfc38c
7 changed files with 8 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
package main
import (
"compress/flate"
"context"
"errors"
"fmt"
@@ -30,6 +29,7 @@ import (
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
lru "github.com/hashicorp/golang-lru"
"github.com/klauspost/compress/flate"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"

View File

@@ -2,7 +2,6 @@ package main
import (
"bytes"
"compress/gzip"
"encoding/base64"
"encoding/json"
"fmt"
@@ -15,6 +14,7 @@ import (
"github.com/cnf/structhash"
"github.com/fvbommel/sortorder"
"github.com/klauspost/compress/gzip"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"

1
go.mod
View File

@@ -17,6 +17,7 @@ require (
github.com/google/go-cmp v0.5.8
github.com/hashicorp/golang-lru v0.5.4
github.com/jarcoal/httpmock v1.2.0
github.com/klauspost/compress v1.15.7
github.com/knadh/koanf v1.4.2
github.com/mitchellh/mapstructure v1.5.0
github.com/pmezard/go-difflib v1.0.0

2
go.sum
View File

@@ -277,6 +277,8 @@ github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaR
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.15.7 h1:7cgTQxJCU/vy+oP/E3B9RGbQTgbiVzIJWIKOLoAsPok=
github.com/klauspost/compress v1.15.7/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/knadh/koanf v1.4.2 h1:2itp+cdC6miId4pO4Jw7c/3eiYD26Z/Sz3ATJMwHxIs=
github.com/knadh/koanf v1.4.2/go.mod h1:4NCo0q4pmU398vF9vq2jStF9MWQZ8JEDcDMHlDCr4h0=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=

View File

@@ -56,6 +56,6 @@ func NewHTTPTransport(caPath, certPath, keyPath string, insecureSkipVerify bool)
}
}
transport := http.Transport{TLSClientConfig: tlsConfig}
transport := http.Transport{TLSClientConfig: tlsConfig, DisableCompression: true}
return &transport, nil
}

View File

@@ -1,11 +1,11 @@
package uri
import (
"compress/gzip"
"fmt"
"io"
"net/http"
"github.com/klauspost/compress/gzip"
"github.com/rs/zerolog/log"
)

View File

@@ -2,7 +2,6 @@ package uri_test
import (
"bytes"
"compress/gzip"
"crypto/tls"
"crypto/x509"
"errors"
@@ -12,6 +11,7 @@ import (
"testing"
"time"
"github.com/klauspost/compress/gzip"
"github.com/rs/zerolog"
"github.com/prymitive/karma/internal/uri"