load_balancer

package
v0.0.0-...-35a4376 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReverseProxyLoadBalancerHandler

func ReverseProxyLoadBalancerHandler(logger log.Logger, config *Config) (router.RouteHandler, error)

Types

type AliasExceptions

type AliasExceptions []string

func (AliasExceptions) NotAliasException

func (e AliasExceptions) NotAliasException(originalURL string) bool

type Backend

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

func NewBackend

func NewBackend(serverURL *url.URL, loadBalancerFunc http.HandlerFunc, logger log.Logger) *Backend

func (*Backend) HealthCheck

func (b *Backend) HealthCheck() error

func (*Backend) IsAlive

func (b *Backend) IsAlive() bool

func (*Backend) ServeHTTP

func (b *Backend) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*Backend) SetAlive

func (b *Backend) SetAlive(alive bool)

type Config

type Config struct {
	Path           string
	Servers        []string
	ModifyRequest  func(http.ResponseWriter, *http.Request) error
	ModifyResponse func(http.ResponseWriter, *http.Request) error
}

type ExceptionRoute

type ExceptionRoute struct {
	Path            string
	Method          string
	AliasExceptions AliasExceptions
	Restricted      bool
}

func (*ExceptionRoute) IsException

func (r *ExceptionRoute) IsException(originalURL, method string) (bool, error)

type ExceptionRoutes

type ExceptionRoutes []*ExceptionRoute

func (ExceptionRoutes) IsSkip

func (r ExceptionRoutes) IsSkip(originalURL, method string) (bool, error)

type ServerPool

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

func NewServerPool

func NewServerPool(config *Config, logger log.Logger) (*ServerPool, error)

func (*ServerPool) AddBackend

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

func (*ServerPool) LoadBalancer

func (s *ServerPool) LoadBalancer(writer http.ResponseWriter, request *http.Request)

func (*ServerPool) ServeHTTP

func (s *ServerPool) ServeHTTP(writer http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

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