upstream

package
v0.0.0-...-b0286f8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy string
const (
	RandomPolicy     Policy = "random"
	RoundRobinPolicy Policy = "round_robin"
	WeightPolicy     Policy = "weight"
)

type Result

type Result struct {
	Upstreams map[string]*Upstreams
	Default   *Upstreams
	ExprRules []config.Rule
}

func BuildUpstreamsFromRules

func BuildUpstreamsFromRules(policy Policy, rules config.Rules, dialer proxy.Dialer) (*Result, error)

type Upstream

type Upstream struct {
	Rule        config.Rule
	Index       int
	Handler     base.Handler
	ServerIndex int
	KeyIndex    int
}

func (*Upstream) MaskedKey

func (u *Upstream) MaskedKey() string

func (*Upstream) MaskedServer

func (u *Upstream) MaskedServer() string

func (*Upstream) Name

func (u *Upstream) Name() string

type Upstreams

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

func NewUpstreams

func NewUpstreams(policy Policy) *Upstreams

func (*Upstreams) Add

func (u *Upstreams) Add(upstream *Upstream)

func (*Upstreams) All

func (u *Upstreams) All() []*Upstream

func (*Upstreams) Init

func (u *Upstreams) Init() error

func (*Upstreams) Len

func (u *Upstreams) Len() int

func (*Upstreams) Next

func (u *Upstreams) Next(excludeIndex ...int) (*Upstream, int)

func (*Upstreams) Print

func (u *Upstreams) Print()

Jump to

Keyboard shortcuts

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