handlers

package
v0.0.0-...-1ed3a2a Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 8 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 request headers and falls back to r.RemoteAddr when necessary.

func GetSourceIPFromHeaders

func GetSourceIPFromHeaders(r *http.Request) string

GetSourceIPFromHeaders retrieves the IP from the X-Forwarded-For, X-Real-IP and RFC7239 Forwarded headers (in that order)

func GetSourceScheme

func GetSourceScheme(r *http.Request) string

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

Types

type Forwarder

type Forwarder struct {
	RoundTripper http.RoundTripper
	PassHost     bool
	Logger       func(error)
	ErrorHandler func(http.ResponseWriter, *http.Request, error)
	// 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