Documentation
¶
Overview ¶
Package limiter defines shared types and constants used by all limiter sub-packages (conn, rate, traffic).
Index ¶
Constants ¶
const ( // ScopeService applies the limiter at the service level. ScopeService string = "service" // ScopeConn applies the limiter at the connection level. ScopeConn string = "conn" // ScopeClient applies the limiter per client (source IP). ScopeClient string = "client" )
Limiter scopes define how a limiter key is interpreted.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(opts *Options)
Option is a functional option for configuring Options.
func ClientOption ¶
ClientOption sets the client identifier.
type Options ¶
type Options struct {
// Service is the service name.
Service string
// Scope is the limiter scope ("service", "conn", or "client").
Scope string
// Network is the connection network type.
Network string
// Addr is the destination address.
Addr string
// Client is the client identifier (typically the source IP).
Client string
// Src is an additional source identifier.
Src string
}
Options holds the parameters passed when requesting a limiter.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conn defines connection-level limiter interfaces for controlling the number of active connections.
|
Package conn defines connection-level limiter interfaces for controlling the number of active connections. |
|
Package rate defines rate-limiting interfaces for controlling the rate of new connections or requests.
|
Package rate defines rate-limiting interfaces for controlling the rate of new connections or requests. |
|
Package traffic defines bandwidth/traffic limiter interfaces for controlling data transfer rates.
|
Package traffic defines bandwidth/traffic limiter interfaces for controlling data transfer rates. |