restrictprefix

package module
v0.0.0-...-4d11229 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

Example caddy middleware module

An example middleware that rejects a url file that contains a . prefix.

Example has been taken from chapter 10 of the book: Network programming with Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RestrictPrefix

type RestrictPrefix struct {
	Prefix string `json:"prefix,omitempty"`
	// contains filtered or unexported fields
}

RestrictPrefix is middleware that restricts requests where any portion of the URI matches a given prefix.

func (RestrictPrefix) CaddyModule

func (RestrictPrefix) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*RestrictPrefix) Provision

func (p *RestrictPrefix) Provision(ctx caddy.Context) error

Provision a Zap logger to RestrictPrefix.

func (RestrictPrefix) ServeHTTP

ServeHTTP implements the caddyhttp.MiddlewareHandler interface.

func (*RestrictPrefix) Validate

func (p *RestrictPrefix) Validate() error

Validate the prefix from the module's configuration, setting the default prefix "." if necessary.

Jump to

Keyboard shortcuts

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