blog: Index | Files

package userip

import ""

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 It is not intended for use by others.


Package Files


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.