uarestriction

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.9.0

func Init() error

Init registers the ua_restriction middleware.

Types

type Options

type Options struct {
	RejectedHTTPContentType  string   `mapstructure:"rejected_http_content_type"`
	RejectedHTTPResponseBody string   `mapstructure:"rejected_http_response_body"`
	Allow                    []string `mapstructure:"allow"`
	Deny                     []string `mapstructure:"deny"`
	RejectedHTTPStatusCode   int      `mapstructure:"rejected_http_status_code"`
	BypassMissing            bool     `mapstructure:"bypass_missing"`
}

Options defines the configuration for the User-Agent restriction middleware.

type UARestriction

type UARestriction struct {
	// contains filtered or unexported fields
}

UARestriction is a middleware that allows or denies requests based on the User-Agent header.

func NewMiddleware

func NewMiddleware(options Options) (*UARestriction, error)

NewMiddleware creates a new UARestriction instance.

func (*UARestriction) ServeHTTP

func (m *UARestriction) ServeHTTP(ctx context.Context, c *app.RequestContext)

Jump to

Keyboard shortcuts

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