0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00
caddy/middleware/middleware.go

36 lines
1,001 B
Go
Raw Normal View History

2015-01-30 00:14:31 -05:00
// Package middleware provides some types and functions common among middleware.
2015-01-13 14:43:45 -05:00
package middleware
2015-01-30 00:08:40 -05:00
import "net/http"
2015-01-13 14:43:45 -05:00
type (
// Generator represents the outer layer of a middleware that
// parses tokens to configure the middleware instance.
Generator func(Controller) (Middleware, error)
// Middleware is the middle layer which represents the traditional
// idea of middleware: it is passed the next HandlerFunc in the chain
// and returns the inner layer, which is the actual HandlerFunc.
Middleware func(http.HandlerFunc) http.HandlerFunc
// Controller is the type which middleware generators use to access
// tokens and the server and any other information they need to
// configure themselves.
Controller interface {
Next() bool
NextArg() bool
NextLine() bool
2015-01-21 14:09:49 -05:00
NextBlock() bool
Val() string
2015-01-21 19:51:47 -05:00
Args(...*string) bool
RemainingArgs() []string
ArgErr() error
Err(string) error
Startup(func() error)
Root() string
Host() string
Port() string
Context() Path
}
)