Documentation ¶
Index ¶
- func SetContextWithHeaderConfig(ctx context.Context, config *RouterService) context.Context
- func SetContextWithRouterConfig(ctx context.Context, config *RouterConfig) context.Context
- type CacheConfig
- type PriorityRouter
- type RetryConfig
- type RoundRobinRouter
- type RouterConfig
- type RouterConfigContextKey
- type RouterIterator
- type RouterService
- type RouterServiceContextKey
- type Strategy
- type StrategyConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetContextWithHeaderConfig ¶
func SetContextWithHeaderConfig(ctx context.Context, config *RouterService) context.Context
func SetContextWithRouterConfig ¶
func SetContextWithRouterConfig(ctx context.Context, config *RouterConfig) context.Context
Types ¶
type CacheConfig ¶
type PriorityRouter ¶
type PriorityRouter struct {
// contains filtered or unexported fields
}
func NewPriorityRouter ¶
func NewPriorityRouter(providers []RouterConfig) *PriorityRouter
func (*PriorityRouter) Next ¶
func (r *PriorityRouter) Next() (*RouterConfig, error)
type RetryConfig ¶
type RetryConfig struct { // Number is the number of times to retry the request when a retryable Numbers int32 `json:"numbers" default:"1"` // RetryOnStatusCodes is a flat list of http response status codes that are // eligible for retry. This again should be feasible in any reasonable proxy. OnStatusCodes []uint32 `json:"on_status_codes" default:"[]"` }
type RoundRobinRouter ¶
type RoundRobinRouter struct {
// contains filtered or unexported fields
}
func (*RoundRobinRouter) Iterator ¶
func (r *RoundRobinRouter) Iterator() RouterIterator
func (*RoundRobinRouter) Next ¶
func (r *RoundRobinRouter) Next() *RouterConfig
type RouterConfig ¶
type RouterConfig struct { Name string `json:"name"` Auth map[string]any `json:"auth"` VirtualKey string `json:"virtual_key"` Retry RetryConfig `json:"retry"` Cache CacheConfig `json:"cache"` Strategy StrategyConfig `json:"strategy"` Targets []RouterConfig `json:"targets"` Metadata map[string]any `json:"metadata"` }
func GetContextWithRouterConfig ¶
func GetContextWithRouterConfig(ctx context.Context) *RouterConfig
func NewRouterConfig ¶
func NewRouterConfig(config string, headers http.Header) (*RouterConfig, error)
type RouterConfigContextKey ¶
type RouterConfigContextKey struct{}
type RouterIterator ¶
type RouterIterator interface {
Next() *RouterConfig
}
func NewRoundRobinRouter ¶
func NewRoundRobinRouter(providers []RouterConfig) RouterIterator
func NewRouterService ¶
func NewRouterService(root *RouterConfig) RouterIterator
type RouterService ¶
type RouterService struct {
// contains filtered or unexported fields
}
func GetContextWithHeaderConfig ¶
func GetContextWithHeaderConfig(ctx context.Context) *RouterService
func (*RouterService) HasNext ¶
func (rc *RouterService) HasNext() bool
func (*RouterService) Iterator ¶
func (rc *RouterService) Iterator() RouterIterator
func (*RouterService) Next ¶
func (rc *RouterService) Next() *RouterConfig
type RouterServiceContextKey ¶
type RouterServiceContextKey struct{}
type Strategy ¶
type Strategy string
const (
Priority Strategy = "priority"
)
const (
RoundRobin Strategy = "roundrobin"
)
type StrategyConfig ¶
type StrategyConfig struct {
Mode string `json:"mode"`
}
Click to show internal directories.
Click to hide internal directories.