Documentation ¶
Overview ¶
Package model defines interfaces and structures controlling the proxy configuration.
Index ¶
- Constants
- type Address
- type AlreadyExistsError
- type Anomaly
- type Backend
- type BackendDeleted
- type BackendKey
- type BackendUpserted
- type Bracket
- type Counters
- type Engine
- type Frontend
- type FrontendDeleted
- type FrontendKey
- type FrontendUpserted
- type HTTPBackendKeepAlive
- type HTTPBackendSettings
- type HTTPBackendTimeouts
- type HTTPFrontendLimits
- type HTTPFrontendSettings
- type Host
- type HostDeleted
- type HostKey
- type HostSettings
- type HostUpserted
- type KeyPair
- type LatencyBrackets
- type Listener
- type ListenerDeleted
- type ListenerKey
- type ListenerUpserted
- type Middleware
- type MiddlewareDeleted
- type MiddlewareKey
- type MiddlewareUpserted
- type NewEngineFn
- type NotFoundError
- type RawMiddleware
- type RoundTripStats
- type Server
- type ServerDeleted
- type ServerKey
- type ServerUpserted
- type StatsProvider
- type StatusCode
- type TransportKeepAlive
- type TransportSettings
- type TransportTimeouts
- type Verdict
Constants ¶
const ( HTTP = "http" HTTPS = "https" TCP = "tcp" UNIX = "unix" NoTTL = 0 )
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 struct { Id string Type string Stats *RoundTripStats `json:",omitempty"` Settings interface{} }
Backend is a collection of endpoints. Each location is assigned an backend. Changing assigned backend of the location gracefully redirects the traffic to the new endpoints of the backend.
func BackendsFromJSON ¶
func NewHTTPBackend ¶
func NewHTTPBackend(id string, s HTTPBackendSettings) (*Backend, error)
NewBackend creates a new instance of the backend object
func (*Backend) GetUniqueId ¶
func (b *Backend) GetUniqueId() BackendKey
func (*Backend) HTTPSettings ¶
func (b *Backend) HTTPSettings() HTTPBackendSettings
func (*Backend) TransportSettings ¶
func (b *Backend) TransportSettings() (*TransportSettings, error)
type BackendDeleted ¶
type BackendDeleted struct {
BackendKey BackendKey
}
func (*BackendDeleted) String ¶
func (b *BackendDeleted) String() string
type BackendKey ¶
type BackendKey struct {
Id string
}
func (BackendKey) String ¶
func (u BackendKey) String() string
type BackendUpserted ¶
type BackendUpserted struct {
Backend Backend
}
func (*BackendUpserted) String ¶
func (b *BackendUpserted) String() string
type Bracket ¶
func NewBrackets ¶
func NewBrackets(h *memmetrics.HDRHistogram) []Bracket
type Counters ¶
type Counters struct { Period time.Duration NetErrors int64 Total int64 StatusCodes []StatusCode }
type Engine ¶
type Engine interface { GetHosts() ([]Host, error) GetHost(HostKey) (*Host, error) UpsertHost(Host) error DeleteHost(HostKey) error GetListeners() ([]Listener, error) GetListener(ListenerKey) (*Listener, error) UpsertListener(Listener) error DeleteListener(ListenerKey) error GetFrontends() ([]Frontend, error) GetFrontend(FrontendKey) (*Frontend, error) UpsertFrontend(Frontend, time.Duration) error DeleteFrontend(FrontendKey) error GetMiddlewares(FrontendKey) ([]Middleware, error) GetMiddleware(MiddlewareKey) (*Middleware, error) UpsertMiddleware(FrontendKey, Middleware, time.Duration) error DeleteMiddleware(MiddlewareKey) error GetBackends() ([]Backend, error) GetBackend(BackendKey) (*Backend, error) UpsertBackend(Backend) error DeleteBackend(BackendKey) error GetServers(BackendKey) ([]Server, error) GetServer(ServerKey) (*Server, error) UpsertServer(BackendKey, Server, time.Duration) error DeleteServer(ServerKey) error // Subscribe 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. Subscribe(events chan interface{}, cancel chan bool) error // GetRegistry returns registry with the supported plugins. GetRegistry() *plugin.Registry // Close Close() }
Engine is an interface for storage and configuration engine, e.g. Etcd.
type Frontend ¶
type Frontend struct { Id string Route string Type string BackendId string Stats *RoundTripStats `json:",omitempty"` Settings interface{} `json:",omitempty"` }
Frontend is connected to a backend and vulcand will use the servers from this backend.
func FrontendsFromJSON ¶
func NewHTTPFrontend ¶
func NewHTTPFrontend(id, backendId string, routeExpr string, settings HTTPFrontendSettings) (*Frontend, error)
func (*Frontend) GetKey ¶
func (l *Frontend) GetKey() FrontendKey
func (*Frontend) HTTPSettings ¶
func (f *Frontend) HTTPSettings() HTTPFrontendSettings
type FrontendDeleted ¶
type FrontendDeleted struct {
FrontendKey FrontendKey
}
func (*FrontendDeleted) String ¶
func (f *FrontendDeleted) String() string
type FrontendKey ¶
type FrontendKey struct {
Id string
}
func (FrontendKey) String ¶
func (f FrontendKey) String() string
type FrontendUpserted ¶
type FrontendUpserted struct {
Frontend Frontend
}
func (*FrontendUpserted) String ¶
func (f *FrontendUpserted) String() string
type HTTPBackendKeepAlive ¶
type HTTPBackendSettings ¶
type HTTPBackendSettings struct { Timeouts HTTPBackendTimeouts // Controls KeepAlive settins for backend servers KeepAlive HTTPBackendKeepAlive }
func (*HTTPBackendSettings) Equals ¶
func (s *HTTPBackendSettings) Equals(o HTTPBackendSettings) bool
type HTTPBackendTimeouts ¶
type HTTPFrontendLimits ¶
type HTTPFrontendLimits 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 HTTPFrontendSettings ¶
type HTTPFrontendSettings struct { // Limits contains various limits one can supply for a location. Limits HTTPFrontendLimits // 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 (HTTPFrontendSettings) Equals ¶
func (l HTTPFrontendSettings) Equals(o HTTPFrontendSettings) bool
type Host ¶
type Host struct { Name string Settings HostSettings }
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 HostsFromJSON ¶
type HostDeleted ¶
type HostDeleted struct {
HostKey HostKey
}
func (*HostDeleted) String ¶
func (h *HostDeleted) String() string
type HostSettings ¶
type HostUpserted ¶
type HostUpserted struct {
Host Host
}
func (*HostUpserted) String ¶
func (h *HostUpserted) String() string
type LatencyBrackets ¶
type LatencyBrackets []Bracket
func (LatencyBrackets) GetQuantile ¶
func (l LatencyBrackets) GetQuantile(q float64) (*Bracket, error)
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 ListenersFromJSON ¶
func NewListener ¶
type ListenerDeleted ¶
type ListenerDeleted struct {
ListenerKey ListenerKey
}
func (*ListenerDeleted) String ¶
func (l *ListenerDeleted) String() string
type ListenerKey ¶
type ListenerKey struct {
Id string
}
func (ListenerKey) String ¶
func (l ListenerKey) String() string
type ListenerUpserted ¶
func (*ListenerUpserted) String ¶
func (l *ListenerUpserted) String() string
type Middleware ¶
type Middleware struct { Id string Priority int Type string Middleware plugin.Middleware }
Middleware contains information about this middleware backend-specific data used for serialization/deserialization
func MiddlewareFromJSON ¶
func MiddlewareFromJSON(in []byte, getter plugin.SpecGetter, id ...string) (*Middleware, error)
func MiddlewaresFromJSON ¶
func MiddlewaresFromJSON(in []byte, getter plugin.SpecGetter) ([]Middleware, error)
type MiddlewareDeleted ¶
type MiddlewareDeleted struct {
MiddlewareKey MiddlewareKey
}
func (*MiddlewareDeleted) String ¶
func (m *MiddlewareDeleted) String() string
type MiddlewareKey ¶
type MiddlewareKey struct { FrontendKey FrontendKey Id string }
func (MiddlewareKey) String ¶
func (m MiddlewareKey) String() string
type MiddlewareUpserted ¶
type MiddlewareUpserted struct { FrontendKey FrontendKey Middleware Middleware }
func (*MiddlewareUpserted) String ¶
func (m *MiddlewareUpserted) String() string
type NewEngineFn ¶
type NotFoundError ¶
type NotFoundError struct {
Message string
}
func (*NotFoundError) Error ¶
func (n *NotFoundError) Error() string
type RawMiddleware ¶
type RawMiddleware struct { Id string Type string Priority int Middleware json.RawMessage }
type RoundTripStats ¶
type RoundTripStats struct { Verdict Verdict Counters Counters LatencyBrackets LatencyBrackets }
RoundTripStats contain real time statistics about performance of Server or Frontend such as latency, processed and failed requests.
func NewRoundTripStats ¶
func NewRoundTripStats(m *memmetrics.RTMetrics) (*RoundTripStats, error)
func (*RoundTripStats) AppErrorRatio ¶
func (e *RoundTripStats) AppErrorRatio() float64
AppErrorRate calculates the ratio of 500 responses that designate internal server errors to success responses - 2xx, it specifically not counts 4xx or any other than 500 error to avoid noisy results.
func (*RoundTripStats) NetErrorRatio ¶
func (e *RoundTripStats) NetErrorRatio() float64
NetErroRate calculates the amont of ntwork errors such as time outs and dropped connection that occured in the given time window
func (*RoundTripStats) RequestsPerSecond ¶
func (e *RoundTripStats) RequestsPerSecond() float64
func (*RoundTripStats) ResponseCodeRatio ¶
func (e *RoundTripStats) ResponseCodeRatio(startA, endA, startB, endB int) float64
ResponseCodeRatio calculates ratio of count(startA to endA) / count(startB to endB)
func (*RoundTripStats) String ¶
func (e *RoundTripStats) String() string
type Server ¶
type Server struct { Id string URL string Stats *RoundTripStats `json:",omitempty"` }
Server is a final destination of the request
func ServersFromJSON ¶
type ServerDeleted ¶
type ServerDeleted struct {
ServerKey ServerKey
}
func (*ServerDeleted) String ¶
func (s *ServerDeleted) String() string
type ServerKey ¶
type ServerKey struct { BackendKey BackendKey Id string }
func MustParseServerKey ¶
func ParseServerKey ¶
type ServerUpserted ¶
type ServerUpserted struct { BackendKey BackendKey Server Server }
func (*ServerUpserted) String ¶
func (s *ServerUpserted) String() string
type StatsProvider ¶
type StatsProvider interface { FrontendStats(FrontendKey) (*RoundTripStats, error) ServerStats(ServerKey) (*RoundTripStats, error) BackendStats(BackendKey) (*RoundTripStats, error) // TopFrontends returns locations sorted by criteria (faulty, slow, most used) // if hostname or backendId is present, will filter out locations for that host or backendId TopFrontends(*BackendKey) ([]Frontend, error) // TopServers returns endpoints sorted by criteria (faulty, slow, mos used) // if backendId is not empty, will filter out endpoints for that backendId TopServers(*BackendKey) ([]Server, error) }
StatsProvider provides realtime stats abount endpoints, backends and locations
type StatusCode ¶
type TransportKeepAlive ¶
type TransportSettings ¶
type TransportSettings struct { Timeouts TransportTimeouts KeepAlive TransportKeepAlive }
type TransportTimeouts ¶
Directories ¶
Path | Synopsis |
---|---|
package etcdng contains the implementation of the Etcd-backed engine, where all vulcand properties are implemented as directories or keys.
|
package etcdng contains the implementation of the Etcd-backed engine, where all vulcand properties are implemented as directories or keys. |
package memng provides in memory engine implementation, mostly used for test purposes
|
package memng provides in memory engine implementation, mostly used for test purposes |