util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentEncodingFromCompressionType added in v1.1.0

func ContentEncodingFromCompressionType(compressionType CompressionType) string

func DropPort

func DropPort(ipport string) string

DropPort returns an URL without the port part

func NewBrotliEncodingWriter added in v1.1.0

func NewBrotliEncodingWriter(w io.Writer, compressionLevel int) io.Writer

func NewGzipDecodingReader added in v1.1.0

func NewGzipDecodingReader(body io.ReadCloser) (io.ReadCloser, error)

func NewGzipEncodingWriter added in v1.1.0

func NewGzipEncodingWriter(w io.Writer, compressionLevel int) (io.Writer, error)

func RequestIP

func RequestIP(req *http.Request) string

RequestIP parses CF-Connecting-IP, X-Real-Ip and X-Forwarded-For headers to determine the original client IP

func StringInSlice

func StringInSlice(slice []string, s string) bool

StringInSlice looks for a string in a slice

Types

type CompressionType added in v1.1.0

type CompressionType int
const (
	CompressionTypeNone   CompressionType = 0
	CompressionTypeGzip   CompressionType = 1
	CompressionTypeBrotli CompressionType = 2
)

type Recompression added in v1.1.0

type Recompression struct {
	Add    CompressionType
	Remove CompressionType
}

func GetRecompression added in v1.1.0

func GetRecompression(acceptEncoding string, contentEncoding string, contentType string) Recompression

Jump to

Keyboard shortcuts

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