Documentation
¶
Index ¶
- func HeaderFromStringSlice(s []string) (http.Header, error)
- type Middleware
- func BasicAuthMiddleware(unauthenticated http.HandlerFunc, username, password string) (Middleware, string, error)
- func BlockPrefetch(userAgentKeys ...string) Middleware
- func BotsMiddleware(block bool) Middleware
- func LimitReaderMiddleware(limit int64) Middleware
- func MiddlewareShim(mw func(http.Handler) http.Handler) Middleware
- type ResponseWriter
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Middleware ¶
type Middleware func(http.HandlerFunc) http.HandlerFunc
func BasicAuthMiddleware ¶
func BasicAuthMiddleware(unauthenticated http.HandlerFunc, username, password string) (Middleware, string, error)
func BlockPrefetch ¶
func BlockPrefetch(userAgentKeys ...string) Middleware
BlockPrefetch blocks prefetching of the page by reloading the page with a short-lived cookie that's only set if the page is visible. This is to prevent browsers and bots from prefetching. Some have recently started not marking the request as a prefetch, so this is a last resort.
func BotsMiddleware ¶
func BotsMiddleware(block bool) Middleware
func LimitReaderMiddleware ¶
func LimitReaderMiddleware(limit int64) Middleware
func MiddlewareShim ¶
func MiddlewareShim(mw func(http.Handler) http.Handler) Middleware
func (Middleware) Chain ¶
func (mw Middleware) Chain(m Middleware) Middleware
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter IgnoreOutcome() }
type Server ¶
type Server struct { PreSuccessHandler http.HandlerFunc PostSuccessHandler http.HandlerFunc TLSCert, TLSKey string Timeout time.Duration ExitOnFail bool // contains filtered or unexported fields }
func NewServer ¶
func NewServer(ctx context.Context, preSucc, postSucc http.HandlerFunc, mw ...Middleware) *Server
Click to show internal directories.
Click to hide internal directories.