Versions in this module Expand all Collapse all v1 v1.3.1 Dec 21, 2023 Changes in this version + const MaxLengthAuthorAll + var ErrBadRequest = errors.New("Bad Request") + var ErrInternal = errors.New("Internal Server Error") + var ErrMethodNotAllowed = errors.New("Method Not Allowed") + var ErrNotFound = errors.New("Not Found") + var ErrPayloadTooLarge = errors.New("Payload Too Large") + var ErrUnauthorized = errors.New("Unauthorized") + func GetClientAddr(req *http.Request) net.IP + func GetHost(req *http.Request) string + func GetProtocol(req *http.Request) string + func PasteAddFromForm(req *http.Request, db storage.DB, rateSys *RateLimitSystem, titleMaxLen int, ...) (string, int64, int64, error) + type ErrTooManyRequests struct + RetryAfter int64 + func ErrTooManyRequestsNew(retryAfter int64) *ErrTooManyRequests + func (e *ErrTooManyRequests) Error() string + type RateLimit struct + func NewRateLimit(rateLimitPeriod int, limitCount uint) *RateLimit + func (rateLimit *RateLimit) CheckAndUse(ip net.IP) int64 + type RateLimitSystem struct + func NewRateLimitSystem(per5Min, per15Min, per1Hour uint) *RateLimitSystem + func (rateSys *RateLimitSystem) CheckAndUse(ip net.IP) error