middleware

package
v0.0.0-...-1bc63cf Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(f http.HandlerFunc, middlewares ...Middleware) http.HandlerFunc

Chain applies middlewares to a http.HandlerFunc

func CreateConfigFile

func CreateConfigFile(w http.ResponseWriter, r *http.Request)

CreateConfigFile creates the actual config file based on the input from the user.

func NeuterAndLog

func NeuterAndLog(next http.Handler) http.Handler

NeuterAndLog is used for static files and returns a not found if the request ends in a '/' (meaning they want to look at the directory and not view a file). Also logs the request.

func NewConfigPage

func NewConfigPage(w http.ResponseWriter, r *http.Request)

NewConfigPage returns the new config html page

func WriteAccessLog

func WriteAccessLog(r *http.Request)

WriteAccessLog creates the access log string and writes it to file.

Types

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

Middleware declares middlware as alias of HandlerFunc

func AdminPage

func AdminPage() Middleware

AdminPage checks if the user is an admin. If the user is, it grants access otherwise returns a not found.

func ConfigFileExists

func ConfigFileExists() Middleware

ConfigFileExists is a middleware that checks if the config file exists. If it doesn't, we display the create config file page.

func Logging

func Logging() Middleware

Logging middleware logs the request.

Jump to

Keyboard shortcuts

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