slbKit

package
v3.0.906 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	URL          *url.URL
	Alive        bool
	ReverseProxy *httputil.ReverseProxy
	// contains filtered or unexported fields
}

Backend holds the data about a server

func (*Backend) IsAlive

func (b *Backend) IsAlive() (alive bool)

IsAlive returns true when backend is alive

func (*Backend) SetAlive

func (b *Backend) SetAlive(alive bool)

SetAlive for this backend

type ServerPool

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

ServerPool holds information about reachable backends

func (*ServerPool) AddBackend

func (s *ServerPool) AddBackend(backend *Backend)

AddBackend to the server pool

func (*ServerPool) GetNextPeer

func (s *ServerPool) GetNextPeer() *Backend

GetNextPeer returns next active peer to take a connection

func (*ServerPool) HealthCheck

func (s *ServerPool) HealthCheck()

HealthCheck pings the backends and update the status

func (*ServerPool) MarkBackendStatus

func (s *ServerPool) MarkBackendStatus(backendUrl *url.URL, alive bool)

MarkBackendStatus changes a status of a backend

func (*ServerPool) NextIndex

func (s *ServerPool) NextIndex() int

NextIndex atomically increase the counter and return an index

Jump to

Keyboard shortcuts

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