Documentation ¶
Index ¶
- Constants
- Variables
- func Chain(next http.Handler, rules ...Middleware) http.Handler
- func NewAppendPath(begin, end string) struct{ ... }
- func NewRateLimiter(requestLimit int, windowDuration time.Duration) struct{ ... }
- func NewReplacePath(search string, replace string, times int) struct{ ... }
- type AppendPath
- type BuilderFunc
- type Middleware
- type RateLimiter
- type RegisterFunc
- type ReplacePath
- type WindowDuration
Constants ¶
View Source
const AppendPathName = "AppendPath"
View Source
const ReplacePathName = "ReplacePath"
Variables ¶
View Source
var Empty = []Middleware{}
Functions ¶
func NewAppendPath ¶
func NewRateLimiter ¶
Types ¶
type AppendPath ¶
func (*AppendPath) IsCachable ¶
func (a *AppendPath) IsCachable() bool
func (*AppendPath) UpdateMiddelware ¶
func (a *AppendPath) UpdateMiddelware(newImpl Middleware) Middleware
type BuilderFunc ¶
type BuilderFunc func(raw json.RawMessage) (Middleware, error)
type Middleware ¶
type Middleware interface { Process(next http.Handler) http.Handler IsCachable() bool UpdateMiddelware(newImpl Middleware) Middleware }
type RateLimiter ¶
type RateLimiter struct { RequestLimit int `json:"request_limit"` WindowDuration WindowDuration `json:"window_duration"` // contains filtered or unexported fields }
func (*RateLimiter) IsCachable ¶
func (r *RateLimiter) IsCachable() bool
func (*RateLimiter) UpdateMiddelware ¶
func (r *RateLimiter) UpdateMiddelware(newImpl Middleware) Middleware
type RegisterFunc ¶
type RegisterFunc func(map[string]BuilderFunc) error
func RegisterAppendPath ¶
func RegisterAppendPath() RegisterFunc
func RegisterRateLimiter ¶
func RegisterRateLimiter() RegisterFunc
func RegisterReplacePath ¶
func RegisterReplacePath() RegisterFunc
type ReplacePath ¶
type ReplacePath struct { Search string `json:"search"` Replace string `json:"replace"` Times int `json:"times"` }
func (*ReplacePath) IsCachable ¶
func (p *ReplacePath) IsCachable() bool
func (*ReplacePath) UpdateMiddelware ¶
func (p *ReplacePath) UpdateMiddelware(newImpl Middleware) Middleware
type WindowDuration ¶
func (WindowDuration) MarshalJSON ¶
func (d WindowDuration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for WindowDuration.
func (*WindowDuration) UnmarshalJSON ¶
func (d *WindowDuration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for WindowDuration.
Click to show internal directories.
Click to hide internal directories.