Documentation ¶
Index ¶
- Variables
- func NewConcurrentLimit(keys []string, ttl time.Duration, prefix string) elton.Handler
- func NewConcurrentLimitWithDone(keys []string, ttl time.Duration, prefix string) elton.Handler
- func NewEntry(entryFn EntryFunc, exitFn ExitFunc) elton.Handler
- func NewError() elton.Handler
- func NewErrorLimit(maxCount int64, ttl time.Duration, fn KeyGenerator) elton.Handler
- func NewIPBlocker(fn IPBlockFunc) elton.Handler
- func NewIPLimit(maxCount int64, ttl time.Duration, prefix string) elton.Handler
- func NewInterceptor() elton.Handler
- func NewMethodNotAllowedHandler() http.HandlerFunc
- func NewNoCacheWithCondition(key, value string) elton.Handler
- func NewNotFoundHandler() http.HandlerFunc
- func NewPrefixHandler(prefixes []string) elton.PreHandler
- func NewRouterMocker(fn GetConfigFunc) elton.Handler
- func NewStats(processingCount *atomic.Int32) elton.Handler
- func ValidateCaptcha(magicalCaptcha string) elton.Handler
- func WaitFor(d time.Duration, onlyErrOccurreds ...bool) elton.Handler
- type EntryFunc
- type ExitFunc
- type GetConfigFunc
- type IPBlockFunc
- type KeyGenerator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIPNotAllow = &hes.Error{ StatusCode: http.StatusBadRequest, Message: "request is forbidden", Category: "IB", } )
Functions ¶
func NewConcurrentLimit ¶
NewConcurrentLimit 创建并发限制的中间件
func NewConcurrentLimitWithDone ¶
NewConcurrentLimitWithDone 创建并发限制中间件,完成时则执行done清除
func NewErrorLimit ¶
NewErrorLimit 创建出错限制中间件
func NewIPBlocker ¶
func NewIPBlocker(fn IPBlockFunc) elton.Handler
NewIPBlocker create a new block ip middleware
func NewIPLimit ¶
NewIPLimit 创建IP限制中间件
func NewInterceptor ¶
func NewMethodNotAllowedHandler ¶
func NewMethodNotAllowedHandler() http.HandlerFunc
NewMethodNotAllowedHandler 创建method not allowed的处理函数
func NewNoCacheWithCondition ¶
NewNoCacheWithCondition 创建no cache的中间件,此中间件根据设置的key value来判断是否设置为no cache
func NewNotFoundHandler ¶
func NewNotFoundHandler() http.HandlerFunc
NewNotFoundHandler 创建404 not found的处理函数
func NewPrefixHandler ¶
func NewPrefixHandler(prefixes []string) elton.PreHandler
NewPrefixHandler create a new request url prefix handler
func NewRouterMocker ¶
func NewRouterMocker(fn GetConfigFunc) elton.Handler
NewRouterMocker create a router mocker
func ValidateCaptcha ¶
ValidateCaptcha 图形难码校验
Types ¶
type GetConfigFunc ¶
type GetConfigFunc func(method, route string) *routermock.RouterMock
type IPBlockFunc ¶
Click to show internal directories.
Click to hide internal directories.