Documentation ¶
Index ¶
- Constants
- Variables
- type AbortInject
- type AccessLog
- type ApplicationInfo
- type CidrRange
- type CircuitBreakers
- type Cluster
- type ClusterSpecInfo
- type ClusterType
- type ClusterWeight
- type ClusterWeightConfig
- type Decorator
- type DelayInject
- type DelayInjectConfig
- type DirectResponseAction
- type DurationConfig
- type FaultInject
- type FaultInjectConfig
- type Filter
- type FilterChain
- type FilterChainConfig
- type HeaderMatcher
- type HeaderValue
- type HeaderValueOption
- type HealthCheck
- type HealthCheckConfig
- type HealthCheckFilter
- type HealthCheckFilterConfig
- type Host
- type HostConfig
- type LBSubsetConfig
- type LbMeta
- type LbType
- type Listener
- type ListenerConfig
- type ListenerType
- type Metadata
- type MetadataConfig
- type Mixer
- type Proxy
- type PublishContent
- type PublishInfo
- type RetryPolicy
- type RetryPolicyConfig
- type RouteAction
- type Router
- type RouterActionConfig
- type RouterConfig
- type RouterConfiguration
- type RouterConfigurationConfig
- type RouterMatch
- type SdsConfig
- type SecretConfigWrapper
- type ServerConfig
- type ServiceRegistryInfo
- type StatsMatcher
- type StreamFaultInject
- type StreamPayloadLimit
- type SubscribeSpec
- type TCPProxy
- type TCPRoute
- type TCPRouteConfig
- type TLSConfig
- type Thresholds
- type VirtualHost
- type WebSocketProxy
- type WeightedCluster
- type XProxyExtendConfig
Constants ¶
const ( CONNECTION_MANAGER = "connection_manager" DEFAULT_NETWORK_FILTER = "proxy" TCP_PROXY = "tcp_proxy" FAULT_INJECT_NETWORK_FILTER = "fault_inject" RPC_PROXY = "rpc_proxy" X_PROXY = "x_proxy" )
Network Filter's Type
const ( MIXER = "mixer" FaultStream = "fault" PayloadLimit = "payload_limit" )
Stream Filter's Type
Variables ¶
var ErrDuplicateStaticAndDynamic = errors.New("only one of static config or dynamic config should be exists")
var ErrDuplicateTLSConfig = errors.New("tls_context and tls_context_set can only exists one at the same time")
Functions ¶
This section is empty.
Types ¶
type AbortInject ¶
type AccessLog ¶
type AccessLog struct { Path string `json:"log_path,omitempty"` Format string `json:"log_format,omitempty"` }
AccessLog for making up access log
type ApplicationInfo ¶
type ApplicationInfo struct { DataCenter string `json:"data_center,omitempty"` AppName string `json:"app_name,omitempty"` Zone string `json:"zone,omitempty"` DeployMode bool `json:"deploy_mode,omitempty"` MasterSystem bool `json:"master_system,omitempty"` CloudName string `json:"cloud_name,omitempty"` HostMachine string `json:"host_machine,omitempty"` }
type CircuitBreakers ¶
type CircuitBreakers struct {
Thresholds []Thresholds
}
CircuitBreakers is a configuration of circuit breakers CircuitBreakers implements json.Marshaler and json.Unmarshaler
func (CircuitBreakers) MarshalJSON ¶
func (cb CircuitBreakers) MarshalJSON() (b []byte, err error)
CircuitBreakers's implements json.Marshaler and json.Unmarshaler
func (*CircuitBreakers) UnmarshalJSON ¶
func (cb *CircuitBreakers) UnmarshalJSON(b []byte) (err error)
type Cluster ¶
type Cluster struct { Name string `json:"name,omitempty"` ClusterType ClusterType `json:"type,omitempty"` SubType string `json:"sub_type,omitempty"` //not used yet LbType LbType `json:"lb_type,omitempty"` MaxRequestPerConn uint32 `json:"max_request_per_conn,omitempty"` ConnBufferLimitBytes uint32 `json:"conn_buffer_limit_bytes,omitempty"` CirBreThresholds CircuitBreakers `json:"circuit_breakers,omitempty"` HealthCheck HealthCheck `json:"health_check,omitempty"` Spec ClusterSpecInfo `json:"spec,omitempty"` LBSubSetConfig LBSubsetConfig `json:"lb_subset_config,omitempty"` TLS TLSConfig `json:"tls_context,omitempty"` Hosts []Host `json:"hosts,omitempty"` ConnectTimeout *DurationConfig `json:"connect_timeout,omitempty"` }
Cluster represents a cluster's information
type ClusterSpecInfo ¶
type ClusterSpecInfo struct {
Subscribes []SubscribeSpec `json:"subscribe,omitempty"`
}
ClusterSpecInfo is a configuration of subscribe
type ClusterType ¶
type ClusterType string
ClusterType
const ( STATIC_CLUSTER ClusterType = "STATIC" SIMPLE_CLUSTER ClusterType = "SIMPLE" DYNAMIC_CLUSTER ClusterType = "DYNAMIC" EDS_CLUSTER ClusterType = "EDS" )
Group of cluster type
type ClusterWeight ¶
type ClusterWeight struct { ClusterWeightConfig MetadataMatch Metadata `json:"-"` }
ClusterWeight. clusters along with weights that indicate the percentage of traffic to be forwarded to each cluster
func (ClusterWeight) MarshalJSON ¶
func (cw ClusterWeight) MarshalJSON() (b []byte, err error)
func (*ClusterWeight) UnmarshalJSON ¶
func (cw *ClusterWeight) UnmarshalJSON(b []byte) error
type ClusterWeightConfig ¶
type ClusterWeightConfig struct { Name string `json:"name,omitempty"` Weight uint32 `json:"weight,omitempty"` MetadataConfig *MetadataConfig `json:"metadata_match,omitempty"` }
type DelayInject ¶
type DelayInject struct { DelayInjectConfig Delay time.Duration `json:"-"` }
func (DelayInject) Marshal ¶
func (d DelayInject) Marshal() (b []byte, err error)
func (*DelayInject) UnmarshalJSON ¶
func (d *DelayInject) UnmarshalJSON(b []byte) error
type DelayInjectConfig ¶
type DelayInjectConfig struct { Percent uint32 `json:"percentage,omitempty"` DelayDurationConfig DurationConfig `json:"fixed_delay,omitempty"` }
type DirectResponseAction ¶
type DirectResponseAction struct { StatusCode int `json:"status,omitempty"` Body string `json:"body,omitempty"` }
DirectResponseAction represents the direct response parameters
type DurationConfig ¶
DurationConfig ia a wrapper for time.Duration, so time config can be written in '300ms' or '1h' format
func (DurationConfig) MarshalJSON ¶
func (d DurationConfig) MarshalJSON() (b []byte, err error)
MarshalJSON
func (*DurationConfig) UnmarshalJSON ¶
func (d *DurationConfig) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON get DurationConfig.Duration from json file
type FaultInject ¶
type FaultInject struct { FaultInjectConfig DelayDuration uint64 `json:"-"` }
FaultInject
func (FaultInject) Marshal ¶
func (f FaultInject) Marshal() (b []byte, err error)
func (*FaultInject) UnmarshalJSON ¶
func (f *FaultInject) UnmarshalJSON(b []byte) error
type FaultInjectConfig ¶
type FaultInjectConfig struct { DelayPercent uint32 `json:"delay_percent,omitempty"` DelayDurationConfig DurationConfig `json:"delay_duration,omitempty"` }
type Filter ¶
type Filter struct { Type string `json:"type,omitempty"` Config map[string]interface{} `json:"config,omitempty"` }
Filter is a config to make up a filter
type FilterChain ¶
type FilterChain struct { FilterChainConfig TLSContexts []TLSConfig `json:"-"` }
FilterChain wraps a set of match criteria, an option TLS context, a set of filters, and various other parameters.
func (FilterChain) MarshalJSON ¶
func (fc FilterChain) MarshalJSON() (b []byte, err error)
func (*FilterChain) UnmarshalJSON ¶
func (fc *FilterChain) UnmarshalJSON(b []byte) error
type FilterChainConfig ¶
type HeaderMatcher ¶
type HeaderMatcher struct { Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` Regex bool `json:"regex,omitempty"` }
HeaderMatcher specifies a set of headers that the route should match on.
type HeaderValue ¶
HeaderValue is header name/value pair.
type HeaderValueOption ¶
type HeaderValueOption struct { Header *HeaderValue `json:"header,omitempty"` Append *bool `json:"append,omitempty"` }
HeaderValueOption is header name/value pair plus option to control append behavior.
type HealthCheck ¶
type HealthCheck struct { HealthCheckConfig Timeout time.Duration `json:"-"` Interval time.Duration `json:"-"` IntervalJitter time.Duration `json:"-"` }
HealthCheck is a configuration of health check use DurationConfig to parse string to time.Duration
func (HealthCheck) MarshalJSON ¶
func (hc HealthCheck) MarshalJSON() (b []byte, err error)
Marshal implement a json.Marshaler
func (*HealthCheck) UnmarshalJSON ¶
func (hc *HealthCheck) UnmarshalJSON(b []byte) error
type HealthCheckConfig ¶
type HealthCheckConfig struct { Protocol string `json:"protocol,omitempty"` TimeoutConfig DurationConfig `json:"timeout,omitempty"` IntervalConfig DurationConfig `json:"interval,omitempty"` IntervalJitterConfig DurationConfig `json:"interval_jitter,omitempty"` HealthyThreshold uint32 `json:"healthy_threshold,omitempty"` UnhealthyThreshold uint32 `json:"unhealthy_threshold,omitempty"` ServiceName string `json:"service_name,omitempty"` SessionConfig map[string]interface{} `json:"check_config,omitempty"` CommonCallbacks []string `json:"common_callbacks,omitempty"` // HealthCheck support register some common callbacks that are not related to specific cluster }
type HealthCheckFilter ¶
type HealthCheckFilter struct { HealthCheckFilterConfig CacheTime time.Duration `json:"-"` }
HealthCheckFilter
func (HealthCheckFilter) MarshalJSON ¶
func (hf HealthCheckFilter) MarshalJSON() (b []byte, err error)
func (*HealthCheckFilter) UnmarshalJSON ¶
func (hf *HealthCheckFilter) UnmarshalJSON(b []byte) error
type HealthCheckFilterConfig ¶
type HealthCheckFilterConfig struct { PassThrough bool `json:"passthrough,omitempty"` CacheTimeConfig DurationConfig `json:"cache_time,omitempty"` Endpoint string `json:"endpoint,omitempty"` ClusterMinHealthyPercentage map[string]float32 `json:"cluster_min_healthy_percentages,omitempty"` }
type Host ¶
type Host struct { HostConfig MetaData Metadata `json:"-"` }
Host represenets a host information
func (Host) MarshalJSON ¶
func (*Host) UnmarshalJSON ¶
type HostConfig ¶
type HostConfig struct { Address string `json:"address,omitempty"` Hostname string `json:"hostname,omitempty"` Weight uint32 `json:"weight,omitempty"` MetaDataConfig *MetadataConfig `json:"metadata,omitempty"` TLSDisable bool `json:"tls_disable,omitempty"` }
type LBSubsetConfig ¶
type LBSubsetConfig struct { FallBackPolicy uint8 `json:"fall_back_policy,omitempty"` DefaultSubset map[string]string `json:"default_subset,omitempty"` SubsetSelectors [][]string `json:"subset_selectors,omitempty"` }
LBSubsetConfig is a configuration of load balance subset
type Listener ¶
type Listener struct { ListenerConfig Addr net.Addr `json:"-"` ListenerTag uint64 `json:"-"` ListenerScope string `json:"-"` PerConnBufferLimitBytes uint32 `json:"-"` // do not support config InheritListener *net.TCPListener `json:"-"` Remain bool `json:"-"` }
Listener contains the listener's information
type ListenerConfig ¶
type ListenerConfig struct { Name string `json:"name,omitempty"` Type ListenerType `json:"type,omitempty"` AddrConfig string `json:"address,omitempty"` BindToPort bool `json:"bind_port,omitempty"` UseOriginalDst bool `json:"use_original_dst,omitempty"` AccessLogs []AccessLog `json:"access_logs,omitempty"` FilterChains []FilterChain `json:"filter_chains,omitempty"` // only one filterchains at this time StreamFilters []Filter `json:"stream_filters,omitempty"` Inspector bool `json:"inspector,omitempty"` ConnectionIdleTimeout *DurationConfig `json:"connection_idle_timeout,omitempty"` }
type ListenerType ¶
type ListenerType string
ListenerType: Ingress or Egress
const EGRESS ListenerType = "egress"
const INGRESS ListenerType = "ingress"
type Metadata ¶
Metadata field can be used to provide additional information about the route. It can be used for configuration, stats, and logging. The metadata should go under the filter namespace that will need it.
type MetadataConfig ¶
type MetadataConfig struct {
MetaKey LbMeta `json:"filter_metadata"`
}
MetadataConfig is a config for metadata
type Mixer ¶
type Mixer struct {
client.HttpClientConfig
}
type Proxy ¶
type Proxy struct { Name string `json:"name,omitempty"` DownstreamProtocol string `json:"downstream_protocol,omitempty"` UpstreamProtocol string `json:"upstream_protocol,omitempty"` RouterConfigName string `json:"router_config_name,omitempty"` ValidateClusters bool `json:"validate_clusters,omitempty"` ExtendConfig map[string]interface{} `json:"extend_config,omitempty"` }
Proxy
type PublishContent ¶
type PublishInfo ¶
type PublishInfo struct {
Pub PublishContent
}
PublishInfo implements json.Marshaler and json.Unmarshaler
func (PublishInfo) MarshalJSON ¶
func (pb PublishInfo) MarshalJSON() (b []byte, err error)
func (*PublishInfo) UnmarshalJSON ¶
func (pb *PublishInfo) UnmarshalJSON(b []byte) (err error)
type RetryPolicy ¶
type RetryPolicy struct { RetryPolicyConfig RetryTimeout time.Duration `json:"-"` }
RetryPolicy represents the retry parameters
func (RetryPolicy) MarshalJSON ¶
func (rp RetryPolicy) MarshalJSON() (b []byte, err error)
func (*RetryPolicy) UnmarshalJSON ¶
func (rp *RetryPolicy) UnmarshalJSON(b []byte) error
type RetryPolicyConfig ¶
type RetryPolicyConfig struct { RetryOn bool `json:"retry_on,omitempty"` RetryTimeoutConfig DurationConfig `json:"retry_timeout,omitempty"` NumRetries uint32 `json:"num_retries,omitempty"` }
type RouteAction ¶
type RouteAction struct { RouterActionConfig MetadataMatch Metadata `json:"-"` Timeout time.Duration `json:"-"` }
RouteAction represents the information of route request to upstream clusters
func (RouteAction) MarshalJSON ¶
func (r RouteAction) MarshalJSON() (b []byte, err error)
func (*RouteAction) UnmarshalJSON ¶
func (r *RouteAction) UnmarshalJSON(b []byte) error
type Router ¶
type Router struct { RouterConfig // Metadata is created from MetadataConfig, which is used to subset Metadata Metadata `json:"-"` }
Router, the list of routes that will be matched, in order, for incoming requests. The first route that matches will be used.
func (Router) MarshalJSON ¶
func (*Router) UnmarshalJSON ¶
type RouterActionConfig ¶
type RouterActionConfig struct { ClusterName string `json:"cluster_name,omitempty"` UpstreamProtocol string `json:"upstream_protocol,omitempty"` ClusterHeader string `json:"cluster_header,omitempty"` WeightedClusters []WeightedCluster `json:"weighted_clusters,omitempty"` MetadataConfig *MetadataConfig `json:"metadata_match,omitempty"` TimeoutConfig DurationConfig `json:"timeout,omitempty"` RetryPolicy *RetryPolicy `json:"retry_policy,omitempty"` PrefixRewrite string `json:"prefix_rewrite,omitempty"` HostRewrite string `json:"host_rewrite,omitempty"` AutoHostRewrite bool `json:"auto_host_rewrite,omitempty"` RequestHeadersToAdd []*HeaderValueOption `json:"request_headers_to_add,omitempty"` ResponseHeadersToAdd []*HeaderValueOption `json:"response_headers_to_add,omitempty"` ResponseHeadersToRemove []string `json:"response_headers_to_remove,omitempty"` }
type RouterConfig ¶
type RouterConfig struct { Match RouterMatch `json:"match,omitempty"` Route RouteAction `json:"route,omitempty"` DirectResponse *DirectResponseAction `json:"direct_response,omitempty"` MetadataConfig *MetadataConfig `json:"metadata,omitempty"` PerFilterConfig map[string]interface{} `json:"per_filter_config,omitempty"` }
type RouterConfiguration ¶
type RouterConfiguration struct { VirtualHosts []*VirtualHost `json:"-"` RouterConfigurationConfig }
RouterConfiguration is a filter for routers Filter type is: "CONNECTION_MANAGER"
func (RouterConfiguration) MarshalJSON ¶
func (rc RouterConfiguration) MarshalJSON() (b []byte, err error)
Marshal memory config into json, if dynamic mode is configured, write json file
func (*RouterConfiguration) UnmarshalJSON ¶
func (rc *RouterConfiguration) UnmarshalJSON(b []byte) error
type RouterConfigurationConfig ¶
type RouterConfigurationConfig struct { RouterConfigName string `json:"router_config_name,omitempty"` RequestHeadersToAdd []*HeaderValueOption `json:"request_headers_to_add,omitempty"` ResponseHeadersToAdd []*HeaderValueOption `json:"response_headers_to_add,omitempty"` ResponseHeadersToRemove []string `json:"response_headers_to_remove,omitempty"` RouterConfigPath string `json:"router_configs,omitempty"` StaticVirtualHosts []*VirtualHost `json:"virtual_hosts,omitempty"` }
type RouterMatch ¶
type RouterMatch struct { Prefix string `json:"prefix,omitempty"` // Match request's Path with Prefix Comparing Path string `json:"path,omitempty"` // Match request's Path with Exact Comparing Regex string `json:"regex,omitempty"` // Match request's Path with Regex Comparing Headers []HeaderMatcher `json:"headers,omitempty"` // Match request's Headers }
RouterMatch represents the route matching parameters
type SdsConfig ¶
type SdsConfig struct { CertificateConfig *SecretConfigWrapper ValidationConfig *SecretConfigWrapper }
type SecretConfigWrapper ¶
type SecretConfigWrapper struct {
Config *auth.SdsSecretConfig
}
func (SecretConfigWrapper) MarshalJSON ¶
func (sc SecretConfigWrapper) MarshalJSON() (b []byte, err error)
func (*SecretConfigWrapper) UnmarshalJSON ¶
func (sc *SecretConfigWrapper) UnmarshalJSON(b []byte) error
type ServerConfig ¶
type ServerConfig struct { //default logger ServerName string `json:"mosn_server_name,omitempty"` DefaultLogPath string `json:"default_log_path,omitempty"` DefaultLogLevel string `json:"default_log_level,omitempty"` GlobalLogRoller string `json:"global_log_roller,omitempty"` UseNetpollMode bool `json:"use_netpoll_mode,omitempty"` //graceful shutdown config GracefulTimeout DurationConfig `json:"graceful_timeout,omitempty"` //go processor number Processor int `json:"processor,omitempty"` Listeners []Listener `json:"listeners,omitempty"` }
ServerConfig for making up server for mosn
type ServiceRegistryInfo ¶
type ServiceRegistryInfo struct { ServiceAppInfo ApplicationInfo `json:"application,omitempty"` ServicePubInfo []PublishInfo `json:"publish_info,omitempty"` MsgMetaInfo map[string][]string `json:"msg_meta_info,omitempty"` MqClientKey map[string]string `json:"mq_client_key,omitempty"` MqMeta map[string]string `json:"mq_meta_info,omitempty"` MqConsumers map[string][]string `json:"mq_consumers,omitempty"` }
ServiceRegistryInfo
type StatsMatcher ¶
type StatsMatcher struct { RejectAll bool `json:"reject_all,omitempty"` ExclusionLabels []string `json:"exclusion_labels,omitempty"` ExclusionKeys []string `json:"exclusion_keys,omitempty"` }
StatsMatcher is a configuration for disabling stat instantiation. TODO: support inclusion_list TODO: support exclusion list/inclusion_list as pattern
type StreamFaultInject ¶
type StreamFaultInject struct { Delay *DelayInject `json:"delay,omitempty"` Abort *AbortInject `json:"abort,omitempty"` UpstreamCluster string `json:"upstream_cluster,omitempty"` Headers []HeaderMatcher `json:"headers,omitempty"` }
StreamFaultInject
type StreamPayloadLimit ¶
type StreamPayloadLimit struct { MaxEntitySize int32 `json:"max_entity_size "` HttpStatus int32 `json:"http_status"` }
PayloadLimitInject
type SubscribeSpec ¶
type SubscribeSpec struct { Subscriber string `json:"subscriber,omitempty"` ServiceName string `json:"service_name,omitempty"` }
SubscribeSpec describes the subscribe server
type TCPProxy ¶
type TCPProxy struct { StatPrefix string `json:"stat_prefix,omitempty"` Cluster string `json:"cluster,omitempty"` IdleTimeout *time.Duration `json:"idle_timeout,omitempty"` MaxConnectAttempts uint32 `json:"max_connect_attempts,omitempty"` Routes []*TCPRoute `json:"routes,omitempty"` }
TCPProxy
type TCPRoute ¶
type TCPRoute struct { Cluster string SourceAddrs []CidrRange DestinationAddrs []CidrRange SourcePort string DestinationPort string }
TCPRoute
type TCPRouteConfig ¶
type TLSConfig ¶
type TLSConfig struct { Status bool `json:"status,omitempty"` Type string `json:"type,omitempty"` ServerName string `json:"server_name,omitempty"` CACert string `json:"ca_cert,omitempty"` CertChain string `json:"cert_chain,omitempty"` PrivateKey string `json:"private_key,omitempty"` VerifyClient bool `json:"verify_client,omitempty"` RequireClientCert bool `json:"require_client_cert,omitempty"` InsecureSkip bool `json:"insecure_skip,omitempty"` CipherSuites string `json:"cipher_suites,omitempty"` EcdhCurves string `json:"ecdh_curves,omitempty"` MinVersion string `json:"min_version,omitempty"` MaxVersion string `json:"max_version,omitempty"` ALPN string `json:"alpn,omitempty"` Ticket string `json:"ticket,omitempty"` Fallback bool `json:"fall_back,omitempty"` ExtendVerify map[string]interface{} `json:"extend_verify,omitempty"` SdsConfig *SdsConfig `json:"sds_source,omitempty"` }
TLSConfig is a configuration of tls context
type Thresholds ¶
type VirtualHost ¶
type VirtualHost struct { Name string `json:"name,omitempty"` Domains []string `json:"domains,omitempty"` Routers []Router `json:"routers,omitempty"` RequireTLS string `json:"require_tls,omitempty"` // not used yet RequestHeadersToAdd []*HeaderValueOption `json:"request_headers_to_add,omitempty"` ResponseHeadersToAdd []*HeaderValueOption `json:"response_headers_to_add,omitempty"` ResponseHeadersToRemove []string `json:"response_headers_to_remove,omitempty"` }
VirtualHost is used to make up the route table
type WebSocketProxy ¶
type WebSocketProxy struct { StatPrefix string IdleTimeout *time.Duration MaxConnectAttempts uint32 }
WebSocketProxy
type WeightedCluster ¶
type WeightedCluster struct {
Cluster ClusterWeight `json:"cluster,omitempty"`
}
WeightedCluster. Multiple upstream clusters unsupport stream filter type: healthcheckcan be specified for a given route. The request is routed to one of the upstream clusters based on weights assigned to each cluster
type XProxyExtendConfig ¶
type XProxyExtendConfig struct {
SubProtocol string `json:"sub_protocol,omitempty"`
}
XProxyExtendConfig