server

package
v0.0.0-...-cd6c04c Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthCheck

func HealthCheck(s *Server, healthCheckInterval time.Duration)

Types

type Config

type Config struct {
	Port                string   `json:"port"`
	HealthCheckInterval string   `json:"healthCheckInterval"`
	Servers             []string `json:"servers"`
}

func LoadConfig

func LoadConfig(file string) (Config, error)

type LoadBalancer

type LoadBalancer struct {
	Current int
	Mutex   sync.Mutex
}

func (*LoadBalancer) GetNextServer

func (lb *LoadBalancer) GetNextServer(servers []*Server) *Server

type Server

type Server struct {
	URL       *url.URL
	IsHealthy bool
	Mutex     sync.Mutex
}

func (*Server) ReverseProxy

func (s *Server) ReverseProxy() *httputil.ReverseProxy

Jump to

Keyboard shortcuts

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