compress

package
v1.2.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AnyName     = "*"
	DefaultName = "compress"
	GzipName    = "gzip"
	DeflateName = "deflate"
	BrotliName  = "br"
)

Variables

This section is empty.

Functions

func DecodeResponse added in v1.2.21

func DecodeResponse(header transports.Header, body []byte) (p []byte, err error)

Types

type BrotliCompressor

type BrotliCompressor struct {
	// contains filtered or unexported fields
}

func (*BrotliCompressor) Compress

func (b *BrotliCompressor) Compress(p []byte) (out []byte, err error)

func (*BrotliCompressor) Name

func (b *BrotliCompressor) Name() string

type Compressor

type Compressor interface {
	Name() string
	Compress(p []byte) (out []byte, err error)
}

type Config

type Config struct {
	Enable       bool   `json:"enable"`
	Default      string `json:"default"`
	GzipLevel    int    `json:"gzipLevel"`
	DeflateLevel int    `json:"deflateLevel"`
	BrotliLevel  int    `json:"brotliLevel"`
}

type DeflateCompressor

type DeflateCompressor struct {
	// contains filtered or unexported fields
}

func (*DeflateCompressor) Compress

func (d *DeflateCompressor) Compress(p []byte) (out []byte, err error)

func (*DeflateCompressor) Name

func (d *DeflateCompressor) Name() string

type GzipCompressor

type GzipCompressor struct {
	// contains filtered or unexported fields
}

func (*GzipCompressor) Compress

func (g *GzipCompressor) Compress(p []byte) (out []byte, err error)

func (*GzipCompressor) Name

func (g *GzipCompressor) Name() string

type Kind

type Kind int
const (
	No Kind = iota
	Any
	Default
	Gzip
	Deflate
	Brotli
)

func (Kind) String

func (kind Kind) String() string

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

func (*Middleware) Close

func (middle *Middleware) Close() (err error)

func (*Middleware) Construct

func (middle *Middleware) Construct(options transports.MiddlewareOptions) error

func (*Middleware) Handler

func (middle *Middleware) Handler(next transports.Handler) transports.Handler

func (*Middleware) Name

func (middle *Middleware) Name() string

type ResponseWriter

type ResponseWriter struct {
	transports.ResponseWriter
	// contains filtered or unexported fields
}

func (*ResponseWriter) Failed

func (w *ResponseWriter) Failed(cause error)

func (*ResponseWriter) Succeed

func (w *ResponseWriter) Succeed(v interface{})

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(body []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL