proxy

package
v0.0.0-...-ac8ee45 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2014 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package proxy implements the layer-3 network proxy.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingServiceEntry = errors.New("missing service entry")
	ErrMissingEndpoints    = errors.New("missing endpoints")
)

Functions

This section is empty.

Types

type LoadBalancer

type LoadBalancer interface {
	// NextEndpoint returns the endpoint to handle a request for the given
	// service and source address.
	NextEndpoint(service string, srcAddr net.Addr) (string, error)
}

LoadBalancer is an interface for distributing incoming requests to service endpoints.

type LoadBalancerRR

type LoadBalancerRR struct {
	// contains filtered or unexported fields
}

LoadBalancerRR is a round-robin load balancer.

func NewLoadBalancerRR

func NewLoadBalancerRR() *LoadBalancerRR

NewLoadBalancerRR returns a new LoadBalancerRR.

func (*LoadBalancerRR) NextEndpoint

func (lb *LoadBalancerRR) NextEndpoint(service string, srcAddr net.Addr) (string, error)

NextEndpoint returns a service endpoint. The service endpoint is chosen using the round-robin algorithm.

func (*LoadBalancerRR) OnUpdate

func (lb *LoadBalancerRR) OnUpdate(endpoints []api.Endpoints)

OnUpdate manages the registered service endpoints. Registered endpoints are updated if found in the update set or unregistered if missing from the update set.

type Proxier

type Proxier struct {
	// contains filtered or unexported fields
}

Proxier is a simple proxy for TCP connections between a localhost:lport and services that provide the actual implementations.

func NewProxier

func NewProxier(loadBalancer LoadBalancer, address string) *Proxier

NewProxier returns a new Proxier given a LoadBalancer and an address on which to listen

func (*Proxier) OnUpdate

func (proxier *Proxier) OnUpdate(services []api.Service)

OnUpdate manages the active set of service proxies. Active service proxies are reinitialized if found in the update set or shutdown if missing from the update set.

func (*Proxier) StopProxy

func (proxier *Proxier) StopProxy(service string) error

StopProxy stops the proxy for the named service.

Directories

Path Synopsis
Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy).
Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy).

Jump to

Keyboard shortcuts

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