handlers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: AGPL-3.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