{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package proxy\n\nPackage proxy implements the layer-3 network proxy.\n\n## Variables\n\n```go\nvar (\n\tErrMissingServiceEntry = errors.New(\"missing service entry\")\n\tErrMissingEndpoints    = errors.New(\"missing endpoints\")\n)\n```\n\n```go\nvar (\n\t// ErrProxyOnLocalhost is returned by NewProxier if the user requests a proxier on\n\t// the loopback address. May be checked for by callers of NewProxier to know whether\n\t// the caller provided invalid input.\n\tErrProxyOnLocalhost = fmt.Errorf(\"cannot proxy on localhost\")\n)\n```\n\n## Functions\n\n```go\nfunc IsProxyLocked(err error) bool\n```\nIsProxyLocked returns true if the proxy could not acquire the lock on iptables.\n\n## Types\n\n```go\ntype LoadBalancer interface {\n\t// NextEndpoint returns the endpoint to handle a request for the given\n\t// service-port and source address.\n\tNextEndpoint(service ServicePortName, srcAddr net.Addr) (string, error)\n\tNewService(service ServicePortName, sessionAffinityType api.ServiceAffinity, stickyMaxAgeMinutes int) error\n\tCleanupStaleStickySessions(service ServicePortName)\n}\n```\nLoadBalancer is an interface for distributing incoming requests to service endpoints.\n\n```go\ntype LoadBalancerRR struct {\n\t// contains filtered or unexported fields\n}\n```\nLoadBalancerRR is a round-robin load balancer.\n\n```go\nfunc NewLoadBalancerRR() *LoadBalancerRR\n```\nNewLoadBalancerRR returns a new LoadBalancerRR.\n\n```go\nfunc (lb *LoadBalancerRR) CleanupStaleStickySessions(svcPort ServicePortName)\n```\n\n```go\nfunc (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.ServiceAffinity, ttlMinutes int) error\n```\n\n```go\nfunc (lb *LoadBalancerRR) NextEndpoint(svcPort ServicePortName, srcAddr net.Addr) (string, error)\n```\nNextEndpoint returns a service endpoint. The service endpoint is chosen using the round-robin algorithm.\n\n```go\nfunc (lb *LoadBalancerRR) OnUpdate(allEndpoints []api.Endpoints)\n```\nOnUpdate manages the registered service endpoints. Registered endpoints are updated if found in the update set or unregistered if missing from the update set.\n\n```go\ntype PortAllocator interface {\n\tAllocateNext() (int, error)\n\tRelease(int)\n}\n```\n\n```go\ntype Proxier struct {\n\t// contains filtered or unexported fields\n}\n```\nProxier is a simple proxy for TCP connections between a localhost:lport and services that provide the actual implementations.\n\n```go\nfunc NewProxier(loadBalancer LoadBalancer, listenIP net.IP, iptables iptables.Interface, pr util.PortRange) (*Proxier, error)\n```\nNewProxier returns a new Proxier given a LoadBalancer and an address on which to listen.  Because of the iptables logic, It is assumed that there is only a single Proxier active on a machine. An error will be returned if the proxier cannot be started due to an invalid ListenIP (loopback) or if iptables fails to update or acquire the initial lock. Once a proxier is created, it will keep iptables up to date in the background and will not terminate if a particular iptables call fails.\n\n```go\nfunc (proxier *Proxier) OnUpdate(services []api.Service)\n```\nOnUpdate 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.\n\n```go\nfunc (proxier *Proxier) SyncLoop()\n```\nSyncLoop runs periodic work.  This is expected to run as a goroutine or as the main loop of the app.  It does not return.\n\n```go\ntype ServicePortName struct {\n\ttypes.NamespacedName\n\tPort string\n}\n```\nServicePortName carries a namespace + name + portname.  This is the unique identfier for a load-balanced service.\n\n```go\nfunc (spn ServicePortName) String() string\n```\n\n","path":"github.com/dockerstack/kubernetes/pkg/proxy","name":"proxy","synopsis":"Package proxy implements the layer-3 network proxy.","isRedistributable":true}
