Documentation
¶
Index ¶
Constants ¶
const ( DefaultGracefulShutdownTimeout = 10 * time.Second DefaultGracefulReloadTimeout = 30 * time.Second DefaultDisconnectRateLimit = 100 // connections per second DefaultDisconnectBurstSize = 10 )
Default values for graceful shutdown
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Upstreams []Upstream `yaml:"upstreams" json:"upstreams"`
HandshakeTimeout Duration `yaml:"handshake_timeout,omitempty" json:"handshake_timeout,omitempty"`
ConnectionCloseTimeout Duration `yaml:"connection_close_timeout,omitempty" json:"connection_close_timeout,omitempty"`
GracefulShutdown GracefulShutdown `yaml:"graceful_shutdown,omitempty" json:"graceful_shutdown"`
}
Config represents the configuration of the trabbits proxy.
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults sets default values for config fields if not specified
type Duration ¶
Duration is a custom type that can unmarshal duration strings from JSON
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (Duration) ToDuration ¶
ToDuration converts to time.Duration
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type GracefulShutdown ¶
type GracefulShutdown struct {
ShutdownTimeout Duration `yaml:"shutdown_timeout,omitempty" json:"shutdown_timeout,omitempty"` // Max time to wait for shutdown (SIGTERM)
ReloadTimeout Duration `yaml:"reload_timeout,omitempty" json:"reload_timeout,omitempty"` // Max time to wait for config reload (SIGHUP)
RateLimit int `yaml:"rate_limit,omitempty" json:"rate_limit,omitempty"` // Disconnections per second
BurstSize int `yaml:"burst_size,omitempty" json:"burst_size,omitempty"` // Initial burst allowance
}
GracefulShutdown configures graceful shutdown behavior
type HealthCheck ¶
type HealthCheck struct {
Interval Duration `yaml:"interval,omitempty" json:"interval,omitempty"`
Timeout Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"`
UnhealthyThreshold int `yaml:"unhealthy_threshold,omitempty" json:"unhealthy_threshold,omitempty"`
RecoveryInterval Duration `yaml:"recovery_interval,omitempty" json:"recovery_interval,omitempty"`
Username string `yaml:"username,omitempty" json:"username,omitempty"`
Password Password `yaml:"password,omitempty" json:"password,omitempty"`
}
HealthCheck represents health check configuration for cluster upstreams
type Password ¶
type Password string
Password is a custom type that masks the value during JSON marshaling
func (Password) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface to mask password
func (*Password) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type QueueAttributes ¶
type QueueAttributes struct {
Durable *bool `yaml:"durable,omitempty" json:"durable,omitempty"`
AutoDelete *bool `yaml:"auto_delete,omitempty" json:"auto_delete,omitempty"`
Exclusive *bool `yaml:"exclusive,omitempty" json:"exclusive,omitempty"`
Arguments amqp091.Table `yaml:"arguments,omitempty" json:"arguments,omitempty"`
}
type QueueOptions ¶ added in v0.0.14
type Routing ¶
type Routing struct {
KeyPatterns []string `yaml:"key_patterns,omitempty" json:"key_patterns,omitempty"`
}
type Upstream ¶
type Upstream struct {
Name string `yaml:"name" json:"name"`
Address string `yaml:"address,omitempty" json:"address,omitempty"`
Cluster *Cluster `yaml:"cluster,omitempty" json:"cluster,omitempty"`
Timeout Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"`
HealthCheck *HealthCheck `yaml:"health_check,omitempty" json:"health_check,omitempty"`
Routing Routing `yaml:"routing,omitempty" json:"routing"`
QueueAttributes *QueueAttributes `yaml:"queue_attributes,omitempty" json:"queue_attributes,omitempty"`
QueueOptions *QueueOptions `yaml:"queue_options,omitempty" json:"queue_options,omitempty"`
}
Upstream represents the configuration of an upstream server.