Documentation
¶
Index ¶
- Constants
- Variables
- func AttemptRequest(ipAddress string, requestType string, limit float64) error
- func InsertAttempt(ipAddress string, requestType string, limit float64) error
- func OverLimit(ipAddress string, requestType string, limit float64) error
- func ResetLimit(ipAddress string, requestType string) error
Constants ¶
View Source
const DS = "core" + string(os.PathSeparator) + "ratelimit.ds"
DS is the path to the ratelimit core ds file
Variables ¶
View Source
var ErrExceededLimit = errors.New("Maximum request limit has been reached. Please try again later.")
FailExceedLimit is the type of error thrown when a rate limit has been reached
Functions ¶
func AttemptRequest ¶
AttemptRequest logs an an attempt request of the passed in type for the passed in IP address Will return ErrExceededLimit if the passed in limit per minute is reached It is a combination of InsertAttempt and OverLimit
func InsertAttempt ¶
InsertAttempt will insert a new request attempt into the datastore
func OverLimit ¶
OverLimit tests if the ipAddress is over the passed in limit for the given request type
func ResetLimit ¶
ResetLimit resets the number of requests for a request type and IP address
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.