loadbalance

package
v0.0.0-...-ec09dfe Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	Get() BalancerMedium
}

Balancer is an interface for algorithms that can balance loads around various media (`BalancerMedium`) Must be thread safe.

type BalancerMedium

type BalancerMedium interface {
	Apply(client *fasthttp.Client)
}

BalancerMedium is a medium for balancing, e.g. a http proxy, or another network interface to use.

type HTTPProxy

type HTTPProxy struct {
	// contains filtered or unexported fields
}

func NewHTTPProxy

func NewHTTPProxy(username string, password string, address string, port int) *HTTPProxy

func (HTTPProxy) Apply

func (h HTTPProxy) Apply(client *fasthttp.Client)

type NetworkAddress

type NetworkAddress struct {
}

type RoundRobin

type RoundRobin struct {
	// contains filtered or unexported fields
}

RoundRobin implements the Round Robin algorithm to return a new BalancerMedium.

func NewRoundRobinPool

func NewRoundRobinPool(balancers []BalancerMedium) RoundRobin

func (*RoundRobin) Get

func (p *RoundRobin) Get() BalancerMedium

Get retrieves, using the balancing algorithm, the next BalancerMedium.

Jump to

Keyboard shortcuts

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