Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface {
CanPass(*http.Request, net.IP) (bool, error)
TallyFreebie(*http.Request, net.IP) (bool, error)
}
DB is the main interface of the package freebie. It represents a store that keeps track of how many free requests a certain IP address can make to a certain resource.
func NewMemIPMaskStore ¶
NewMemIPMaskStore creates a new in-memory freebie store that masks IP addresses to keep track of free requests. IPv4 addresses are masked to /24 and IPv6 addresses to /48. This reduces risk of abuse by users that have a whole range of IPs at their disposal.
Click to show internal directories.
Click to hide internal directories.