h2_compressor_brotli.go 380 B

12345678910111213141516171819202122
  1. // +build cgo
  2. package h2mux
  3. import (
  4. "io"
  5. "github.com/cloudflare/brotli-go"
  6. )
  7. func CompressionIsSupported() bool {
  8. return true
  9. }
  10. func newDecompressor(src io.Reader) *brotli.Reader {
  11. return brotli.NewReader(src)
  12. }
  13. func newCompressor(dst io.Writer, quality, lgwin int) *brotli.Writer {
  14. return brotli.NewWriter(dst, brotli.WriterOptions{Quality: quality, LGWin: lgwin})
  15. }