net

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoteHost

func RemoteHost(r *http.Request) net.IP

RemoteHost returns the remote address of the client. When the 'X-Forwarded-For' header is set, then it is used instead. This is how most often proxies behave. Wikipedia shows the format https://en.wikipedia.org/wiki/X-Forwarded-For#Format

Example:

X-Forwarded-For: client, proxy1, proxy2

func RemoteHostFromLast added in v0.9.152

func RemoteHostFromLast(r *http.Request) net.IP

RemoteHostFromLast returns the remote address of the client. When the 'X-Forwarded-For' header is set, then it is used instead. This is known to be true for AWS Application LoadBalancer. AWS docs https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html

Example:

X-Forwarded-For: ip-address-1, ip-address-2, client-ip-address

Types

This section is empty.

Jump to

Keyboard shortcuts

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