traefik_block_ua

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

traefik-block-ua

Build Status Go Report Card Latest GitHub release License

traefik-block-ua is a traefik plugin to whitelist requests based on the user agents

Configuration

Static
Local
experimental:
  localPlugins:
    geoblock:
      moduleName: github.com/kucjac/traefik-block-ua
Pilot
pilot:
  token: "xxxxxxxxx"

experimental:
  plugins:
    userAgentBlocker:
      moduleName: github.com/kucjac/traefik-block-ua
      version: v0.1.0
Dynamic
http:
  middlewares:
    userAgentBlocker:
      plugin:
        userAgentBlocker:
          userAgents:
            - "CustomCrawlerName"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(_ context.Context, next http.Handler, cfg *Config, name string) (http.Handler, error)

New creates a new plugin handler.

Types

type Config

type Config struct {
	UserAgents []string
}

Config defines the plugin dynamic configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates a new config.

type Plugin

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

Plugin is the traefik plugin implementation.

func (*Plugin) ServeHTTP

func (p *Plugin) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface.

Jump to

Keyboard shortcuts

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