api

package
v0.0.0-...-92daeee Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Router    *http.ServeMux
	RedisPool *redis.Pool
}

API defines server context

func (*API) Initialize

func (api *API) Initialize()

Initialize function initializes API

type IPExtractor

type IPExtractor struct {
	// contains filtered or unexported fields
}

IPExtractor provides ability to extract clients ip address from the http.Request

func NewIPExtractorT

func NewIPExtractorT() IPExtractor

NewIPExtractorT instantiates new extractor

func (*IPExtractor) Extract

func (extractor *IPExtractor) Extract(r *http.Request) (string, error)

Extract real ipaddress form http.Request's "X-Forwarded-For", "X-Real-Ip" headers Falls back to the http.Request's RemoteAddr in case not being behind reverse proxy

Jump to

Keyboard shortcuts

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