Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodySizeGas ¶
func BodySizeGas(bsgc BodySizeGasConfig) air.Gas
BodySizeGas returns an `air.Gas` that is used to limit ervery request's body size based on the bsgc. It prevents clients from accidentally or maliciously sending a large request and wasting server resources.
func RateGas ¶ added in v0.11.2
func RateGas(rgc RateGasConfig) air.Gas
RateGas returns an `air.Gas` that is used to limit request's rate based on the rgc.
Types ¶
type BodySizeGasConfig ¶
type BodySizeGasConfig struct { MaxBytes int64 ErrRequestEntityTooLarge error Skippable func(*air.Request, *air.Response) bool }
BodySizeGasConfig is a set of configurations for the `BodySizeGas`.
type RateGasConfig ¶ added in v0.11.2
type RateGasConfig struct { MaxRequests int64 ResetInterval time.Duration UseClientAddress bool ErrTooManyRequests error Skippable func(*air.Request, *air.Response) bool // contains filtered or unexported fields }
RateGasConfig is a set of configurations for the `RateGas`.
Click to show internal directories.
Click to hide internal directories.