upstream

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2017 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSessions

func AllSessions() map[string]*Sessions

func RemoveBackend

func RemoveBackend(cmb *BackendCombined) (onLast bool)

func UpsertBackend

func UpsertBackend(cmb *BackendCombined) (onFirst bool, err error)

Types

type Backend

type Backend struct {
	ID        string  `json:"id"`     // backend server id(name)
	IP        string  `json:"ip"`     // backend server ip
	Port      uint64  `json:"port"`   // backend server port
	Scheme    string  `json:"scheme"` // http / https, auto detect & setup by httpProxy
	Version   string  `json:"version"`
	Weight    float64 `json:"weihgt"`
	CleanName string  `json:"clean_name"` // backend server clean id(name)
}

Backend

func GetBackend

func GetBackend(ups, backend string) *Backend

func (*Backend) Addr

func (b *Backend) Addr() string

func (*Backend) String added in v0.2.1

func (b *Backend) String() string

type BackendCombined

type BackendCombined struct {
	*Upstream `json:"upstream"`
	*Backend  `json:"backend"`
}

BackendCombined

func Lookup

func Lookup(remoteIP, ups, backend string) *BackendCombined

lookup select a suitable backend according by sessions & balancer

func LookupAlias

func LookupAlias(remoteIP, alias string) *BackendCombined

similar as lookup, but by upstream alias

func LookupListen

func LookupListen(remoteIP, listen string) *BackendCombined

similar as lookup, but by upstream listen

func (*BackendCombined) Format added in v0.2.1

func (cmb *BackendCombined) Format()

func (*BackendCombined) String added in v0.2.1

func (cmb *BackendCombined) String() string

func (*BackendCombined) Valid

func (cmb *BackendCombined) Valid() error

type Balancer

type Balancer interface {
	Next([]*Backend) *Backend
}

type Sessions

type Sessions struct {
	sync.RWMutex // protect m
	// contains filtered or unexported fields
}

Sessions

func (*Sessions) MarshalJSON

func (s *Sessions) MarshalJSON() ([]byte, error)

type UpsManager

type UpsManager struct {
	Upstreams []*Upstream `json:"upstreams"`
	sync.RWMutex
}

Type & Method Definitions ...

type Upstream

type Upstream struct {
	Name     string     `json:"name"`     // uniq name
	Alias    string     `json:"alias"`    // advertised url
	Listen   string     `json:"listen"`   // listen addr
	Sticky   bool       `json:"sticky"`   // session sticky enabled (default no)
	Backends []*Backend `json:"backends"` // backend servers
	// contains filtered or unexported fields
}

func AllUpstreams

func AllUpstreams() []*Upstream

Exported Functions ....

func GetUpstream

func GetUpstream(ups string) *Upstream

func (*Upstream) String added in v0.2.1

func (u *Upstream) String() string

Jump to

Keyboard shortcuts

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