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.

Index

Package Files

userip.go

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.

Package userip imports 4 packages (graph) and is imported by 2 packages. Updated 3 days ago. Refresh now. Tools for package owners.