Documentation ¶
Index ¶
- Constants
- Variables
- 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 ¶ added in v1.2.0
Types ¶
type AppendPath ¶
func (*AppendPath) IsCachable ¶ added in v1.2.0
func (a *AppendPath) IsCachable() bool
func (*AppendPath) UpdateMiddelware ¶ added in v1.2.0
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 ¶ added in v1.2.0
type RateLimiter struct { RequestLimit int `json:"request_limit"` WindowDuration WindowDuration `json:"window_duration"` // contains filtered or unexported fields }
func (*RateLimiter) IsCachable ¶ added in v1.2.0
func (r *RateLimiter) IsCachable() bool
func (*RateLimiter) Process ¶ added in v1.2.0
func (r *RateLimiter) Process(next http.Handler) http.Handler
func (*RateLimiter) UpdateMiddelware ¶ added in v1.2.0
func (r *RateLimiter) UpdateMiddelware(newImpl Middleware) Middleware
type RegisterFunc ¶
type RegisterFunc func(map[string]BuilderFunc) error
func RegisterAppendPath ¶
func RegisterAppendPath() RegisterFunc
func RegisterRateLimiter ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (p *ReplacePath) IsCachable() bool
func (*ReplacePath) UpdateMiddelware ¶ added in v1.2.0
func (p *ReplacePath) UpdateMiddelware(newImpl Middleware) Middleware
type WindowDuration ¶ added in v1.2.0
func (WindowDuration) MarshalJSON ¶ added in v1.2.0
func (d WindowDuration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for WindowDuration.
func (*WindowDuration) UnmarshalJSON ¶ added in v1.2.0
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.