realip

package
v7.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL(req *http.Request) *url.URL

BaseURL returns an estimate of the URL that the client used to access the service. Headers like X-Forwarded-Host are taken into account if the connection is from a trusted proxy.

func Middleware

func Middleware(trustedProxies []string) (func(http.Handler) http.Handler, error)

Middleware processes headers set by a trusted reverse proxy in front of the server. Client IPs are checked against the provided list of networks, and the "real" IP passed by the trusted proxy replaces req.RemoteAddr.

func PeerCertificates

func PeerCertificates(req *http.Request) ([]*x509.Certificate, error)

PeerCertificates returns the unverified set of certificates provided by the client, using the Ssl-Client-Cert header if the connection is from a trusted proxy.

Types

This section is empty.

Jump to

Keyboard shortcuts

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