Documentation
¶
Index ¶
- func AddResponseRateLimitHeaders(resp http.ResponseWriter, limit int64, remaining int64, ttl time.Duration)
- func ExtractBearerToken(req http.Request) (*string, error)
- func ExtractClaim(claimNames []string) func(claims jwt.MapClaims) (*string, error)
- func ExtractQueryParameter(parameterName string) func(http.Request) (*string, error)
- func ExtractRequestClientIP(req *http.Request) string
- type Identifier
- type IdentifierConfig
- type IdentifierConfigJwtBearerHeader
- type IdentifierConfigJwtQueryParameter
- type JwtIdentifier
- type RateLimitProxy
- type RateLimitProxyConfig
- type RateLimitProxyConfigLimits
- type RateLimitProxyConfigPaths
- type RateLimitProxyConfigRedis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResponseRateLimitHeaders ¶
func AddResponseRateLimitHeaders(resp http.ResponseWriter, limit int64, remaining int64, ttl time.Duration)
AddResponseRateLimitHeaders ...
func ExtractBearerToken ¶
ExtractBearerToken ...
func ExtractClaim ¶
ExtractClaim ...
func ExtractQueryParameter ¶
ExtractQueryParameter ...
func ExtractRequestClientIP ¶
ExtractRequestClientIP ...
Types ¶
type Identifier ¶
Identifier ...
type IdentifierConfig ¶
type IdentifierConfig struct { JwtBearerHeader *IdentifierConfigJwtBearerHeader `yaml:"jwtBearerHeader"` JwtQueryToken *IdentifierConfigJwtQueryParameter `yaml:"jwtQueryParameter"` }
IdentifierConfig ...
type IdentifierConfigJwtBearerHeader ¶
type IdentifierConfigJwtBearerHeader struct { Algorithm string `yaml:"algorithm"` KeyID string `yaml:"keyId"` Verifier string `yaml:"verifier"` Claim string `yaml:"claim"` }
IdentifierConfigJwtBearerHeader ...
type IdentifierConfigJwtQueryParameter ¶
type IdentifierConfigJwtQueryParameter struct { Algorithm string `yaml:"algorithm"` KeyID string `yaml:"keyId"` Verifier string `yaml:"verifier"` Claim string `yaml:"claim"` Name string `yaml:"name"` }
IdentifierConfigJwtQueryParameter ...
type JwtIdentifier ¶
type JwtIdentifier struct { KeyID string Algorithm string Verifier string TokenExtractor func(http.Request) (*string, error) IdentityExtractor func(claims jwt.MapClaims) (*string, error) }
JwtIdentifier ...
func (JwtIdentifier) IdentifyRequest ¶
func (id JwtIdentifier) IdentifyRequest(req *http.Request) (*string, error)
IdentifyRequest ...
type RateLimitProxy ¶
type RateLimitProxy struct { Config RateLimitProxyConfig RedisClient redis.Client Identifiers []Identifier InnerServeHTTP func(http.ResponseWriter, *http.Request) }
RateLimitProxy ...
func (*RateLimitProxy) ServeHTTP ¶
func (p *RateLimitProxy) ServeHTTP(wr http.ResponseWriter, req *http.Request)
type RateLimitProxyConfig ¶
type RateLimitProxyConfig struct { Redis RateLimitProxyConfigRedis `yaml:"redis"` Paths RateLimitProxyConfigPaths `yaml:"paths"` Limits RateLimitProxyConfigLimits `yaml:"limits"` IdentifiersConfig []IdentifierConfig `yaml:"identifiers"` }
RateLimitProxyConfig ...
func LoadRateLimitProxyConfig ¶
func LoadRateLimitProxyConfig(bytesRaw []byte) (*RateLimitProxyConfig, *[]Identifier, error)
LoadRateLimitProxyConfig ...
func (RateLimitProxyConfig) Equal ¶
func (c1 RateLimitProxyConfig) Equal(c2 RateLimitProxyConfig) bool
Equal ...
type RateLimitProxyConfigLimits ¶
type RateLimitProxyConfigLimits struct { Interval int64 `yaml:"interval"` Anonymous int64 `yaml:"anonymous"` Identified int64 `yaml:"identified"` Other map[string]int64 `yaml:"other"` }
RateLimitProxyConfigLimits ...
type RateLimitProxyConfigPaths ¶
type RateLimitProxyConfigPaths struct { Includes []string `yaml:"includes"` Excludes []string `yaml:"excludes"` }
RateLimitProxyConfigPaths ...
Click to show internal directories.
Click to hide internal directories.