limitkeys

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

limitkeys

-- import "github.com/Clever/sphinx/limitkeys"

Usage

func NewHeaderLimitKeys
func NewHeaderLimitKeys(config interface{}) ([]LimitKey, error)

NewHeaderLimitKeys creates a slice of headerLimitKeys that keys on the named request header

func NewIPLimitKeys
func NewIPLimitKeys(config interface{}) ([]LimitKey, error)

NewIPLimitKeys creates a slice of ipLimitKeys that returns a key based on request remoteaddr

func NewGlobalLimitKey
func NewGlobalLimitKey(config interface{}) ([]LimitKey, error)

NewGlobalLimitKey creates a slice of globalLimitKey that always returns the same key

type EmptyKeyError
type EmptyKeyError struct {
}

A EmptyKeyError signifies that the request does not contain enough information to create a key.

func (EmptyKeyError) Error
func (eke EmptyKeyError) Error() string
type LimitKey
type LimitKey interface {
	Type() string
	Key(common.Request) (string, error)
}

A LimitKey returns a string key based on the request for creating bucketnames.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyKeyError

type EmptyKeyError struct {
	// contains filtered or unexported fields
}

A EmptyKeyError signifies that the request does not contain enough information to create a key.

func (EmptyKeyError) Error

func (eke EmptyKeyError) Error() string

type LimitKey

type LimitKey interface {
	Type() string
	Key(common.Request) (string, error)
}

A LimitKey returns a string key based on the request for creating bucketnames.

func NewGlobalLimitKey added in v0.7.2

func NewGlobalLimitKey(config interface{}) ([]LimitKey, error)

NewGlobalLimitKey creates a slice of globalLimitKeys that always returns the same key

func NewHeaderLimitKeys

func NewHeaderLimitKeys(config interface{}) ([]LimitKey, error)

NewHeaderLimitKeys creates a slice of headerLimitKeys that keys on the named request header

func NewIPLimitKeys

func NewIPLimitKeys(config interface{}) ([]LimitKey, error)

NewIPLimitKeys creates a slice of ipLimitKeys that returns a key based on request remoteaddr

Jump to

Keyboard shortcuts

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