lb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_THRESHOLD_INTERVAL = 30 * time.Second
)

Variables

View Source
var (
	ERROR_NO_REACHABLE_IP = errors.New("no reachable ip found.")
)

Functions

This section is empty.

Types

type IPhash

type IPhash struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewIPhash

func NewIPhash(network string, addrs []string, unreachableThreshold int, thresholdInterval time.Duration, checkInterval time.Duration) (*IPhash, error)

func (*IPhash) Get

func (iph *IPhash) Get(signature string) (RemoteAddr, error)

func (*IPhash) Stop

func (iph *IPhash) Stop()

func (*IPhash) Unreachable

func (iph *IPhash) Unreachable(addr string)

type LoadBalancer

type LoadBalancer interface {
	Get(signature string) (RemoteAddr, error) //return addr string and error
	Unreachable(addr string)
	Stop()
}

type RemoteAddr

type RemoteAddr struct {
	AddrStr string
	IP      net.IP
	Port    int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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