middleware

package
v0.8.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2015 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CircuitBreakerType = "cbreaker"
	CircuitBreakerID   = "cb1"
)
View Source
const (
	ConnLimitType = "connlimit"
	ConnLimitID   = "cl1"
)
View Source
const (
	RateLimitType = "ratelimit"
	RateLimitID   = "rl1"
)
View Source
const (
	RewriteType = "rewrite"
	RewriteID   = "rw1"
)
View Source
const (
	DefaultPriority = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreaker

type CircuitBreaker struct {
	Condition        string        `json:"Condition"`
	Fallback         string        `json:"Fallback"`
	CheckPeriod      time.Duration `json:"CheckPeriod"`
	FallbackDuration time.Duration `json:"FallbackDuration"`
	RecoveryDuration time.Duration `json:"RecoveryDuration"`
	OnTripped        string        `json:"OnTripped"`
	OnStandby        string        `json:"OnStandby"`
}

CircuitBreaker is a spec for the respective vulcan's middleware that lets vulcan to fallback to some default response and trigger some action when an erroneous condition on a location is met.

func (CircuitBreaker) String

func (cb CircuitBreaker) String() string

type ConnLimit

type ConnLimit struct {
	Variable    string `json:"Variable"`
	Connections int    `json:"Connections"`
}

ConnLimit is a spec for the respective vulcan's middleware that lets to control amount if simultaneous connections to locations.

func (ConnLimit) String

func (cl ConnLimit) String() string

type Middleware

type Middleware struct {
	Type     string         `json:"Type"`
	ID       string         `json:"Id"`
	Priority int            `json:"Priority"`
	Spec     MiddlewareSpec `json:"Middleware"`
}

func NewCircuitBreaker

func NewCircuitBreaker(spec CircuitBreaker) Middleware

func NewConnLimit

func NewConnLimit(spec ConnLimit) Middleware

func NewRateLimit

func NewRateLimit(spec RateLimit) Middleware

func NewRewrite

func NewRewrite(spec Rewrite) Middleware

func (Middleware) String

func (m Middleware) String() string

type MiddlewareSpec

type MiddlewareSpec interface{}

type RateLimit

type RateLimit struct {
	Variable      string `json:"Variable"`
	Requests      int    `json:"Requests"`
	PeriodSeconds int    `json:"PeriodSeconds"`
	Burst         int    `json:"Burst"`
}

RateLimit is a spec for the respective vulcan's middleware that lets to apply request rate limits to locations.

func (RateLimit) String

func (rl RateLimit) String() string

type Rewrite

type Rewrite struct {
	Regexp      string `json:"Regexp"`
	Replacement string `json:"Replacement"`
	RewriteBody bool   `json:"RewriteBody"`
	Redirect    bool   `json:"Redirect"`
}

Rewrite is a spec for the respective vulcan's middleware that enables request/response alteration.

func (Rewrite) String

func (rw Rewrite) String() string

Jump to

Keyboard shortcuts

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