Rate limit
Technical reference of Rate limit.
This API is used in Rate limit.
Symbols
| Symbol | Class | Description |
|---|---|---|
| RateLimitAll | const | RateLimitAll defines a constant value of the API. |
| RateLimitFilter | type | RateLimitFilter defines a public type of API. |
| RateLimitFilterIP | const | RateLimitFilterIP defines a constant value of the API. |
| RateLimitFilterSession | const | RateLimitFilterSession defines a constant value of the API. |
| RateLimitFilterRoute | const | RateLimitFilterRoute defines a constant value of the API. |
| RateLimitFilterMethod | const | RateLimitFilterMethod defines a constant value of the API. |
| RateLimitFilterURL | const | RateLimitFilterURL defines a constant value of the API. |
| RateLimitConfig | type | RateLimitConfig defines a public type of API. |
| RateLimitRule | type | RateLimitRule defines a public type of API. |
| RateLimitLimit | type | RateLimitLimit defines a public type of API. |
| RateLimitStrategy | type | RateLimitStrategy defines a public type of API. |
| RateLimitFixedWindow | type | RateLimitFixedWindow defines a public type of API. |
| RateLimitSlidingWindow | type | RateLimitSlidingWindow defines a public type of API. |
| RateLimitTokenBucket | type | RateLimitTokenBucket defines a public type of API. |
| RateLimitLeakyBucket | type | RateLimitLeakyBucket defines a public type of API. |
RateLimitAll
Declaration:
const RateLimitAll = "ALL" RateLimitAll defines a constant value of the API.
RateLimitFilter
Declaration:
type RateLimitFilter string RateLimitFilter defines a public type of API.
RateLimitFilterIP
Declaration:
RateLimitFilterIP RateLimitFilter = "ip" RateLimitFilterIP defines a constant value of the API.
RateLimitFilterSession
Declaration:
RateLimitFilterSession RateLimitFilter = "session" RateLimitFilterSession defines a constant value of the API.
RateLimitFilterRoute
Declaration:
RateLimitFilterRoute RateLimitFilter = "route" RateLimitFilterRoute defines a constant value of the API.
RateLimitFilterMethod
Declaration:
RateLimitFilterMethod RateLimitFilter = "method" RateLimitFilterMethod defines a constant value of the API.
RateLimitFilterURL
Declaration:
RateLimitFilterURL RateLimitFilter = "url" RateLimitFilterURL defines a constant value of the API.
RateLimitConfig
Declaration:
type RateLimitConfig struct {
Enabled bool
Rules []RateLimitRule
} RateLimitConfig defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Enabled | bool | Activate or disable the function. |
Rules | []RateLimitRule | Rules set. |
RateLimitRule
Declaration:
type RateLimitRule struct {
Name string
Enabled bool
Methods []string
Match string
Pattern string
Limits []RateLimitLimit
} RateLimitRule defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Name | string | Name of the value. |
Enabled | bool | Activate or disable the function. |
Methods | []string | Associated method. |
Match | string | Result or expression of coincidence. |
Pattern | string | Pattern used for coincidence. |
Limits | []RateLimitLimit | Configured limit. |
RateLimitLimit
Declaration:
type RateLimitLimit struct {
Name string
Enabled bool
By []RateLimitFilter
Strategy RateLimitStrategy
} RateLimitLimit defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Name | string | Name of the value. |
Enabled | bool | Activate or disable the function. |
By | []RateLimitFilter | Public data associated with By. |
Strategy | RateLimitStrategy | Public data associated with Strategy. |
RateLimitStrategy
Declaration:
type RateLimitStrategy interface {
rateLimitStrategy()
} RateLimitStrategy defines a public type of API.
RateLimitFixedWindow
Declaration:
type RateLimitFixedWindow struct {
Limit int
Window time.Duration
} RateLimitFixedWindow defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Limit | int | Configured limit. |
Window | time.Duration | Public data associated with Window. |
RateLimitSlidingWindow
Declaration:
type RateLimitSlidingWindow struct {
Limit int
Window time.Duration
} RateLimitSlidingWindow defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Limit | int | Configured limit. |
Window | time.Duration | Public data associated with Window. |
RateLimitTokenBucket
Declaration:
type RateLimitTokenBucket struct {
Every time.Duration
Refill int
Burst int
} RateLimitTokenBucket defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Every | time.Duration | Public data associated with Every. |
Refill | int | Public data associated with Refill. |
Burst | int | Public data associated with Burst. |
RateLimitLeakyBucket
Declaration:
type RateLimitLeakyBucket struct {
Every time.Duration
Drain int
Capacity int
} RateLimitLeakyBucket defines a public type of API.
Fields
| Field | Type | Description |
|---|---|---|
Every | time.Duration | Public data associated with Every. |
Drain | int | Public data associated with Drain. |
Capacity | int | Public data associated with Capacity. |