realip

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: BSD-3-Clause-Clear Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XRealIP       = "X-Real-IP"
	XForwardedFor = "X-Forwarded-For"
	TrueClientIP  = "True-Client-Ip"
)

Variables

This section is empty.

Functions

func ConnectRealIPInterceptorV2 added in v0.30.0

func ConnectRealIPInterceptorV2(trustedProxyCIDRs []string) (connectv2.ServerInterceptor, error)

ConnectRealIPInterceptorV2 is ConnectRealIPUnaryInterceptor for connect-go v2 servers.

func ConnectRealIPUnaryInterceptor

func ConnectRealIPUnaryInterceptor(trustedProxyCIDRs []string) (connect.UnaryInterceptorFunc, error)

ConnectRealIPUnaryInterceptor resolves the client IP from the socket peer and, only when that peer is trusted, X-Forwarded-For.

func ConnectTrustedRequestIPInterceptorV2 added in v0.30.0

func ConnectTrustedRequestIPInterceptorV2(header string) connectv2.ServerInterceptor

ConnectTrustedRequestIPInterceptorV2 is ConnectTrustedRequestIPUnaryInterceptor for connect-go v2 servers. It must not be installed on a public listener.

func ConnectTrustedRequestIPUnaryInterceptor added in v0.27.0

func ConnectTrustedRequestIPUnaryInterceptor(header string) connect.UnaryInterceptorFunc

ConnectTrustedRequestIPUnaryInterceptor accepts a single propagated IP from an in-process transport. It must not be installed on a public listener.

func FromContext

func FromContext(ctx context.Context) net.IP

Types

type ClientIP

type ClientIP struct{}

Jump to

Keyboard shortcuts

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