httpserv

package
v0.0.0-...-2da2eef Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoOptions = errors.New("no options provided")
)

Functions

func AccessLog

func AccessLog(next http.Handler) http.Handler

AccessLog - log client requests

func Cache

func Cache(store cache.Cache) func(next http.Handler) http.Handler

Cache - cache requests

func EnrichCorrelationID

func EnrichCorrelationID(gen *corridgen.Generator) func(next http.Handler) http.Handler

EnrichCorrelationID - add unique correlation id to header

func GetClientIP

func GetClientIP(r *http.Request) string

func MiddlewareChain

func MiddlewareChain(handler http.Handler, midllewares ...Middleware) http.Handler

MiddlewareChain - chain multiple middlewares

func NotCachable

func NotCachable(r *http.Request) bool

NotCachable - sift non-cachable requests

func СonstructKey

func СonstructKey(uri string) uint64

СonstructKey - make hash from uri

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware - http middleware

type Options

type Options struct {
	Port             string
	Targets          []string
	StaleTimeout     int
	MachineID        int
	UseCache         int
	CacheExpire      int
	MaxCacheSize     int
	MaxCacheItemSize int
}

Options - fileserver parameters

func (*Options) String

func (opts *Options) String() string

String - simple representation

type Server

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

Server - main control struct

func New

func New(options *Options) (*Server, error)

New - service constructor

func (*Server) Run

func (srv *Server) Run() error

Run - start schooner

Jump to

Keyboard shortcuts

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