loadbalancer

package
v0.0.0-...-f4dfa5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const RandomPort = 0

Variables

View Source
var (
	SupervisorServiceName = version.Program + "-agent-load-balancer"
	APIServerServiceName  = version.Program + "-api-server-agent-load-balancer"
	ETCDServerServiceName = version.Program + "-etcd-server-load-balancer"
)

Functions

func ResetLoadBalancer

func ResetLoadBalancer(dataDir, serviceName string) error

ResetLoadBalancer will delete the local state file for the load balancer on disk

func SetHTTPProxy

func SetHTTPProxy(address string) error

SetHTTPProxy configures a proxy-enabled dialer to be used for all loadbalancer connections, if the agent has been configured to allow use of a HTTP proxy, and the environment has been configured to indicate use of a HTTP proxy for the server URL.

Types

type LoadBalancer

type LoadBalancer struct {
	ServerURL       string
	ServerAddresses []string

	Listener net.Listener
	// contains filtered or unexported fields
}

LoadBalancer holds data for a local listener which forwards connections to a pool of remote servers. It is not a proper load-balancer in that it does not actually balance connections, but instead fails over to a new server only when a connection attempt to the currently selected server fails.

func New

func New(ctx context.Context, dataDir, serviceName, serverURL string, lbServerPort int, isIPv6 bool) (_lb *LoadBalancer, _err error)

New contstructs a new LoadBalancer instance. The default server URL, and currently active servers, are stored in a file within the dataDir.

func (*LoadBalancer) LoadBalancerServerURL

func (lb *LoadBalancer) LoadBalancerServerURL() string

func (*LoadBalancer) SetDefault

func (lb *LoadBalancer) SetDefault(serverAddress string)

func (*LoadBalancer) Update

func (lb *LoadBalancer) Update(serverAddresses []string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL