middleware

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentRandomSeed = "ourhttp-user-agent-seed"
)

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(username, password string) decorator.Decorator

BasicAuth is a middleware decorator for basic access authentication with username and password.

func DumpRequest

func DumpRequest(outDir ...string) decorator.Decorator

func DumpResponse

func DumpResponse(outDir ...string) decorator.Decorator

func LogOff

func LogOff()

func LogOn

func LogOn()

func LogSet

func LogSet(l *zap.Logger)

func RetryOnBadProxy

func RetryOnBadProxy(maxTimes uint) decorator.Decorator

RetryOnBadProxy is a middleware decorator to retry with backoff + random for gateway issues.

func RetryOnTimeout

func RetryOnTimeout(maxTimes uint, timeout time.Duration) decorator.Decorator

RetryOnTimeout is a middleware decorator to retry on request timeout.

func TokenAuth

func TokenAuth(token string) decorator.Decorator

TokenAuth is a middleware decorator for basic access authentication with token.

func UserAgent

func UserAgent() decorator.Decorator

UserAgent is a middleware decorator to add random User-Agent in the header. In order to get the consistent user agent for various requests, you may set random seed as a string value in the request context with `middleware.UserAgentRandomSeed` as the key.

func XdailiProxyAuth

func XdailiProxyAuth(order, secret string) decorator.Decorator

XdailiProxyAuth is a middleware decorator for authentication of xdaili.

func ZapVerboseLogger

func ZapVerboseLogger(l *zap.Logger) decorator.Decorator

Types

This section is empty.

Jump to

Keyboard shortcuts

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