Help us shape the future of Go! Take the 2026 Go Developer Survey

clientip

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package clientip carries the best-effort client address of a request through the context, so ogen handlers (which never see the *http.Request) can record it as proof, e.g. on a double-opt-in confirmation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) string

FromContext returns the address stored by Middleware, or "" outside a request.

func FromRequest

func FromRequest(r *http.Request) string

FromRequest returns the address our trusted proxy saw, falling back to the connection's remote host when the request did not come through one.

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware stores FromRequest and the User-Agent in the request context for FromContext and UserAgentFromContext.

func UserAgentFromContext

func UserAgentFromContext(ctx context.Context) string

UserAgentFromContext returns the request's User-Agent stored by Middleware, or "" outside a request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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