blog: golang.org/x/blog/content/context/userip Index | Files

package userip

import "golang.org/x/blog/content/context/userip"

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

Package Files

userip.go

func FromContext Uses

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

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

func FromRequest Uses

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

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

func NewContext Uses

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

NewContext returns a new Context carrying userIP.

Package userip imports 4 packages (graph) and is imported by 2 packages. Updated 2017-11-19. Refresh now. Tools for package owners.