lb

package
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotDialer = fmt.Errorf("error not dialer")
)

Functions

func NewLBWithConfig

func NewLBWithConfig(conf *Config) (stream.Dialer, error)

Types

type Config

type Config struct {
	Policy  LoadBalancePolicyEnum `json:",omitempty"`
	Dialers []*Weight
}

type LoadBalancePolicyEnum

type LoadBalancePolicyEnum string
const (
	EnumRoundRobin LoadBalancePolicyEnum = "round_robin"
	EnumRandom     LoadBalancePolicyEnum = "random"
)

type Random

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

func NewRandom

func NewRandom(handlers []stream.Dialer) *Random

func NewRoundRobin

func NewRoundRobin(handlers []stream.Dialer) *Random

func (*Random) DialStream

func (r *Random) DialStream(ctx context.Context) (stream.Stream, error)

type RoundRobin

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

func (*RoundRobin) DialStream

func (r *RoundRobin) DialStream(ctx context.Context) (stream.Stream, error)

type Weight

type Weight struct {
	Weight uint `json:",omitempty"`
	Dialer stream.Dialer
}

Jump to

Keyboard shortcuts

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