traffic_split

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOverride

func WithOverride(r *http.Request, override *Override) *http.Request

Types

type Config

type Config struct {
	Rules []Rule `json:"rules,omitempty"`
}

type Match

type Match struct {
	Vars []any `json:"vars,omitempty"`
}

type Node

type Node struct {
	Host     string `json:"host,omitempty"`
	Port     int    `json:"port,omitempty"`
	Weight   int    `json:"weight,omitempty"`
	Priority int    `json:"priority,omitempty"`
	// contains filtered or unexported fields
}

func (*Node) UnmarshalJSON

func (n *Node) UnmarshalJSON(data []byte) error

type Override

type Override struct {
	Scheme         string
	Host           string
	PassHost       string
	UpstreamHost   string
	Timeout        resource.Timeout
	Retries        int
	NextRetry      func(*http.Request) *Override
	HealthReporter pxy.HealthReporter
	HealthTarget   string
	RoundTripper   http.RoundTripper
}

func GetOverride

func GetOverride(r *http.Request) *Override

type Plugin

type Plugin struct {
	base.BasePlugin
	// contains filtered or unexported fields
}

func (*Plugin) Config

func (p *Plugin) Config() any

func (*Plugin) Handler

func (p *Plugin) Handler(next http.Handler) http.Handler

func (*Plugin) Init

func (p *Plugin) Init() error

func (*Plugin) PostInit

func (p *Plugin) PostInit() error

func (*Plugin) SetRuntimeAcquirer

func (p *Plugin) SetRuntimeAcquirer(acquirer RuntimeAcquirer)

SetRuntimeAcquirer supplies the route-owned materializer before PostInit.

func (*Plugin) SetUpstreamResolver

func (p *Plugin) SetUpstreamResolver(resolver ResourceUpstreamResolver)

SetUpstreamResolver supplies the immutable generation's upstream resolver before PostInit.

type ResourceUpstreamResolver

type ResourceUpstreamResolver func(id string) (resource.Upstream, error)

ResourceUpstreamResolver resolves an upstream_id from the route builder's current Store generation before PostInit compiles the weighted targets.

type Rule

type Rule struct {
	Match             []Match            `json:"match,omitempty"`
	WeightedUpstreams []WeightedUpstream `json:"weighted_upstreams,omitempty"`
}

type Runtime

type Runtime struct {
	LoadBalancer pxy.LoadBalancer
	RoundTripper http.RoundTripper
}

Runtime contains the reusable cluster-owned state for one weighted upstream. The route builder materializes it once per route generation.

type RuntimeAcquirer

type RuntimeAcquirer interface {
	Acquire(upstream *Upstream, targets map[string]int, priorities map[string]int) (*Runtime, error)
}

RuntimeAcquirer materializes a weighted upstream through the route-owned cluster registry. It accepts concrete target identities so active probes and passive health use the same keys as request selection.

type Upstream

type Upstream struct {
	Name         string                `json:"name,omitempty"`
	Type         string                `json:"type,omitempty"`
	Scheme       string                `json:"scheme,omitempty"`
	TLS          *resource.UpstreamTLS `json:"tls,omitempty"`
	PassHost     string                `json:"pass_host,omitempty"`
	UpstreamHost string                `json:"upstream_host,omitempty"`
	HashOn       string                `json:"hash_on,omitempty"`
	Key          string                `json:"key,omitempty"`
	Timeout      resource.Timeout      `json:"timeout"`
	Retries      int                   `json:"retries,omitempty"`

	Checks map[string]any `json:"checks,omitempty"`
	Nodes  []Node         `json:"nodes,omitempty"`
	// contains filtered or unexported fields
}

func (Upstream) RetriesConfigured

func (u Upstream) RetriesConfigured() bool

RetriesConfigured reports whether retries was explicitly present, including an explicit zero.

func (*Upstream) UnmarshalJSON

func (u *Upstream) UnmarshalJSON(data []byte) error

type WeightedUpstream

type WeightedUpstream struct {
	UpstreamID string    `json:"upstream_id,omitempty"`
	Upstream   *Upstream `json:"upstream,omitempty"`
	Weight     int       `json:"weight,omitempty"`
	// contains filtered or unexported fields
}

func (*WeightedUpstream) UnmarshalJSON

func (w *WeightedUpstream) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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