Documentation ¶
Overview ¶
Package services provides a way to define services that can be proxied.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler returns a http.Handler that proxies requests to services, redirecting to TLS if applicable.
func LaunchHealthChecks ¶
LaunchHealthChecks starts the health checks for all services.
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is a service that is running in a Docker container.
func NewContainer ¶
NewContainer creates a new service from a docker container.
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer is a service that load balances between other services.
func NewLoadBalancer ¶
func NewLoadBalancer(host string, strategy Strategy, persistent bool, services []*Service) *LoadBalancer
NewLoadBalancer creates a new load balancer service.
func (*LoadBalancer) Route ¶
func (l *LoadBalancer) Route(w http.ResponseWriter, r *http.Request) (*url.URL, error)
Route returns the remote URL of the next service in the load balancer.
type Random ¶
type Random struct {
// contains filtered or unexported fields
}
Random is a random selection strategy.
type Redirect ¶
type Redirect struct {
// contains filtered or unexported fields
}
Redirect is a service that redirects to a remote URL.
func NewRedirect ¶
NewRedirect creates a new Redirect service.
type RoundRobin ¶
type RoundRobin struct {
// contains filtered or unexported fields
}
RoundRobin is a round-robin selection strategy.
type Service ¶
type Service struct { TLS bool Middlewares []middlewares.Middleware Health health.Checker Router Router }
Service is a service that can be proxied.
type Strategy ¶
type Strategy interface { // Select returns the index of the next service to use. Select([]*Service, *http.Request) int }
Strategy defines the interface for a load balancer selection strategy.
func NewStrategy ¶
NewStrategy converts a string to a Strategy. If the string is empty, the default strategy RoundRobin is used.