proxy

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

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

type FallbackSpec struct {
	ForCodes      bool `yaml:"forCodes"`
	fallback.Spec `yaml:",inline"`
}

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.

func (PoolSpec) Validate

func (s PoolSpec) Validate() error

Validate validates poolSpec.

type PoolStatus

type PoolStatus struct {
	Stat *httpstat.Status `yaml:"stat"`
}

PoolStatus is the status of Pool.

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy is the filter Proxy.

func (*Proxy) Close

func (b *Proxy) Close()

Close closes Proxy.

func (*Proxy) DefaultSpec

func (b *Proxy) DefaultSpec() interface{}

DefaultSpec returns the default spec of Proxy.

func (*Proxy) Description

func (b *Proxy) Description() string

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.

func (*Proxy) Kind

func (b *Proxy) Kind() string

Kind returns the kind of Proxy.

func (*Proxy) Results

func (b *Proxy) Results() []string

Results returns the results of Proxy.

func (*Proxy) Status

func (b *Proxy) Status() interface{}

Status returns Proxy status.

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.

func (*Server) String

func (s *Server) String() string

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.

func (Spec) Validate

func (s Spec) Validate() error

Validate validates Spec.

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.

Jump to

Keyboard shortcuts

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