ResponseTimeBalancer

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Configuration examples

Local file provider

Static config
experimental:
  localPlugins:
    rtb_static:
      moduleName: "github.com/ArtemUgrimov/ResponseTimeBalancer"

Dynamic config
http:
  middlewares:
    rtb:
      plugin:
        rtb_static:
          responseTimeHeaderName: "Tm"
          responseTimeLimitMs: "80"
          cookieSetHeaderValue: "invalidated"

          logStartup: true
          logSetCookie: true
          logLimitNotReached: true
          logHeaderNotFound: true

K8s

Chart config
experimental:
  plugins:
    rtb_static:
        moduleName: "github.com/ArtemUgrimov/ResponseTimeBalancer"
        version: "v1.0.0"
Middleware
apiVersion: "traefik.io/v1alpha1"
kind: "Middleware"
metadata:
  name: "rtb"
spec:
  plugin:
    rtb_static:
      responseTimeHeaderName: "Tm"
      responseTimeLimitMs: "80"
      cookieSetHeaderValue: "invalidated"

      logStartup: true
      logSetCookie: true
      logLimitNotReached: true
      logHeaderNotFound: true

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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

New created a new Demo plugin.

Types

type Config

type Config struct {
	ResponseTimeHeaderName string `json:"responseTimeHeaderName"`
	ResponseTimeLimitMs    string `json:"responseTimeLimitMs"`
	CookieSetHeaderValue   string `json:"cookieSetHeaderValue"`

	LogStartup         bool `json:"logStartup"`
	LogSetCookie       bool `json:"logSetCookie"`
	LogLimitNotReached bool `json:"logLimitNotReached"`
	LogHeaderNotFound  bool `json:"logHeaderNotFound"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

type Plugin added in v1.0.9

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

func (*Plugin) ServeHTTP added in v1.0.9

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

Jump to

Keyboard shortcuts

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