Documentation
¶
Index ¶
- Constants
- Variables
- func GetPathParameterNames(pathTemplate string) []string
- func MethodAllowed(methods []string, m string) bool
- type APIMetaConfig
- type Adapter
- type Address
- type ApiConfigSource
- type ApiType
- type ArgConfig
- type Bootstrap
- type ClusterConfig
- type CompiledHeader
- type ComputedParameter
- type Config
- type ConfigCenter
- type ConfigSource
- type ConsistentHash
- type ConsistentHashInitFunc
- type CustomHealthCheck
- type DiscoveryType
- type DubboFilter
- type DubboProxyConnectionManagerConfig
- type DynamicResources
- type EdsClusterConfig
- type EncoderConfig
- type Endpoint
- type FilterChain
- type FilterChainMatch
- type GRPCConnectionManagerConfig
- type GrpcConfig
- type GrpcFilter
- type GrpcHealthCheck
- type GrpcService
- type HTTPFilter
- type HeaderMatcher
- type HeaderRoute
- type HeaderValue
- type HeaderValueOption
- type HealthCheckConfig
- type Http
- type HttpConfig
- type HttpConnectionManagerConfig
- type HttpHealthCheck
- type LLMMeta
- type LbConsistentHash
- type LbPolicy
- type LbPolicyType
- type Listener
- type Log
- type MatcherType
- type McpServerConfig
- type Metadata
- type MetadataValue
- type Metric
- type Nacos
- type NacosClientConfig
- type NacosServerConfig
- type NetworkFilter
- type Node
- type PprofConf
- type PromptArgumentConfig
- type PromptConfig
- type PromptMessageConfig
- type ProtocolType
- type RPCStream
- type RPCStreamInfo
- type Registry
- type RegistryConfig
- type RemoteConfig
- type RequestConfig
- type RequestMethod
- type ResourceConfig
- type ResourceSource
- type ResourceTemplateAnnotations
- type ResourceTemplateConfig
- type ResourceTemplateParameter
- type RetryPolicy
- type RetryType
- type RouteAction
- type RouteConfiguration
- type RouteSnapshot
- type Router
- type RouterMatch
- type Sampler
- type SamplingConfig
- type ServerInfo
- type ShutdownConfig
- type SocketAddress
- type StaticResources
- type Status
- type StringMatcher
- type TLSConfig
- type TimeoutConfig
- type ToolConfig
- type TracerConfig
- type Tracing
- type WasmConfig
- type WasmService
Constants ¶
const ( REST_VALUE = "REST" GRPC_VALUE = "GRPC" DUBBO_VALUE = "DUBBO" ISTIOGRPC_VALUE = "ISTIO" )
const (
StandardDubboResolver = "StandardDubboResolver" // standard dubbo resolver
)
Variables ¶
var ( StatusName = map[int32]string{ 0: "Down", 1: "Up", 2: "Unknown", } StatusValue = map[string]int32{ "Down": 0, "Up": 1, "Unknown": 2, } ApiTypeName = map[int32]string{ 0: REST_VALUE, 1: GRPC_VALUE, 2: DUBBO_VALUE, } ApiTypeValue = map[string]int32{ REST_VALUE: 0, GRPC_VALUE: 1, DUBBO_VALUE: 2, ISTIOGRPC_VALUE: 3, } )
var ( // DiscoveryTypeName DiscoveryTypeName = map[DiscoveryType]string{ Static: "Static", StrictDNS: "StrictDNS", LogicalDns: "LogicalDns", EDS: "EDS", OriginalDst: "OriginalDst", } // DiscoveryTypeValue DiscoveryTypeValue = map[string]DiscoveryType{ "Static": Static, "StrictDNS": StrictDNS, "LogicalDns": LogicalDns, "EDS": EDS, "OriginalDst": OriginalDst, } )
var ( // ProtocolTypeName enum seq to protocol type name ProtocolTypeName = map[int32]string{ 0: "HTTP", 1: "TCP", 2: "UDP", 3: "HTTPS", 4: "GRPC", 5: "HTTP2", 6: "TRIPLE", } // ProtocolTypeValue protocol type name to enum seq ProtocolTypeValue = map[string]int32{ "HTTP": 0, "TCP": 1, "UDP": 2, "HTTPS": 3, "GRPC": 4, "HTTP2": 5, "TRIPLE": 6, } )
var ( MatcherTypeName = map[int32]string{ 0: "Exact", 1: "Prefix", 2: "Suffix", 3: "Regex", } MatcherTypeValue = map[string]int32{ "Exact": 0, "Prefix": 1, "Suffix": 2, "Regex": 3, } )
var ConsistentHashInitMap = map[LbPolicyType]ConsistentHashInitFunc{}
ConsistentHashInitMap stores the Init functions for consistent hash load balancing
var LbPolicyTypeValue = map[string]LbPolicyType{ "Rand": LoadBalancerRand, "RoundRobin": LoadBalancerRoundRobin, "RingHashing": LoadBalancerRingHashing, "MaglevHashing": LoadBalancerMaglevHashing, "WeightRandom": LoadBalancerWeightRandom, }
var RequestMethodName = map[int32]string{
0: "METHOD_UNSPECIFIED",
1: "GET",
2: "HEAD",
3: "POST",
4: "PUT",
5: "DELETE",
6: "CONNECT",
7: "OPTIONS",
8: "TRACE",
}
var RequestMethodValue = map[string]int32{
"METHOD_UNSPECIFIED": 0,
"GET": 1,
"HEAD": 2,
"POST": 3,
"PUT": 4,
"DELETE": 5,
"CONNECT": 6,
"OPTIONS": 7,
"TRACE": 8,
}
var RetryTypeValue = map[string]RetryType{ "NoRetry": RetryerNoRetry, "ExponentialBackoff": RetryerExponentialBackoff, "CountBased": RetryerCountBased, }
Functions ¶
func GetPathParameterNames ¶ added in v1.1.0
GetPathParameterNames gets all parameter names in the path template
func MethodAllowed ¶ added in v1.1.0
Types ¶
type APIMetaConfig ¶
type APIMetaConfig struct {
Address string `yaml:"address" json:"address,omitempty"`
APIConfigPath string `default:"/pixiu/config/api" yaml:"api_config_path" json:"api_config_path,omitempty" mapstructure:"api_config_path"`
}
APIMetaConfig how to find api config, file or etcd etc.
type Adapter ¶ added in v1.1.0
type Adapter struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"` // Name the adapter unique name
Enabled string `yaml:"enabled" json:"enabled" default:"true"`
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"` // Config adapter config
}
Adapter the adapter plugin for manage cluster or router
type Address ¶
type Address struct {
SocketAddress SocketAddress `yaml:"socket_address" json:"socket_address" mapstructure:"socket_address"`
Name string `yaml:"name" json:"name" mapstructure:"name"`
}
Address the address
type ApiConfigSource ¶
type ApiConfigSource struct {
APIType ApiType `yaml:"omitempty" json:"omitempty"`
APITypeStr string `yaml:"api_type" json:"api_type" mapstructure:"api_type"`
ClusterName []string `yaml:"cluster_name" json:"cluster_name" mapstructure:"cluster_name"`
RefreshDelay string `yaml:"refresh_delay" json:"refresh_delay" mapstructure:"refresh_delay"`
RequestTimeout string `yaml:"request_timeout" json:"request_timeout" mapstructure:"request_timeout"`
GrpcServices []GrpcService `yaml:"grpc_services" json:"grpc_services" mapstructure:"grpc_services"`
}
ApiConfigSource config the api info. compatible with envoy xDS API
{
"api_type": "...",
"transport_api_version": "...",
"cluster_names": [],
"grpc_services": [],
"refresh_delay": "{...}",
"request_timeout": "{...}",
"rate_limit_settings": "{...}",
"set_node_on_first_message_only": "..."
}
type ArgConfig ¶ added in v1.1.0
type ArgConfig struct {
Name string `yaml:"name" json:"name"`
Type string `yaml:"type" json:"type" default:"string"`
In string `yaml:"in" json:"in"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
Default any `yaml:"default,omitempty" json:"default,omitempty"`
Enum []string `yaml:"enum,omitempty" json:"enum,omitempty"`
}
ArgConfig parameter configuration (simplified)
type Bootstrap ¶
type Bootstrap struct {
StaticResources StaticResources `yaml:"static_resources" json:"static_resources" mapstructure:"static_resources"`
DynamicResources *DynamicResources `yaml:"dynamic_resources" json:"dynamic_resources" mapstructure:"dynamic_resources"`
Metric Metric `yaml:"metric" json:"metric" mapstructure:"metric"`
Node *Node `yaml:"node" json:"node" mapstructure:"node"`
Trace *TracerConfig `yaml:"tracing" json:"tracing" mapstructure:"tracing"`
Wasm *WasmConfig `yaml:"wasm" json:"wasm" mapstructure:"wasm"`
Config *ConfigCenter `yaml:"config-center" json:"config-center" mapstructure:"config-center"`
// Third party dependency
Nacos *Nacos `yaml:"nacos" json:"nacos" mapstructure:"nacos"`
Log *Log `yaml:"log" json:"log" mapstructure:"log"`
}
Bootstrap the door
func (*Bootstrap) GetShutdownConfig ¶ added in v1.1.0
func (bs *Bootstrap) GetShutdownConfig() *ShutdownConfig
GetShutdownConfig
func (*Bootstrap) GetStaticListeners ¶ added in v1.1.0
type ClusterConfig ¶ added in v1.1.0
type ClusterConfig struct {
Name string `yaml:"name" json:"name"` // Name the cluster unique name
TypeStr string `yaml:"type" json:"type"` // Type the cluster discovery type string value
Type DiscoveryType `yaml:"-" json:"-"` // Type the cluster discovery type
EdsClusterConfig EdsClusterConfig `yaml:"eds_cluster_config" json:"eds_cluster_config" mapstructure:"eds_cluster_config"`
LbStr LbPolicyType `yaml:"lb_policy" json:"lb_policy"` // Lb the cluster select node used loadBalance policy
ConsistentHash ConsistentHash `yaml:"consistent" json:"consistent"` // Consistent hash config info
HealthChecks []HealthCheckConfig `yaml:"health_checks" json:"health_checks"`
Endpoints []*Endpoint `yaml:"endpoints" json:"endpoints"`
PrePickEndpointIndex int
}
ClusterConfig a single upstream cluster
func (*ClusterConfig) CreateConsistentHash ¶ added in v1.1.0
func (c *ClusterConfig) CreateConsistentHash()
CreateConsistentHash creates consistent hashing algorithms for Load Balance.
func (*ClusterConfig) GetEndpoint ¶ added in v1.1.0
func (c *ClusterConfig) GetEndpoint(mustHealth bool) []*Endpoint
type CompiledHeader ¶ added in v1.1.0
type ComputedParameter ¶ added in v1.1.0
type ComputedParameter struct {
Name string
Type string
In string
Description string
Required bool
Enum []string
Default any
}
ComputedParameter computed parameter (for internal processing, simplified)
type Config ¶ added in v1.1.0
type Config struct {
Listeners []*Listener `yaml:"listeners" json:"listeners" mapstructure:"listeners"`
Clusters []*ClusterConfig `yaml:"clusters" json:"clusters" mapstructure:"clusters"`
Adapters []*Adapter `yaml:"adapters" json:"adapters" mapstructure:"adapters"`
ShutdownConfig *ShutdownConfig `yaml:"shutdown_config" json:"shutdown_config" mapstructure:"shutdown_config"`
PprofConf PprofConf `yaml:"pprofConf" json:"pprofConf" mapstructure:"pprofConf"`
}
type ConfigCenter ¶ added in v1.1.0
type ConfigSource ¶
type ConfigSource struct {
Path string `yaml:"path" json:"path" mapstructure:"path"`
ApiConfigSource ApiConfigSource `yaml:"api_config_source" json:"api_config_source" mapstructure:"api_config_source"`
}
ConfigSource todo remove un-used
type ConsistentHash ¶ added in v1.1.0
type ConsistentHash struct {
ReplicaNum int `yaml:"replica_num" json:"replica_num"`
MaxVnodeNum int32 `yaml:"max_vnode_num" json:"max_vnode_num"`
MaglevTableSize int `yaml:"maglev_table_size" json:"maglev_table_size"`
Hash LbConsistentHash
}
ConsistentHash methods include: RingHash, MaglevHash
type ConsistentHashInitFunc ¶ added in v1.1.0
type ConsistentHashInitFunc = func(ConsistentHash, []*Endpoint) LbConsistentHash
type CustomHealthCheck ¶
type CustomHealthCheck struct {
HealthCheckConfig
Name string
Config any
}
CustomHealthCheck
type DiscoveryType ¶
type DiscoveryType int32
DiscoveryType
const ( Static DiscoveryType = iota StrictDNS LogicalDns EDS OriginalDst )
type DubboFilter ¶ added in v1.1.0
type DubboFilter struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"`
}
DubboFilter dubbo filter
type DubboProxyConnectionManagerConfig ¶ added in v1.1.0
type DubboProxyConnectionManagerConfig struct {
RouteConfig RouteConfiguration `yaml:"route_config" json:"route_config" mapstructure:"route_config"`
DubboFilters []*DubboFilter `yaml:"dubbo_filters" json:"dubbo_filters" mapstructure:"dubbo_filters"`
TimeoutStr string `yaml:"timeout" json:"timeout" mapstructure:"timeout"`
Timeout time.Duration `yaml:"-" json:"-" mapstructure:"-"`
}
DubboProxyConnectionManagerConfig
type DynamicResources ¶
type DynamicResources struct {
LdsConfig *ApiConfigSource `yaml:"lds_config" json:"lds_config" mapstructure:"lds_config"`
CdsConfig *ApiConfigSource `yaml:"cds_config" json:"cds_config" mapstructure:"cds_config"`
AdsConfig *ApiConfigSource `yaml:"ads_config" json:"ads_config" mapstructure:"ads_config"`
}
DynamicResources config the dynamic resource source
"lds_config": "{...}", # config lister load source
"cds_config": "{...}", # config cluster load source
"ads_config": "{...}"
"ada_config": "{...}" # config adaptor load source
type EdsClusterConfig ¶
type EdsClusterConfig struct {
EdsConfig ConfigSource `yaml:"eds_config" json:"eds_config" mapstructure:"eds_config"`
ServiceName string `yaml:"service_name" json:"service_name" mapstructure:"service_name"`
}
EdsClusterConfig todo remove un-used EdsClusterConfig
type EncoderConfig ¶ added in v1.1.0
type EncoderConfig struct {
MessageKey string `json:"messageKey" yaml:"messageKey"`
LevelKey string `json:"levelKey" yaml:"levelKey"`
TimeKey string `json:"timeKey" yaml:"timeKey"`
NameKey string `json:"nameKey" yaml:"nameKey"`
CallerKey string `json:"callerKey" yaml:"callerKey"`
FunctionKey string `json:"functionKey" yaml:"functionKey"`
StacktraceKey string `json:"stacktraceKey" yaml:"stacktraceKey"`
SkipLineEnding bool `json:"skipLineEnding" yaml:"skipLineEnding"`
LineEnding string `json:"lineEnding" yaml:"lineEnding"`
EncodeLevel string `json:"levelEncoder" yaml:"levelEncoder"`
EncodeTime string `json:"timeEncoder" yaml:"timeEncoder"`
EncodeDuration string `json:"durationEncoder" yaml:"durationEncoder"`
EncodeCaller string `json:"callerEncoder" yaml:"callerEncoder"`
EncodeName string `json:"nameEncoder" yaml:"nameEncoder"`
ConsoleSeparator string `json:"consoleSeparator" yaml:"consoleSeparator"`
}
type Endpoint ¶ added in v1.1.0
type Endpoint struct {
ID string `yaml:"ID" json:"ID"` // ID indicate one endpoint
Name string `yaml:"name" json:"name"` // Name the endpoint unique name
Address SocketAddress `yaml:"socket_address" json:"socket_address" mapstructure:"socket_address"` // Address socket address
Metadata map[string]string `yaml:"meta" json:"meta" mapstructure:"meta"` // Metadata extra info such as label or other meta data
UnHealthy bool
LLMMeta *LLMMeta `yaml:"llm_meta" json:"llm_meta" mapstructure:"llm_meta"` // LLMMeta extra info such as label or other meta data
}
Endpoint
type FilterChain ¶
type FilterChain struct {
Filters []NetworkFilter `yaml:"filters" json:"filters" mapstructure:"filters"`
}
FilterChain filter chain
type FilterChainMatch ¶
type FilterChainMatch struct {
Domains []string `yaml:"domains" json:"domains" mapstructure:"domains"`
}
FilterChainMatch
type GRPCConnectionManagerConfig ¶ added in v1.1.0
type GRPCConnectionManagerConfig struct {
RouteConfig RouteConfiguration `yaml:"route_config" json:"route_config" mapstructure:"route_config"`
GrpcFilters []*GrpcFilter `yaml:"grpc_filters" json:"grpc_filters" mapstructure:"grpc_filters"`
TimeoutStr string `yaml:"timeout" json:"timeout" mapstructure:"timeout"`
Timeout time.Duration `yaml:"-" json:"-" mapstructure:"-"`
}
GRPCConnectionManagerConfig
type GrpcConfig ¶ added in v1.1.0
type GrpcConfig struct {
MaxReceiveMessageSize int `default:"4194304" yaml:"max_receive_message_size" json:"max_receive_message_size" mapstructure:"max_receive_message_size"`
MaxSendMessageSize int `default:"4194304" yaml:"max_send_message_size" json:"max_send_message_size" mapstructure:"max_send_message_size"`
EnableCompression bool `yaml:"enable_compression" json:"enable_compression" mapstructure:"enable_compression"`
IdleTimeout string `yaml:"idle_timeout" json:"idle_timeout" mapstructure:"idle_timeout"`
MaxConnectionAge string `yaml:"max_connection_age" json:"max_connection_age" mapstructure:"max_connection_age"`
EnableTLS bool `yaml:"enable_tls" json:"enable_tls" mapstructure:"enable_tls"`
TLS *TLSConfig `yaml:"tls,omitempty" json:"tls,omitempty" mapstructure:"tls,omitempty"`
}
GrpcConfig gRPC listener specific configuration
func MapInGrpcStruct ¶ added in v1.1.0
func MapInGrpcStruct(cfg any) *GrpcConfig
MapInGrpcStruct maps any config to GrpcConfig struct
type GrpcFilter ¶ added in v1.1.0
type GrpcFilter struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"`
}
GrpcFilter grpc filter
type GrpcHealthCheck ¶
type GrpcHealthCheck struct {
HealthCheckConfig
ServiceName string
Authority string
}
GrpcHealthCheck
type GrpcService ¶ added in v1.1.0
type GrpcService struct {
Timeout string `yaml:"timeout" json:"timeout" mapstructure:"timeout"`
InitialMetadata []HeaderValue `yaml:"initial_metadata" json:"initial_metadata" mapstructure:"initial_metadata"`
}
GrpcService define grpc service context
type HTTPFilter ¶
type HTTPFilter struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"`
}
HTTPFilter http filter
type HeaderMatcher ¶
type HeaderMatcher struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Values []string `yaml:"values" json:"values" mapstructure:"values"`
Regex bool `yaml:"regex" json:"regex" mapstructure:"regex"`
// contains filtered or unexported fields
}
HeaderMatcher include Name header key, Values header value, Regex regex value
func (*HeaderMatcher) MatchValues ¶ added in v1.1.0
func (hm *HeaderMatcher) MatchValues(dst string) bool
MatchValues match values in header, including regex type
func (*HeaderMatcher) SetValueRegex ¶ added in v1.1.0
func (hm *HeaderMatcher) SetValueRegex(regex string) error
SetValueRegex compile the regex, disable regex if it failed
type HeaderRoute ¶ added in v1.1.0
type HeaderRoute struct {
Methods []string
Headers []CompiledHeader
Action RouteAction
}
type HeaderValue ¶
type HeaderValue struct {
Key string `yaml:"key" json:"key" mapstructure:"key"`
Value string `yaml:"value" json:"value" mapstructure:"value"`
}
HeaderValue
type HeaderValueOption ¶
type HeaderValueOption struct {
Header []HeaderValue `yaml:"header" json:"header" mapstructure:"header"`
Append []bool `yaml:"append" json:"append" mapstructure:"append"`
}
HeaderValueOption
type HealthCheckConfig ¶ added in v1.1.0
type HealthCheckConfig struct {
Protocol string `yaml:"protocol" json:"protocol,omitempty" mapstructure:"protocol"`
TimeoutConfig string `yaml:"timeout" json:"timeout,omitempty" mapstructure:"timeout"`
IntervalConfig string `yaml:"interval" json:"interval,omitempty" mapstructure:"interval"`
InitialDelaySeconds string `yaml:"initial_delay_seconds" json:"initial_delay_seconds,omitempty" mapstructure:"initial_delay_seconds"`
HealthyThreshold uint32 `yaml:"healthy_threshold" json:"healthy_threshold,omitempty" mapstructure:"healthy_threshold"`
UnhealthyThreshold uint32 `yaml:"unhealthy_threshold" json:"unhealthy_threshold,omitempty" mapstructure:"unhealthy_threshold"`
ServiceName string `yaml:"service_name" json:"service_name,omitempty" mapstructure:"service_name"`
SessionConfig map[string]any `yaml:"check_config" json:"check_config,omitempty" mapstructure:"check_config"`
CommonCallbacks []string `yaml:"common_callbacks" json:"common_callbacks,omitempty" mapstructure:"common_callbacks"`
}
HealthCheck
type HttpConfig ¶
type HttpConfig struct {
IdleTimeoutStr string `yaml:"idle_timeout" json:"idle_timeout" mapstructure:"idle_timeout"`
ReadTimeoutStr string `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty" mapstructure:"read_timeout"`
WriteTimeoutStr string `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty" mapstructure:"write_timeout"`
MaxHeaderBytes int `json:"max_header_bytes,omitempty" yaml:"max_header_bytes,omitempty" mapstructure:"max_header_bytes"`
}
HttpConfig the http config
func MapInStruct ¶ added in v1.1.0
func MapInStruct(cfg any) *HttpConfig
type HttpConnectionManagerConfig ¶ added in v1.1.0
type HttpConnectionManagerConfig struct {
RouteConfig RouteConfiguration `yaml:"route_config" json:"route_config" mapstructure:"route_config"`
HTTPFilters []*HTTPFilter `yaml:"http_filters" json:"http_filters" mapstructure:"http_filters"`
ServerName string `yaml:"server_name" json:"server_name" mapstructure:"server_name"`
IdleTimeoutStr string `yaml:"idle_timeout" json:"idle_timeout" mapstructure:"idle_timeout"`
GenerateRequestID bool `yaml:"generate_request_id" json:"generate_request_id" mapstructure:"generate_request_id"`
TimeoutStr string `yaml:"timeout" json:"timeout" mapstructure:"timeout"`
Timeout time.Duration `yaml:"-" json:"-" mapstructure:"-"`
}
HttpConnectionManagerConfig
type HttpHealthCheck ¶
type HttpHealthCheck struct {
HealthCheckConfig
Host string
Path string
UseHttp2 bool
ExpectedStatuses int64
}
HttpHealthCheck
type LLMMeta ¶ added in v1.1.0
type LLMMeta struct {
Provider string `yaml:"provider" json:"provider"` // Provider the cluster unique name
APIKey string `yaml:"api_key" json:"api_key" mapstructure:"api_key"` // APIKey the cluster unique name
RetryPolicy RetryPolicy `yaml:"retry_policy" json:"retry_policy" mapstructure:"retry_policy"` // RetryPolicy key
Fallback bool `yaml:"fallback" json:"fallback" mapstructure:"fallback"` // Fallback to the next provider if failed
HealthCheckInterval int64 `yaml:"health_check_interval" json:"health_check_interval" mapstructure:"health_check_interval" default:"5000"` // HealthCheckInterval the interval for health check
}
LLMMeta LLM metadata for llm call
type LbConsistentHash ¶ added in v1.1.0
type LbConsistentHash interface {
Hash(key string) uint32
Add(host string)
Get(key string) (string, error)
GetHash(key uint32) (string, error)
Remove(host string) bool
}
LbConsistentHash supports consistent hash load balancing
type LbPolicyType ¶ added in v1.1.0
type LbPolicyType string
LbPolicyType the load balance policy enum
const ( LoadBalancerRand LbPolicyType = "Rand" LoadBalancerRoundRobin LbPolicyType = "RoundRobin" LoadBalancerRingHashing LbPolicyType = "RingHashing" LoadBalancerMaglevHashing LbPolicyType = "MaglevHashing" LoadBalancerWeightRandom LbPolicyType = "WeightRandom" )
type Listener ¶
type Listener struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Address Address `yaml:"address" json:"address" mapstructure:"address"`
ProtocolStr string `default:"http" yaml:"protocol_type" json:"protocol_type" mapstructure:"protocol_type"`
Protocol ProtocolType `default:"http" yaml:"omitempty" json:"omitempty"`
FilterChain FilterChain `yaml:"filter_chains" json:"filter_chains" mapstructure:"filter_chains"`
Config any `yaml:"config" json:"config" mapstructure:"config"`
}
Listener is a server, listener a port
type Log ¶ added in v1.1.0
type Log struct {
Level string `json:"level" yaml:"level"`
Development bool `json:"development" yaml:"development"`
DisableCaller bool `json:"disableCaller" yaml:"disableCaller"`
DisableStacktrace bool `json:"disableStacktrace" yaml:"disableStacktrace"`
Sampling SamplingConfig `json:"sampling" yaml:"sampling"`
Encoding string `json:"encoding" yaml:"encoding"`
EncoderConfig EncoderConfig `json:"encoderConfig" yaml:"encoderConfig"`
OutputPaths []string `json:"outputPaths" yaml:"outputPaths"`
ErrorOutputPaths []string `json:"errorOutputPaths" yaml:"errorOutputPaths"`
InitialFields map[string]any `json:"initialFields" yaml:"initialFields"`
}
type MatcherType ¶
type MatcherType int32
MatcherType matcher type
const ( Exact MatcherType = 0 + iota Prefix Suffix Regex )
type McpServerConfig ¶ added in v1.1.0
type McpServerConfig struct {
ServerInfo ServerInfo `yaml:"server_info" json:"server_info"`
Endpoint string `yaml:"endpoint" json:"endpoint" default:"/mcp"`
Tools []ToolConfig `yaml:"tools,omitempty" json:"tools,omitempty"`
Resources []ResourceConfig `yaml:"resources,omitempty" json:"resources,omitempty"`
ResourceTemplates []ResourceTemplateConfig `yaml:"resource_templates,omitempty" json:"resource_templates,omitempty"`
Prompts []PromptConfig `yaml:"prompts,omitempty" json:"prompts,omitempty"`
}
McpServerConfig MCP Server Filter configuration
func (*McpServerConfig) DeepCopy ¶ added in v1.1.0
func (config *McpServerConfig) DeepCopy() *McpServerConfig
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
type Metadata ¶
type Metadata struct {
Info map[string]MetadataValue
}
type MetadataValue ¶
type MetadataValue any
type Metric ¶ added in v1.1.0
type Metric struct {
Enable bool `yaml:"enable" json:"enable"`
PrometheusPort int `yaml:"prometheus_port" json:"prometheus_port"`
}
Metirc config for otel metric.
type Nacos ¶ added in v1.1.0
type Nacos struct {
ServerConfigs []*NacosServerConfig `yaml:"server_configs" json:"server-configs" mapstructure:"server_configs"`
ClientConfig *NacosClientConfig `yaml:"client-config" json:"client-config" mapstructure:"client_config"`
DataId string `yaml:"data-id" json:"data-id" mapstructure:"data_id" default:"pixiu.yaml"`
Group string `yaml:"group" json:"group" mapstructure:"group" default:"DEFAULT_GROUP"`
}
type NacosClientConfig ¶ added in v1.1.0
type NacosClientConfig struct {
TimeoutMs uint64 `json:"timeout_ms,omitempty" yaml:"timeout_ms" mapstructure:"timeout_ms"` // timeout for requesting Nacos server, default value is 10000ms
ListenInterval uint64 `json:"listen_interval,omitempty" yaml:"listen_interval" mapstructure:"listen_interval"` // Deprecated
BeatInterval int64 `json:"beat_interval,omitempty" yaml:"beat_interval" mapstructure:"beat_interval"` // the time interval for sending beat to server,default value is 5000ms
NamespaceId string `json:"namespace_id,omitempty" yaml:"namespace_id" mapstructure:"namespace_id"` // the namespaceId of Nacos.When namespace is public, fill in the blank string here.
AppName string `json:"app_name,omitempty" yaml:"app_name" mapstructure:"app_name"` // the appName
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint" mapstructure:"endpoint"` // the endpoint for get Nacos server addresses
RegionId string `json:"region_id,omitempty" yaml:"region_id" mapstructure:"region_id"` // the regionId for kms
AccessKey string `json:"access_key,omitempty" yaml:"access_key" mapstructure:"access_key"` // the AccessKey for kms
SecretKey string `json:"secret_key,omitempty" yaml:"secret_key" mapstructure:"secret_key"` // the SecretKey for kms
OpenKMS bool `json:"open_kms,omitempty" yaml:"open_kms" mapstructure:"open_kms"` // it's to open kms,default is false. https://help.aliyun.com/product/28933.html
CacheDir string `json:"cache_dir,omitempty" yaml:"cache_dir" mapstructure:"cache_dir" default:"/tmp/nacos/cache"` // the directory for persist nacos service info,default value is current path
UpdateThreadNum int `json:"update_thread_num,omitempty" yaml:"update_thread_num" mapstructure:"update_thread_num"` // the number of gorutine for update nacos service info,default value is 20
NotLoadCacheAtStart bool `json:"not_load_cache_at_start,omitempty" yaml:"not_load_cache_at_start" mapstructure:"not_load_cache_at_start"` // not to load persistent nacos service info in CacheDir at start time
UpdateCacheWhenEmpty bool `json:"update_cache_when_empty,omitempty" yaml:"update_cache_when_empty" mapstructure:"update_cache_when_empty"` // update cache when get empty service instance from server
Username string `json:"username,omitempty" yaml:"username" mapstructure:"username"` // the username for nacos auth
Password string `json:"password,omitempty" yaml:"password" mapstructure:"password"` // the password for nacos auth
LogDir string `json:"log_dir,omitempty" yaml:"log_dir" mapstructure:"log_dir" default:"/tmp/nacos/log"` // the directory for log, default is current path
LogLevel string `json:"log_level,omitempty" yaml:"log_level" mapstructure:"log_level"` // the level of log, it's must be debug,info,warn,error, default value is info
//LogSampling *ClientLogSamplingConfig // the sampling config of log
ContextPath string `json:"context_path,omitempty" yaml:"context_path" mapstructure:"context_path"` // the nacos server contextpath
}
type NacosServerConfig ¶ added in v1.1.0
type NacosServerConfig struct {
IpAddr string `json:"ip_addr,omitempty" yaml:"ip_addr" mapstructure:"ip_addr"`
Port uint64 `json:"port,omitempty" yaml:"port" mapstructure:"port"`
Scheme string `json:"scheme" yaml:"scheme" mapstructure:"scheme"`
ContextPath string `json:"contextPath" yaml:"contextPath" mapstructure:"contextPath"`
}
type NetworkFilter ¶ added in v1.1.0
type NetworkFilter struct {
Name string `yaml:"name" json:"name" mapstructure:"name"` // Name filter name unique
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"` // Config filter config
}
NetworkFilter core struct, filter is extend by user
type Node ¶ added in v1.1.0
type Node struct {
Cluster string `yaml:"cluster" json:"cluster" mapstructure:"cluster"`
Id string `yaml:"id" json:"id" mapstructure:"id"`
}
Node node info for dynamic identifier
type PromptArgumentConfig ¶ added in v1.1.0
type PromptArgumentConfig struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
}
PromptArgumentConfig prompt argument configuration
type PromptConfig ¶ added in v1.1.0
type PromptConfig struct {
Name string `yaml:"name" json:"name"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Arguments []PromptArgumentConfig `yaml:"arguments,omitempty" json:"arguments,omitempty"`
Messages []PromptMessageConfig `yaml:"messages" json:"messages"`
}
PromptConfig prompt configuration
func (*PromptConfig) DeepCopy ¶ added in v1.1.0
func (config *PromptConfig) DeepCopy() *PromptConfig
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
type PromptMessageConfig ¶ added in v1.1.0
type PromptMessageConfig struct {
Role string `yaml:"role" json:"role"` // "user" or "assistant"
Content string `yaml:"content" json:"content"`
}
PromptMessageConfig prompt message configuration
type ProtocolType ¶
type ProtocolType int32
ProtocolType protocol type enum
const ( ProtocolTypeHTTP ProtocolType = 0 + iota // support for 1.0 ProtocolTypeTCP ProtocolTypeUDP ProtocolTypeHTTPS ProtocolTypeGRPC ProtocolTypeHTTP2 ProtocolTypeTriple )
type RPCStreamInfo ¶ added in v1.1.0
RPCStreamInfo contains information about the RPC stream
type Registry ¶
type Registry struct {
Protocol string `default:"zookeeper" yaml:"protocol" json:"protocol"`
Timeout string `yaml:"timeout" json:"timeout"`
Address string `yaml:"address" json:"address"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
Group string `default:"DEFAULT_GROUP" yaml:"group" json:"group"`
Namespace string `yaml:"namespace" json:"namespace"`
RegistryType string `default:"interface" yaml:"registry_type" json:"registry_type"` // "application", "interface"
}
Registry remote registry where dubbo apis are registered. Here comes a problem, dubbo protocol proxy does not use the same registry as pixiu, so any modification to the config, should apply to both `pkg/client/dubbo/dubbo.go` and `pkg\adapter\dubboregistry\registry`
type RegistryConfig ¶ added in v1.1.0
type RegistryConfig struct {
ToolConfigs map[string]ToolConfig `yaml:"toolConfigs"`
ResourceConfigs map[string]ResourceConfig `yaml:"resourceConfigs"`
PromptConfigs map[string]PromptConfig `yaml:"promptConfigs"`
LastUpdated time.Time `yaml:"lastUpdated"`
}
RegistryConfig registry configuration
type RemoteConfig ¶ added in v1.1.0
type RemoteConfig struct {
Protocol string `yaml:"protocol" json:"protocol" default:"zookeeper"`
Timeout string `yaml:"timeout" json:"timeout" default:"10s"`
Address string `yaml:"address" json:"address"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
Group string `yaml:"group" json:"group"`
Root string `yaml:"root" json:"root" default:"/services"`
}
RemoteConfig remote server info which offer server discovery or k/v or distribution function
type RequestConfig ¶ added in v1.1.0
type RequestConfig struct {
Method string `yaml:"method" json:"method" default:"GET"`
Path string `yaml:"path" json:"path"`
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
Timeout string `yaml:"timeout,omitempty" json:"timeout,omitempty" default:"30s"`
}
RequestConfig request configuration
func (*RequestConfig) DeepCopy ¶ added in v1.1.0
func (config *RequestConfig) DeepCopy() *RequestConfig
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
type RequestMethod ¶
type RequestMethod int32
const ( METHOD_UNSPECIFIED RequestMethod = 0 + iota GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE )
type ResourceConfig ¶ added in v1.1.0
type ResourceConfig struct {
Name string `yaml:"name" json:"name"`
URI string `yaml:"uri" json:"uri"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
MIMEType string `yaml:"mime_type,omitempty" json:"mime_type,omitempty"`
Source ResourceSource `yaml:"source" json:"source"`
}
ResourceConfig resource configuration
type ResourceSource ¶ added in v1.1.0
type ResourceSource struct {
Type string `yaml:"type" json:"type"`
Path string `yaml:"path,omitempty" json:"path,omitempty"` // for file type
URL string `yaml:"url,omitempty" json:"url,omitempty"` // for url type
Content string `yaml:"content,omitempty" json:"content,omitempty"` // for inline type
Template string `yaml:"template,omitempty" json:"template,omitempty"` // for template type
}
ResourceSource resource source configuration (simplified)
type ResourceTemplateAnnotations ¶ added in v1.1.0
type ResourceTemplateAnnotations struct {
Audience []string `yaml:"audience,omitempty" json:"audience,omitempty"`
Priority *float64 `yaml:"priority,omitempty" json:"priority,omitempty"`
LastModified string `yaml:"last_modified,omitempty" json:"last_modified,omitempty"`
}
ResourceTemplateAnnotations resource template annotations
func (*ResourceTemplateAnnotations) DeepCopy ¶ added in v1.1.0
func (ann *ResourceTemplateAnnotations) DeepCopy() *ResourceTemplateAnnotations
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
type ResourceTemplateConfig ¶ added in v1.1.0
type ResourceTemplateConfig struct {
Name string `yaml:"name" json:"name"`
URITemplate string `yaml:"uri_template" json:"uri_template"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
MIMEType string `yaml:"mime_type,omitempty" json:"mime_type,omitempty"`
Parameters []ResourceTemplateParameter `yaml:"parameters,omitempty" json:"parameters,omitempty"`
Annotations *ResourceTemplateAnnotations `yaml:"annotations,omitempty" json:"annotations,omitempty"`
}
ResourceTemplateConfig resource template configuration
func (*ResourceTemplateConfig) DeepCopy ¶ added in v1.1.0
func (config *ResourceTemplateConfig) DeepCopy() *ResourceTemplateConfig
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
type ResourceTemplateParameter ¶ added in v1.1.0
type ResourceTemplateParameter struct {
Name string `yaml:"name" json:"name"`
Type string `yaml:"type" json:"type" default:"string"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Required bool `yaml:"required,omitempty" json:"required,omitempty" default:"false"`
Enum []string `yaml:"enum,omitempty" json:"enum,omitempty"`
Default any `yaml:"default,omitempty" json:"default,omitempty"`
}
ResourceTemplateParameter resource template parameter
func (*ResourceTemplateParameter) DeepCopy ¶ added in v1.1.0
func (param *ResourceTemplateParameter) DeepCopy() *ResourceTemplateParameter
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
type RetryPolicy ¶ added in v1.1.0
type RetryPolicy struct {
Name RetryType `mapstructure:"name" default:"NoRetry"`
Config map[string]any `mapstructure:"config"`
}
RetryPolicy holds the raw configuration for a policy from the endpoint metadata.
type RouteAction ¶
type RouteAction struct {
Cluster string `yaml:"cluster" json:"cluster" mapstructure:"cluster"`
ClusterNotFoundResponseCode int `yaml:"cluster_not_found_response_code" json:"cluster_not_found_response_code" mapstructure:"cluster_not_found_response_code"`
}
RouteAction match route should do
type RouteConfiguration ¶
type RouteConfiguration struct {
RouteTrie trie.Trie `yaml:"-" json:"-" mapstructure:"-"`
Routes []*Router `yaml:"routes" json:"routes" mapstructure:"routes"`
Dynamic bool `yaml:"dynamic" json:"dynamic" mapstructure:"dynamic"`
}
RouteConfiguration
func (*RouteConfiguration) Route ¶ added in v1.1.0
func (rc *RouteConfiguration) Route(req *stdHttp.Request) (*RouteAction, error)
func (*RouteConfiguration) RouteByPathAndMethod ¶ added in v1.1.0
func (rc *RouteConfiguration) RouteByPathAndMethod(path, method string) (*RouteAction, error)
type RouteSnapshot ¶ added in v1.1.0
type RouteSnapshot struct {
// multi-trie for each method, built once and read-only
MethodTries map[string]*trie.Trie
// precompiled regex for header-only routes
HeaderOnly []HeaderRoute
}
RouteSnapshot Read-only snapshot for routing
func ToSnapshot ¶ added in v1.1.0
func ToSnapshot(routes []*Router) *RouteSnapshot
type Router ¶
type Router struct {
ID string `yaml:"id" json:"id" mapstructure:"id"`
Match RouterMatch `yaml:"match" json:"match" mapstructure:"match"`
Route RouteAction `yaml:"route" json:"route" mapstructure:"route"`
}
Router struct
type RouterMatch ¶
type RouterMatch struct {
Prefix string `yaml:"prefix" json:"prefix" mapstructure:"prefix"`
Path string `yaml:"path" json:"path" mapstructure:"path"`
// Regex string `yaml:"regex" json:"regex" mapstructure:"regex"` TODO: next version
Methods []string `yaml:"methods" json:"methods" mapstructure:"methods"`
Headers []HeaderMatcher `yaml:"headers,omitempty" json:"headers,omitempty" mapstructure:"headers"`
}
RouterMatch
func NewRouterMatchPrefix ¶ added in v1.1.0
func NewRouterMatchPrefix(name string) RouterMatch
func (*RouterMatch) MatchHeader ¶ added in v1.1.0
func (rm *RouterMatch) MatchHeader(req *stdHttp.Request) bool
MatchHeader used when there are only headers to match
type Sampler ¶ added in v1.1.0
type Sampler struct {
Type string `yaml:"type" json:"type" mapstructure:"type"`
Param float64 `yaml:"param" json:"param" mapstructure:"param"`
}
Sampler policy
type SamplingConfig ¶ added in v1.1.0
type ServerInfo ¶ added in v1.1.0
type ServerInfo struct {
Name string `yaml:"name" json:"name" default:"Pixiu MCP Server"`
Version string `yaml:"version" json:"version" default:"1.0.0"`
Description string `yaml:"description,omitempty" json:"description,omitempty" default:"MCP Server powered by Apache Dubbo-go-pixiu"`
Instructions string `` /* 127-byte string literal not displayed */
}
ServerInfo server information
type ShutdownConfig ¶
type ShutdownConfig struct {
Timeout string `default:"0s" yaml:"timeout" json:"timeout,omitempty"`
StepTimeout string `default:"0s" yaml:"step_timeout" json:"step_timeout,omitempty"`
RejectPolicy string `default:"immediacy" yaml:"reject_policy" json:"reject_policy,omitempty"`
}
ShutdownConfig how to shutdown server.
func (*ShutdownConfig) GetTimeout ¶ added in v1.1.0
func (sdc *ShutdownConfig) GetTimeout() time.Duration
GetTimeoutOfShutdown
type SocketAddress ¶
type SocketAddress struct {
Address string `default:"0.0.0.0" yaml:"address" json:"address" mapstructure:"address"`
Port int `default:"8881" yaml:"port" json:"port" mapstructure:"port"`
ResolverName string `yaml:"resolver_name" json:"resolver_name" mapstructure:"resolver_name"`
Domains []string `yaml:"domains" json:"domains" mapstructure:"domains"`
CertsDir string `yaml:"certs_dir" json:"certs_dir" mapstructure:"certs_dir"`
}
SocketAddress specify either a logical or physical address and port, which are used to tell server where to bind/listen, connect to upstream and find management servers
func (SocketAddress) GetAddress ¶ added in v1.1.0
func (a SocketAddress) GetAddress() string
type StaticResources ¶
type StaticResources struct {
Listeners []*Listener `yaml:"listeners" json:"listeners" mapstructure:"listeners"`
Clusters []*ClusterConfig `yaml:"clusters" json:"clusters" mapstructure:"clusters"`
Adapters []*Adapter `yaml:"adapters" json:"adapters" mapstructure:"adapters"`
ShutdownConfig *ShutdownConfig `yaml:"shutdown_config" json:"shutdown_config" mapstructure:"shutdown_config"`
PprofConf PprofConf `yaml:"pprofConf" json:"pprofConf" mapstructure:"pprofConf"`
}
StaticResources
type TLSConfig ¶ added in v1.1.0
type TLSConfig struct {
CertFile string `yaml:"cert_file" json:"cert_file" mapstructure:"cert_file"`
KeyFile string `yaml:"key_file" json:"key_file" mapstructure:"key_file"`
}
TLSConfig TLS configuration for gRPC (optional)
type TimeoutConfig ¶ added in v1.1.0
type TimeoutConfig struct {
ConnectTimeoutStr string `default:"5s" yaml:"connect_timeout" json:"connect_timeout,omitempty"` // ConnectTimeout timeout for connect to cluster node
RequestTimeoutStr string `default:"10s" yaml:"request_timeout" json:"request_timeout,omitempty"`
}
TimeoutConfig the config of ConnectTimeout and RequestTimeout
type ToolConfig ¶ added in v1.1.0
type ToolConfig struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Cluster string `yaml:"cluster" json:"cluster"`
BackendURL string `yaml:"backend_url,omitempty" json:"backend_url,omitempty"`
Request RequestConfig `yaml:"request" json:"request"`
Args []ArgConfig `yaml:"args,omitempty" json:"args,omitempty"`
}
ToolConfig tool configuration
func (*ToolConfig) DeepCopy ¶ added in v1.1.0
func (toolConfig *ToolConfig) DeepCopy() *ToolConfig
DeepCopy returns a new independent copy of Config Deep copy slices/maps to avoid sharing pointers with the factory
func (*ToolConfig) GetAllParameters ¶ added in v1.1.0
func (tc *ToolConfig) GetAllParameters() ([]ComputedParameter, error)
GetAllParameters gets all parameters of the tool
type TracerConfig ¶ added in v1.1.0
type TracerConfig struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
ServiceName string `yaml:"serviceName" json:"serviceName" mapstructure:"serviceName"`
Sampler Sampler `yaml:"sampler" json:"sampler" mapstructure:"sampler"`
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"`
}
TracerConfig inclueds detail information about the exporter
type Tracing ¶
type Tracing struct {
Http Http `yaml:"http" json:"http,omitempty"`
URL string `yaml:"url" json:"url,omitempty"`
Type string `yaml:"type" json:"type,omitempty"`
}
Tracing
type WasmConfig ¶ added in v1.1.0
type WasmConfig struct {
Services []WasmService `yaml:"services" json:"services" mapstructure:"services"`
}
WasmConfig contains all services' config.
type WasmService ¶ added in v1.1.0
type WasmService struct {
Name string `yaml:"name" json:"name" mapstructure:"name"`
Config map[string]any `yaml:"config" json:"config" mapstructure:"config"`
}
WasmService includes all information about the specific application.