ratelimit

package
v0.0.0-...-d8e89f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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

func AttemptRequest(ipAddress string, requestType string, limit float64) error

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

func InsertAttempt(ipAddress string, requestType string, limit float64) error

InsertAttempt will insert a new request attempt into the datastore

func OverLimit

func OverLimit(ipAddress string, requestType string, limit float64) error

OverLimit tests if the ipAddress is over the passed in limit for the given request type

func ResetLimit

func ResetLimit(ipAddress string, requestType string) error

ResetLimit resets the number of requests for a request type and IP address

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL