Documentation
¶
Index ¶
- Constants
- type CompressionSpec
- type FallbackSpec
- type LoadBalance
- type PoolSpec
- type PoolStatus
- type Proxy
- func (b *Proxy) Close()
- func (b *Proxy) DefaultSpec() interface{}
- func (b *Proxy) Description() string
- func (b *Proxy) Handle(ctx context.HTTPContext) (result string)
- func (b *Proxy) Inherit(pipeSpec *httppipeline.FilterSpec, previousGeneration httppipeline.Filter, ...)
- func (b *Proxy) Init(pipeSpec *httppipeline.FilterSpec, super *supervisor.Supervisor)
- func (b *Proxy) Kind() string
- func (b *Proxy) Results() []string
- func (b *Proxy) Status() interface{}
- type Server
- type Spec
- type Status
Constants ¶
View Source
const ( // PolicyRoundRobin is the policy of round robin. PolicyRoundRobin = "roundRobin" // PolicyRandom is the policy of random. PolicyRandom = "random" // PolicyWeightedRandom is the policy of weighted random. PolicyWeightedRandom = "weightedRandom" // PolicyIPHash is the policy of ip hash. PolicyIPHash = "ipHash" // PolicyHeaderHash is the policy of header hash. PolicyHeaderHash = "headerHash" )
View Source
const (
// Kind is the kind of Proxy.
Kind = "Proxy"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressionSpec ¶
type CompressionSpec struct {
MinLength uint32 `yaml:"minLength"`
}
CompressionSpec describes the compression.
type FallbackSpec ¶
FallbackSpec describes the fallback policy.
type LoadBalance ¶
type LoadBalance struct {
Policy string `yaml:"policy" jsonschema:"required,enum=roundRobin,enum=random,enum=weightedRandom,enum=ipHash,enum=headerHash"`
HeaderHashKey string `yaml:"headerHashKey" jsonschema:"omitempty"`
}
LoadBalance is load balance for multiple servers.
func (LoadBalance) Validate ¶
func (lb LoadBalance) Validate() error
Validate validates LoadBalance.
type PoolSpec ¶
type PoolSpec struct {
SpanName string `yaml:"spanName" jsonschema:"omitempty"`
Filter *httpfilter.Spec `yaml:"filter" jsonschema:"omitempty"`
ServersTags []string `yaml:"serversTags" jsonschema:"omitempty,uniqueItems=true"`
Servers []*Server `yaml:"servers" jsonschema:"omitempty"`
ServiceRegistry string `yaml:"serviceRegistry" jsonschema:"omitempty"`
ServiceName string `yaml:"serviceName" jsonschema:"omitempty"`
LoadBalance *LoadBalance `yaml:"loadBalance" jsonschema:"required"`
MemoryCache *memorycache.Spec `yaml:"memoryCache,omitempty" jsonschema:"omitempty"`
}
PoolSpec describes a pool of servers.
type PoolStatus ¶
PoolStatus is the status of Pool.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is the filter Proxy.
func (*Proxy) DefaultSpec ¶
func (b *Proxy) DefaultSpec() interface{}
DefaultSpec returns the default spec of Proxy.
func (*Proxy) Description ¶
Description returns the description of Proxy.
func (*Proxy) Handle ¶
func (b *Proxy) Handle(ctx context.HTTPContext) (result string)
Handle handles HTTPContext.
func (*Proxy) Inherit ¶
func (b *Proxy) Inherit(pipeSpec *httppipeline.FilterSpec, previousGeneration httppipeline.Filter, super *supervisor.Supervisor)
Inherit inherits previous generation of Proxy.
func (*Proxy) Init ¶
func (b *Proxy) Init(pipeSpec *httppipeline.FilterSpec, super *supervisor.Supervisor)
Init initializes Proxy.
type Server ¶
type Server struct {
URL string `yaml:"url" jsonschema:"required,format=url"`
Tags []string `yaml:"tags" jsonschema:"omitempty,uniqueItems=true"`
Weight int `yaml:"weight" jsonschema:"omitempty,minimum=0,maximum=100"`
}
Server is proxy server.
type Spec ¶
type Spec struct {
httppipeline.FilterMetaSpec `yaml:",inline"`
Fallback *FallbackSpec `yaml:"fallback,omitempty" jsonschema:"omitempty"`
MainPool *PoolSpec `yaml:"mainPool" jsonschema:"required"`
CandidatePools []*PoolSpec `yaml:"candidatePools,omitempty" jsonschema:"omitempty"`
MirrorPool *PoolSpec `yaml:"mirrorPool,omitempty" jsonschema:"omitempty"`
FailureCodes []int `yaml:"failureCodes" jsonschema:"omitempty,uniqueItems=true,format=httpcode-array"`
Compression *CompressionSpec `yaml:"compression,omitempty" jsonschema:"omitempty"`
}
Spec describes the Proxy.
type Status ¶
type Status struct {
MainPool *PoolStatus `yaml:"mainPool"`
CandidatePools []*PoolStatus `yaml:"candidatePools,omitempty"`
MirrorPool *PoolStatus `yaml:"mirrorPool,omitempty"`
}
Status is the status of Proxy.
Click to show internal directories.
Click to hide internal directories.