router

package
v0.0.0-...-2c38ada Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router struct {
	RESTPort uint16
	// contains filtered or unexported fields
}

Router maintains all the state. It keeps a list or remote services we talk to, and exposes a REST API for configuring router rules

func NewRouter

func NewRouter(conf config.Config) Router

NewRouter creates a new router and configures unerlying services

func (*Router) AddRule

func (r *Router) AddRule(w http.ResponseWriter, req *http.Request, _ httprouter.Params)

AddRule adds a rule to the list of active rules

func (*Router) GetInstances

func (r *Router) GetInstances(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func (*Router) ListRules

func (r *Router) ListRules(w http.ResponseWriter, req *http.Request, _ httprouter.Params)

ListRules retuns a list of rules at all proxies in JSON format

func (*Router) RemoveInstances

func (r *Router) RemoveInstances(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func (*Router) RemoveRule

func (r *Router) RemoveRule(w http.ResponseWriter, req *http.Request, _ httprouter.Params)

RemoveRule removes the rule from the list of active rules FIXME: Currently this relies on internal Go equal semantics. Not ideal, but works for now

func (*Router) RemoveTest

func (r *Router) RemoveTest(w http.ResponseWriter, req *http.Request,
	params httprouter.Params)

func (*Router) Reset

func (r *Router) Reset(w http.ResponseWriter, req *http.Request, _ httprouter.Params)

Reset clears router state. This means all active proxies and their rules get cleared.

func (*Router) Run

func (r *Router) Run()

Run starts up the control loop of the router. listening for any REST messages

func (*Router) SetInstances

func (r *Router) SetInstances(w http.ResponseWriter, req *http.Request, params httprouter.Params)

Overwrite the load balancer pool for a given service name

func (*Router) SetTest

func (r *Router) SetTest(w http.ResponseWriter, req *http.Request,
	params httprouter.Params)

SetTest tells the router that a test with given ID will be happening

Jump to

Keyboard shortcuts

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