domain

package
v0.0.0-...-406e9ca Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Services []Service `yaml:"services"`

	// Strategy is the name of strategy to be used in load balancing between instances
	Strategy string `yaml:"strategy"`
}

Config is a representation of the configuration given to the LB from a config source

type Replica

type Replica struct {
	URL      string            `yaml:"url"`
	Metadata map[string]string `yaml:"metadata"`
}

type Server

type Server struct {
	URL      *url.URL
	Proxy    *httputil.ReverseProxy
	Metadata map[string]string
	// contains filtered or unexported fields
}

Server is an instance of a running server

func (*Server) Forward

func (s *Server) Forward(rw http.ResponseWriter, r *http.Request)

func (*Server) GetMetaOrDefault

func (s *Server) GetMetaOrDefault(key, def string) string

GetMetaOrDefault returns the value associated with the given key in the metadata or returns a default.

func (*Server) GetMetaOrDefaultInt

func (s *Server) GetMetaOrDefaultInt(key string, def int) int

GetMetaOrDefaultInt returns the int value associated with the given key in the metadata or returns a default.

func (*Server) IsAlive

func (s *Server) IsAlive() bool

IsAlive reports the liveness state of a server

func (*Server) SetLiveness

func (s *Server) SetLiveness(value bool) bool

SetLiveness will change the current alive field value, and returns the former

type Service

type Service struct {
	Name string `yaml:"name"`

	// A prefix matcher to select service based on the path part of the url
	Matcher string `yaml:"matcher"`

	// Strategy is the load balancing strategy for the current service
	Strategy string    `yaml:"strategy"`
	Replicas []Replica `yaml:"replicas"`
}

Jump to

Keyboard shortcuts

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