Documentation ¶
Overview ¶
Package backend defines interfaces and structures controlling the proxy configuration and changes.
Index ¶
- Constants
- type Address
- type AlreadyExistsError
- type Backend
- type Endpoint
- type EndpointAdded
- type EndpointDeleted
- type EndpointStats
- type EndpointUpdated
- type Host
- type HostAdded
- type HostDeleted
- type HostKeyPairUpdated
- type HostListenerAdded
- type HostListenerDeleted
- type HostOptions
- type KeyPair
- type Listener
- type Location
- type LocationAdded
- type LocationDeleted
- type LocationKeepAlive
- type LocationLimits
- type LocationMiddlewareAdded
- type LocationMiddlewareDeleted
- type LocationMiddlewareUpdated
- type LocationOptions
- type LocationOptionsUpdated
- type LocationPathUpdated
- type LocationTimeouts
- type LocationUpstreamUpdated
- type MiddlewareInstance
- type NewBackendFn
- type NotFoundError
- type StatsGetter
- type Upstream
- type UpstreamAdded
- type UpstreamDeleted
Constants ¶
const ( HTTP = "http" HTTPS = "https" TCP = "tcp" UNIX = "unix" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
func NewAddress ¶
type AlreadyExistsError ¶
type AlreadyExistsError struct {
Message string
}
func (*AlreadyExistsError) Error ¶
func (n *AlreadyExistsError) Error() string
type Backend ¶
type Backend interface { GetHosts() ([]*Host, error) AddHost(*Host) (*Host, error) DeleteHost(name string) error UpdateHostKeyPair(hostname string, keyPair *KeyPair) (*Host, error) GetHost(name string) (*Host, error) AddHostListener(hostname string, listener *Listener) (*Listener, error) DeleteHostListener(hostname string, listenerId string) error AddLocation(*Location) (*Location, error) GetLocation(hostname, id string) (*Location, error) UpdateLocationUpstream(hostname, id string, upstream string) (*Location, error) UpdateLocationOptions(hostname, locationId string, o LocationOptions) (*Location, error) DeleteLocation(hostname, id string) error AddLocationMiddleware(hostname, locationId string, m *MiddlewareInstance) (*MiddlewareInstance, error) GetLocationMiddleware(hostname, locationId string, mType, id string) (*MiddlewareInstance, error) UpdateLocationMiddleware(hostname, locationId string, m *MiddlewareInstance) (*MiddlewareInstance, error) DeleteLocationMiddleware(hostname, locationId, mType, id string) error GetUpstreams() ([]*Upstream, error) AddUpstream(*Upstream) (*Upstream, error) GetUpstream(id string) (*Upstream, error) DeleteUpstream(id string) error AddEndpoint(*Endpoint) (*Endpoint, error) GetEndpoint(upstreamId, id string) (*Endpoint, error) DeleteEndpoint(upstreamId, id string) error // WatchChanges is an entry point for getting the configuration changes as well as the initial configuration. // It should be a blocking function generating events from change.go to the changes channel. WatchChanges(changes chan interface{}, cancel chan bool) error // GetRegistry returns registry with the supported plugins. GetRegistry() *plugin.Registry Close() }
type Endpoint ¶
type Endpoint struct { Id string Url string UpstreamId string Stats *EndpointStats }
Endpoint is a final destination of the request
func EndpointFromJSON ¶
func NewEndpoint ¶
func (*Endpoint) GetUniqueId ¶
type EndpointAdded ¶
type EndpointDeleted ¶
type EndpointStats ¶
Endpoint's realtime stats
func (*EndpointStats) String ¶
func (e *EndpointStats) String() string
type EndpointUpdated ¶
type Host ¶
type Host struct { Name string Locations []*Location KeyPair *KeyPair Listeners []*Listener Options HostOptions }
Incoming requests are matched by their hostname first. Hostname is defined by incoming 'Host' header. E.g. curl http://example.com/alice will be matched by the host example.com first.
func HostFromJSON ¶
func HostFromJSON(in []byte, getter plugin.SpecGetter) (*Host, error)
func HostsFromJSON ¶
func HostsFromJSON(in []byte, getter plugin.SpecGetter) ([]*Host, error)
type HostDeleted ¶
type HostDeleted struct {
Name string
}
type HostKeyPairUpdated ¶
type HostKeyPairUpdated struct {
Host *Host
}
type HostListenerAdded ¶
type HostListenerDeleted ¶
type HostOptions ¶
type HostOptions struct {
Default bool
}
type Listener ¶
type Listener struct { Id string // HTTP or HTTPS Protocol string // Adddress specifies network (tcp or unix) and address (ip:port or path to unix socket) Address Address }
Listener specifies the listening point - the network and interface for each host. Host can have multiple interfaces.
func ListenerFromJSON ¶
func NewListener ¶
type Location ¶
type Location struct { Hostname string Path string Id string Upstream *Upstream Middlewares []*MiddlewareInstance Options LocationOptions }
Hosts contain one or several locations. Each location defines a path - simply a regular expression that will be matched against request's url. Location contains link to an upstream and vulcand will use the endpoints from this upstream to serve the request. E.g. location loc1 will serve the request curl http://example.com/alice because it matches the path /alice:
func LocationFromJSON ¶
func LocationFromJSON(in []byte, getter plugin.SpecGetter) (*Location, error)
func NewLocation ¶
func NewLocationWithOptions ¶
func NewLocationWithOptions(hostname, id, path, upstreamId string, options LocationOptions) (*Location, error)
type LocationAdded ¶
type LocationDeleted ¶
type LocationKeepAlive ¶
type LocationLimits ¶
type LocationLimits struct { MaxMemBodyBytes int64 // Maximum size to keep in memory before buffering to disk MaxBodyBytes int64 // Maximum size of a request body in bytes }
Limits contains various limits one can supply for a location.
type LocationMiddlewareAdded ¶
type LocationMiddlewareAdded struct { Host *Host Location *Location Middleware *MiddlewareInstance }
type LocationMiddlewareUpdated ¶
type LocationMiddlewareUpdated struct { Host *Host Location *Location Middleware *MiddlewareInstance }
type LocationOptions ¶
type LocationOptions struct { Timeouts LocationTimeouts // Controls KeepAlive settins for backend servers KeepAlive LocationKeepAlive // Limits contains various limits one can supply for a location. Limits LocationLimits // Predicate that defines when requests are allowed to failover FailoverPredicate string // Used in forwarding headers Hostname string // In this case appends new forward info to the existing header TrustForwardHeader bool }
Additional options to control this location, such as timeouts
func LocationOptionsFromJSON ¶
func LocationOptionsFromJSON(in []byte) (*LocationOptions, error)
type LocationOptionsUpdated ¶
type LocationPathUpdated ¶
type LocationTimeouts ¶
type LocationUpstreamUpdated ¶
type MiddlewareInstance ¶
type MiddlewareInstance struct { Id string Priority int Type string Middleware plugin.Middleware }
Wrapper that contains information about this middleware backend-specific data used for serialization/deserialization
func MiddlewareFromJSON ¶
func MiddlewareFromJSON(in []byte, getter plugin.SpecGetter) (*MiddlewareInstance, error)
type NewBackendFn ¶
type NotFoundError ¶
type NotFoundError struct {
Message string
}
func (*NotFoundError) Error ¶
func (n *NotFoundError) Error() string
type StatsGetter ¶
type StatsGetter interface {
GetStats(hostname string, locationId string, e *Endpoint) *EndpointStats
}
StatsGetter provides realtime stats about endpoint specific to a particular location.
type Upstream ¶
Upstream is a collection of endpoints. Each location is assigned an upstream. Changing assigned upstream of the location gracefully redirects the traffic to the new endpoints of the upstream.
func NewUpstream ¶
func UpstreamFromJSON ¶
type UpstreamAdded ¶
type UpstreamAdded struct {
Upstream *Upstream
}
type UpstreamDeleted ¶
type UpstreamDeleted struct {
UpstreamId string
}
Directories ¶
Path | Synopsis |
---|---|
Etcd implementation of the backend, where all vulcand properties are implemented as directories or keys.
|
Etcd implementation of the backend, where all vulcand properties are implemented as directories or keys. |
Provides in memory backend implementation, mostly used for test purposes
|
Provides in memory backend implementation, mostly used for test purposes |