Skip to content

Commit

Permalink
feat(backend): use github.com/klauspost/compress for gzip
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Jul 7, 2022
1 parent 98ea0dc commit fcc9cfc
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/karma/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"compress/flate"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmd/karma/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bytes"
"compress/gzip"
"encoding/base64"
"encoding/json"
"fmt"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion internal/alertmanager/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion internal/uri/http.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package uri

import (
"compress/gzip"
"fmt"
"io"
"net/http"

"github.com/klauspost/compress/gzip"
"github.com/rs/zerolog/log"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/uri/uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package uri_test

import (
"bytes"
"compress/gzip"
"crypto/tls"
"crypto/x509"
"errors"
Expand All @@ -12,6 +11,7 @@ import (
"testing"
"time"

"github.com/klauspost/compress/gzip"
"github.com/rs/zerolog"

"github.com/prymitive/karma/internal/uri"
Expand Down

0 comments on commit fcc9cfc

Please sign in to comment.