Documentation
¶
Index ¶
Constants ¶
View Source
const (
PluginTypeCanary = "canary"
)
Variables ¶
View Source
var ( ErrServiceExists = errors.New("service already exists") ErrServiceNotFound = errors.New("service not found") ErrRouteExists = errors.New("route already exists") ErrRouteNotFound = errors.New("route not found") ErrPluginExists = errors.New("plugin already exists") ErrPluginNotFound = errors.New("plugin not found") ErrUpstreamNotFound = errors.New("upstream not found") ErrMethodNotImplemented = errors.New("method not implemented") )
Functions ¶
This section is empty.
Types ¶
type ActiveHealthChecks ¶
type HeaderOps ¶
type HeaderOps struct {
// Add new header fields or overwrite existing ones.
Set map[string][]string `json:"set" yaml:"set"`
// Add new header fields.
Add map[string][]string `json:"add" yaml:"add"`
// Remove header fields.
Delete []string `json:"delete" yaml:"delete"`
}
Header manipulations.
type LoadBalancing ¶
type Matcher ¶
type Matcher struct {
Protocol string `json:"protocol" yaml:"protocol"`
Methods []string `json:"methods" yaml:"methods"`
Hosts []string `json:"hosts" yaml:"hosts"`
Paths []string `json:"paths" yaml:"paths"`
Headers map[string][]string `json:"headers" yaml:"headers"`
}
Matching rules for a route.
type Plugin ¶
type Plugin struct {
Disabled bool `json:"disabled" yaml:"disabled"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
OrderAfter string `json:"order_after" yaml:"order_after"`
Config map[string]interface{} `json:"config" yaml:"config"`
RouteName string `json:"route_name" yaml:"route_name"`
ServiceName string `json:"service_name" yaml:"service_name"`
}
type PluginCanaryConfig ¶
type PluginCanaryConfig struct {
UpstreamServiceName string `json:"upstream" yaml:"upstream" mapstructure:"upstream"`
KeyName string `json:"key" yaml:"key" mapstructure:"key"`
KeyType string `json:"type" yaml:"type" mapstructure:"type"`
Whitelist string `json:"whitelist" yaml:"whitelist" mapstructure:"whitelist"`
// The advanced matcher.
// See https://caddyserver.com/docs/json/apps/http/servers/routes/match/
Matcher map[string]interface{} `json:"matcher" yaml:"matcher" mapstructure:"matcher"`
URI `yaml:",inline" mapstructure:",squash"`
}
type Route ¶
type Route struct {
ServiceName string `json:"service_name" yaml:"service_name"`
// Route name must be unique.
Name string `json:"name" yaml:"name"`
Matcher `yaml:",inline"`
URI `yaml:",inline"`
Response *StaticResponse `json:"response" yaml:"response"`
// Routes will be matched from highest priority to lowest.
Priority float64 `json:"priority" yaml:"priority"`
}
type StaticResponse ¶
type TransportHTTP ¶
type TransportHTTP struct {
DialTimeout string `json:"dial_timeout" yaml:"dial_timeout"`
}
type URI ¶
type URI struct {
StripPrefix string `json:"strip_prefix" yaml:"strip_prefix" mapstructure:"strip_prefix"`
StripSuffix string `json:"strip_suffix" yaml:"strip_suffix" mapstructure:"strip_suffix"`
TargetPath string `json:"target_path" yaml:"target_path" mapstructure:"target_path"`
// TODO: Deprecate AddPrefix
AddPrefix string `json:"add_prefix" yaml:"add_prefix" mapstructure:"add_prefix"`
}
URI manipulations for a route.
type Upstream ¶
type Upstream struct {
Backends []*Backend `json:"backends" yaml:"backends"`
HTTP *TransportHTTP `json:"http" yaml:"http"`
LoadBalancing *LoadBalancing `json:"lb" yaml:"lb"`
ActiveHealthChecks *ActiveHealthChecks `json:"active_hc" yaml:"active_hc"`
HeaderUp *HeaderOps `json:"header_up" yaml:"header_up"`
HeaderDown *HeaderOps `json:"header_down" yaml:"header_down"`
}
Click to show internal directories.
Click to hide internal directories.
