balancer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	Name    string
	Domains []string
	Private []byte
	Public  []byte
}

Certificate x509 in PEM format

func NewCertificate

func NewCertificate(priv, pub []byte, name string) (*Certificate, error)

NewCertificate creates a certificate

type Config

type Config struct {
	Options   map[string]string
	Exposed   map[string]Exposed
	Upstreams map[string]Upstream
}

Config is load balancer configuration scheme not tied to any LB implementation

func NewDefaultLBConfig

func NewDefaultLBConfig() Config

NewDefaultLBConfig returns an LBConfig with defaults

type Endpoint

type Endpoint struct {
	Options map[string]string
	IP      string
	Port    int
}

Endpoint for an upstream server

type Exposed

type Exposed struct {
	BindPort     int
	Certificates []Certificate
	Options      map[string]string
	HostName     string
	PathBegins   string
	IsDefault    bool
	Upstream     *Upstream
}

Exposed is a exposed server specification

func (*Exposed) Name

func (exp *Exposed) Name() string

Name returns an unique name based on BindPorts, Hostname and Path

type Manager

type Manager interface {
	WriteConfigAndRestart(config *Config, force bool) error
	StartBalancer() error
	StopBalancer() error
	ReloadBalancer() error

	// healtz
	Name() string
	Check(req *http.Request) error
}

Manager holds balancer configuration public functions

type Upstream

type Upstream struct {
	Name      string
	Options   map[string]string
	Endpoints []Endpoint
}

Upstream servers manage request after they are received at the balancer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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