userip

package
v0.0.0-...-31a27a5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package userip provides functions for extracting a user IP address from a request and associating it with a Context.

This package is an example to accompany https://blog.golang.org/context. It is not intended for use by others.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (net.IP, bool)

FromContext extracts the user IP address from ctx, if present.

func FromRequest

func FromRequest(req *http.Request) (net.IP, error)

FromRequest extracts the user IP address from req, if present.

func NewContext

func NewContext(ctx context.Context, userIP net.IP) context.Context

NewContext returns a new Context carrying userIP.

Types

This section is empty.

Jump to

Keyboard shortcuts

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