Documentation ¶
Index ¶
- type LimitBandwidthType
- func (hdlr *LimitBandwidthType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *LimitBandwidthType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *LimitBandwidthType) RedisGet(key string) (val string, err error)
- func (hdlr *LimitBandwidthType) RedisSetFreqMili(key string, ttlMilisec int, val string) (err error)
- func (hdlr *LimitBandwidthType) RedisSetIncrementNPerSecond(key string) (nSoFar int, err error)
- func (hdlr *LimitBandwidthType) ServeHTTP(www http.ResponseWriter, req *http.Request)
- type PerAuthCfg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LimitBandwidthType ¶
type LimitBandwidthType struct { Next http.Handler // Paths []string // FreqMiliKey string // QT template for lookup of Redis key HttpErrorCode int // FreqMili int // sequence for request in milliseconds PerAuthCfgKey string // QT template for using a non-default timeout, can be set to "inf" - for no limit on time. NPerSecKey string // QT template for the N Per Second NPerSecond int // if 0 then will not apply AuthTokenName string // The name of the "auth_token" could be "$user_id$" for logged in users LineNo int // // contains filtered or unexported fields }
func NewLimitBandwidthServer ¶
func NewLimitBandwidthServer(n http.Handler, p []string, pFreqMili, pNPerSecond int) *LimitBandwidthType
func (*LimitBandwidthType) InitializeWithConfigData ¶
func (hdlr *LimitBandwidthType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*LimitBandwidthType) PreValidate ¶
func (hdlr *LimitBandwidthType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*LimitBandwidthType) RedisGet ¶
func (hdlr *LimitBandwidthType) RedisGet(key string) (val string, err error)
func (*LimitBandwidthType) RedisSetFreqMili ¶
func (hdlr *LimitBandwidthType) RedisSetFreqMili(key string, ttlMilisec int, val string) (err error)
func (*LimitBandwidthType) RedisSetIncrementNPerSecond ¶
func (hdlr *LimitBandwidthType) RedisSetIncrementNPerSecond(key string) (nSoFar int, err error)
func (*LimitBandwidthType) ServeHTTP ¶
func (hdlr *LimitBandwidthType) ServeHTTP(www http.ResponseWriter, req *http.Request)
type PerAuthCfg ¶
PerAuthCfgKey is JSON data
{ "FreqMili": -1, // unlimited { "FreqMili": 0, // turned off { "FreqMili": 1500, // 1.5 seconds between requests { "FreqMili":0,"NPerSecond": -1 // unlimited { "FreqMili":0 "NPerSecond": 0 // Check not applicable { "FreqMili":0 "NPerSecond": 200 // Allow up to 200 request per second.
Click to show internal directories.
Click to hide internal directories.