Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // TargetGroups is a list of configs for all if this load balancer's target groups. TargetGroups []TargetGroupConfig `json:"target_groups"` }
type LoadBalancer ¶
func Open ¶
func Open(configPath string, log *logrus.Logger) (*LoadBalancer, error)
Open starts a new load balancer with the given config, ready to receive incoming TCP connections.
func (*LoadBalancer) Close ¶
func (lb *LoadBalancer) Close() error
Close gracefully shuts down this load balancer, draining all load balancer target groups and shutting down the control plane server if it's running.
func (*LoadBalancer) ReloadConfig ¶ added in v0.2.1
func (lb *LoadBalancer) ReloadConfig() error
func (*LoadBalancer) UpdateConfig ¶
func (lb *LoadBalancer) UpdateConfig(config Config) error
UpdateConfig applies the given config to this load balancer without downtime for existing or new connections.
type TargetConfig ¶
type TargetGroup ¶
type TargetGroup struct { sync.RWMutex TargetGroupConfig // contains filtered or unexported fields }
TargetGroup listens for incoming connections on a specific port, assigning each new connection to a healthy target from the configured group of targets. TargetGroups use consistent hashing based on the incoming connection's source address to assign connections to targets, so the same client will always be routed to the same target as long as that target is healthy and present in the target group.
type TargetGroupConfig ¶
type TargetGroupConfig struct { // Name is a unique name for this target group. Name string // Port is the port on which this target group should listen for new connections. Port uint // Timeout is how long inactive connections should live. Timeout uint // Targets is a list of configs for all if this target group's targets. Targets []TargetConfig }