domain

package
v0.0.0-...-7de8413 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: Apache-2.0 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"`

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

Config is a representation of the configuration given to farely 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(res http.ResponseWriter, req *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 the 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 the default

func (*Server) IsAlive

func (s *Server) IsAlive() bool

IsAlive reports the liveness state of the server

func (*Server) SetLiveness

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

SetLiveness will change the current alive field value, and return the old value.

type Service

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

	// A prefix matcher to select service based on the path part of the url
	// Note(self): The matcher could be more sophisticated (i.e Regex based,
	// subdomain based), but for the purposes of simplicity let's think about this
	// later, and it could be a nice contribution to the project.
	Matcher string `yaml:"matcher"`

	// Strategy is the load balancing strategy used for this 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