requestdecorator

package
v2.0.0-alpha5+incompat... Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCNAMEFlatten

func GetCNAMEFlatten(ctx context.Context) string

GetCNAMEFlatten return the flat name if it is present in the context.

func GetCanonizedHost

func GetCanonizedHost(ctx context.Context) string

GetCanonizedHost retrieves the canonized host from the given context (previously stored in the request context by the middleware).

func WrapHandler

func WrapHandler(handler *RequestDecorator) alice.Constructor

WrapHandler Wraps a ServeHTTP with next to an alice.Constructor.

Types

type RequestDecorator

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

RequestDecorator is the struct for the middleware that adds the CanonicalDomain of the request Host into a context for later use.

func New

func New(hostResolverConfig *types.HostResolverConfig) *RequestDecorator

New creates a new request host middleware.

func (*RequestDecorator) ServeHTTP

func (r *RequestDecorator) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc)

type Resolver

type Resolver struct {
	CnameFlattening bool
	ResolvConfig    string
	ResolvDepth     int
	// contains filtered or unexported fields
}

Resolver used for host resolver.

func (*Resolver) CNAMEFlatten

func (hr *Resolver) CNAMEFlatten(ctx context.Context, host string) string

CNAMEFlatten check if CNAME record exists, flatten if possible.

Jump to

Keyboard shortcuts

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