gzip

package module
v0.0.0-...-dba2c48 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 4 Imported by: 0

README

Gzip

License

Installation

go get github.com/gowool/middleware/gzip

License

Distributed under MIT License, please see license file within the code for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(cfg *Config) wool.Middleware

Types

type Config

type Config struct {
	Level int `mapstructure:"level"`

	// MinSize is the minimum size until we enable gzip compression.
	// 1500 bytes is the MTU size for the internet since that is the largest size allowed at the network layer.
	// If you take a file that is 1300 bytes and compress it to 800 bytes, it’s still transmitted in that same 1500 byte packet regardless, so you’ve gained nothing.
	// That being the case, you should restrict the gzip compression to files with a size greater than a single packet, 1400 bytes (1.4KB) is a safe value.
	MinSize int `mapstructure:"min_size"`
}

func (*Config) Init

func (cfg *Config) Init()

type Gzip

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

func New

func New(cfg *Config) *Gzip

func (*Gzip) Middleware

func (m *Gzip) Middleware(next wool.Handler) wool.Handler

Jump to

Keyboard shortcuts

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