handlers

package
v0.0.0-...-b5280ba Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSourceIP

func GetSourceIP(r *http.Request) string

GetSourceIP retrieves the IP from the X-Forwarded-For, X-Real-IP and RFC7239 Forwarded headers (in that order), falls back to r.RemoteAddr when all else fails.

func GetSourceScheme

func GetSourceScheme(r *http.Request) string

GetSourceScheme retrieves the scheme from the X-Forwarded-Proto and RFC7239 Forwarded headers (in that order).

func TraceReqHandlerFunc

func TraceReqHandlerFunc(f http.HandlerFunc, output io.Writer, logBody bool) http.HandlerFunc

TraceReqHandlerFunc logs request/response headers and body.

Types

type Forwarder

type Forwarder struct {
	RoundTripper http.RoundTripper
	PassHost     bool
	// contains filtered or unexported fields
}

Forwarder forwards all incoming HTTP requests to configured transport.

func NewForwarder

func NewForwarder(f *Forwarder) *Forwarder

NewForwarder creates an instance of Forwarder based on the provided list of configuration options

func (*Forwarder) ServeHTTP

func (f *Forwarder) ServeHTTP(w http.ResponseWriter, inReq *http.Request)

ServeHTTP forwards HTTP traffic using the configured transport

Jump to

Keyboard shortcuts

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