Documentation ¶
Index ¶
Constants ¶
const Commands = `` /* 1663-byte string literal not displayed */
Variables ¶
var ServiceRegistry metrics.Registry = metrics.NoopRegistry{}
ServiceRegistry stores the metrics for the services.
Functions ¶
func SetMatcher ¶ added in v1.1.3
SetMatcher sets the matcher function for the proxy.
func SetPickerStrategy ¶
SetPickerStrategy sets the picker function for the proxy.
Types ¶
type Route ¶ added in v1.0.6
type Route struct { // Host contains the host of the route. // not used for routing but for config generation // Table has a map with the host as key // for faster lookup and smaller search space. Host string // Path is the path prefix from a request uri Path string // Opts is the raw route options Opts map[string]string // Targets contains the list of URLs Targets []*Target // contains filtered or unexported fields }
Route maps a path prefix to one or more target URLs. routes can have a share value which describes the amount of traffic this route should get. You can specify that a route should get a fixed percentage of the traffic independent of how many instances are running.
type RouteDef ¶ added in v1.3.6
type Routes ¶ added in v1.0.6
type Routes []*Route
Routes stores a list of routes usually for a single host.
type Table ¶
Table contains a set of routes grouped by host. The host routes are sorted from most to least specific by sorting the routes in reverse order by path.
func GetTable ¶
func GetTable() Table
GetTable returns the active routing table. The function is safe to be called from multiple goroutines and the value is never nil.
func (Table) Lookup ¶ added in v1.0.5
Lookup finds a target url based on the current matcher and picker or nil if there is none. It first checks the routes for the host and if none matches then it falls back to generic routes without a host. This is useful for a catch-all '/' rule.
func (Table) LookupHost ¶ added in v1.3.1
type Target ¶ added in v1.0.5
type Target struct { // Service is the name of the service the targetURL points to Service string // Tags are the list of tags for this target Tags []string // StripPath will be removed from the front of the outgoing // request path StripPath string // URL is the endpoint the service instance listens on URL *url.URL // FixedWeight is the weight assigned to this target. // If the value is 0 the targets weight is dynamic. FixedWeight float64 // Weight is the actual weight for this service in percent. Weight float64 // Timer measures throughput and latency of this target Timer metrics.Timer // contains filtered or unexported fields }