types

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewServerPool = F.NewMap[Pool]

Functions

This section is empty.

Types

type Config

type Config struct {
	Link    string         `json:"link"`
	Mode    Mode           `json:"mode"`
	Weight  Weight         `json:"weight"`
	Options map[string]any `json:"options,omitempty"`
}

type Mode

type Mode string
const (
	ModeUnset      Mode = ""
	ModeRoundRobin Mode = "roundrobin"
	ModeLeastConn  Mode = "leastconn"
	ModeIPHash     Mode = "iphash"
)

func (*Mode) ValidateUpdate

func (mode *Mode) ValidateUpdate() bool

type Pool

type Pool = F.Map[string, Server]

type Server

type Server interface {
	http.Handler
	health.HealthMonitor
	Name() string
	URL() *net.URL
	Weight() Weight
	SetWeight(weight Weight)
	TryWake() error
}

func NewServer

func NewServer(name string, url *net.URL, weight Weight, handler http.Handler, healthMon health.HealthMonitor) Server

func TestNewServer

func TestNewServer[T ~int | ~float32 | ~float64](weight T) Server

type Weight

type Weight uint16

Jump to

Keyboard shortcuts

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