Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compressor ¶
type DeflateCompressor ¶
type DeflateCompressor struct {
Level int
}
func NewDeflateCompressor ¶
func NewDeflateCompressor(level int) *DeflateCompressor
func (*DeflateCompressor) AcceptEncoding ¶
func (c *DeflateCompressor) AcceptEncoding() string
func (*DeflateCompressor) ContentEncoding ¶
func (c *DeflateCompressor) ContentEncoding() string
func (*DeflateCompressor) NewReader ¶
func (c *DeflateCompressor) NewReader(r io.Reader) (io.ReadCloser, error)
func (*DeflateCompressor) NewWriter ¶
func (c *DeflateCompressor) NewWriter(w io.Writer) (io.WriteCloser, error)
type GzipCompressor ¶
type GzipCompressor struct{}
func NewGzipCompressor ¶
func NewGzipCompressor() *GzipCompressor
func (*GzipCompressor) AcceptEncoding ¶
func (c *GzipCompressor) AcceptEncoding() string
func (*GzipCompressor) ContentEncoding ¶
func (c *GzipCompressor) ContentEncoding() string
func (*GzipCompressor) NewReader ¶
func (c *GzipCompressor) NewReader(r io.Reader) (io.ReadCloser, error)
func (*GzipCompressor) NewWriter ¶
func (c *GzipCompressor) NewWriter(w io.Writer) (io.WriteCloser, error)
type Handler ¶
type Handler struct { Compressors map[string]Compressor Decompressors map[string]RequestDecompressor Compress func(string, int) bool }
func NewHandler ¶
func NewHandler(compressors ...Compressor) *Handler
func (*Handler) Process ¶
func (h *Handler) Process(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type RequestDecompressor ¶
type RequestDecompressor interface { Compressor Decompress() bool }
type SnappyCompressor ¶
type SnappyCompressor struct{}
func NewSnappyCompressor ¶
func NewSnappyCompressor() *SnappyCompressor
func (*SnappyCompressor) AcceptEncoding ¶
func (c *SnappyCompressor) AcceptEncoding() string
func (*SnappyCompressor) ContentEncoding ¶
func (c *SnappyCompressor) ContentEncoding() string
func (*SnappyCompressor) Decompress ¶
func (c *SnappyCompressor) Decompress() bool
func (*SnappyCompressor) NewReader ¶
func (c *SnappyCompressor) NewReader(r io.Reader) (io.ReadCloser, error)
func (*SnappyCompressor) NewWriter ¶
func (c *SnappyCompressor) NewWriter(w io.Writer) (io.WriteCloser, error)
Click to show internal directories.
Click to hide internal directories.