proxy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kind                = constant.LLMProxyFilter
	APIKeyPrefix        = "Bearer"
	LLMUnhealthyKey     = "LLMUnhealthy"
	HealthyCheckTimeKey = "HealthyCheckTime"
	// Context key to pass attempt data from proxy to downstream filters
	LLMUpstreamAttemptsKey = "llm_upstream_attempts"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Timeout             time.Duration `yaml:"timeout" json:"timeout,omitempty"`
	MaxIdleConns        int           `yaml:"maxIdleConns" json:"maxIdleConns,omitempty"`
	MaxIdleConnsPerHost int           `yaml:"maxIdleConnsPerHost" json:"maxIdleConnsPerHost,omitempty"`
	MaxConnsPerHost     int           `yaml:"maxConnsPerHost" json:"maxConnsPerHost,omitempty"`
	Scheme              string        `yaml:"scheme" json:"scheme,omitempty" default:"http"`
}

Config describes the top-level configuration for the filter. Note: Strategy-specific configurations are now defined on the endpoints.

type Filter

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

Filter is the processing entity for each request.

func (*Filter) Decode

Decode is the main entry point for processing an incoming request.

type FilterFactory

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

FilterFactory creates filter instances.

func (*FilterFactory) Apply

func (factory *FilterFactory) Apply() error

Apply initializes the factory from its configuration.

func (*FilterFactory) Config

func (factory *FilterFactory) Config() any

Config returns the configuration struct for the factory.

func (*FilterFactory) PrepareFilterChain

func (factory *FilterFactory) PrepareFilterChain(_ *contexthttp.HttpContext, chain filter.FilterChain) error

PrepareFilterChain creates a new Filter instance for a request chain.

type Plugin

type Plugin struct{}

Plugin is the main plugin entrypoint.

func (*Plugin) CreateFilterFactory

func (p *Plugin) CreateFilterFactory() (filter.HttpFilterFactory, error)

CreateFilterFactory creates a new factory instance for this filter.

func (*Plugin) Kind

func (p *Plugin) Kind() string

Kind returns the unique name of this filter.

type RequestExecutor

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

type Strategy

type Strategy struct{}

Strategy is a stateless executor that orchestrates the request lifecycle.

func (*Strategy) Execute

func (s *Strategy) Execute(executor *RequestExecutor) (*http.Response, error)

Execute orchestrates the request lifecycle using dynamic policies from endpoints.

type UpstreamAttempt

type UpstreamAttempt struct {
	EndpointID      string
	EndpointAddress string
	ClusterName     string
	Success         bool
	StatusCode      int
	ErrorType       string // e.g., "network_error", "status_code_error"
}

UpstreamAttempt holds details for a single request attempt to an endpoint.

Jump to

Keyboard shortcuts

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