upstream

package
v0.0.0-...-0b26499 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2013 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Upstream

type Upstream struct {
	// The upstream host to connect to
	Host string
	// The port on the upstream host
	Port int
	// Default 60 seconds
	Timeout time.Duration
	// Will ignore https on the incoming request and always upstream http
	ForceHttp bool
	// Ping URL Path-only for checking upness
	PingPath string
	// contains filtered or unexported fields
}

func NewUpstream

func NewUpstream(host string, port int, forceHttp bool) *Upstream

func (*Upstream) FilterRequest

func (u *Upstream) FilterRequest(request *falcore.Request) (res *http.Response)

func (*Upstream) SetPoolSize

func (u *Upstream) SetPoolSize(size int)

Alter the number of connections to multiplex with

type UpstreamEntry

type UpstreamEntry struct {
	Upstream *Upstream
	Weight   int
}

type UpstreamEntryConfig

type UpstreamEntryConfig struct {
	HostPort  string
	Weight    int
	ForceHttp bool
	PingPath  string
}

type UpstreamPool

type UpstreamPool struct {
	Name string
	// contains filtered or unexported fields
}

An UpstreamPool is a list of upstream servers which are considered functionally equivalent. The pool will round-robin the requests to the servers.

func NewUpstreamPool

func NewUpstreamPool(name string, config []UpstreamEntryConfig) *UpstreamPool

The config consists of a map of the servers in the pool in the format host_or_ip:port where port is optional and defaults to 80. The map value is an int with the weight only 0 and 1 are supported weights (0 disables a server and 1 enables it)

func (UpstreamPool) FilterRequest

func (up UpstreamPool) FilterRequest(req *falcore.Request) (res *http.Response)

func (UpstreamPool) LogStatus

func (up UpstreamPool) LogStatus()

func (UpstreamPool) Next

func (up UpstreamPool) Next() *UpstreamEntry

func (UpstreamPool) Shutdown

func (up UpstreamPool) Shutdown()

This should only be called if the upstream pool is no longer active or this may deadlock

Jump to

Keyboard shortcuts

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