server

package
v0.0.0-...-8be75a9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: GPL-3.0 Imports: 8 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 cliet requests

func Cache

func Cache(expiration time.Duration) func(next http.Handler) http.Handler

Cache - caches files

func GetMethodOnly

func GetMethodOnly(next http.Handler) http.Handler

GetMethodOnly - return 405 for all except GET

func MiddlewareChain

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

MiddlewareChain - chain multiple middlewares

func RestrictListing

func RestrictListing(next http.Handler) http.Handler

RestrictListing - prevent directory listing

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware - http middleware

type Options

type Options struct {
	Port    string
	RootDir string
	Prefix  string
}

Options - fileserver parameters

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 fileserver

Jump to

Keyboard shortcuts

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