v2

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CONNECTION_MANAGER          = "connection_manager" // deprecated
	DEFAULT_NETWORK_FILTER      = "proxy"
	TCP_PROXY                   = "tcp_proxy"
	UDP_PROXY                   = "udp_proxy"
	FAULT_INJECT_NETWORK_FILTER = "fault_inject"
	RPC_PROXY                   = "rpc_proxy"
	X_PROXY                     = "x_proxy"
	Transcoder                  = "transcoder"
)

Network Filter's Type

View Source
const (
	MIXER          = "mixer"
	FaultStream    = "fault"
	PayloadLimit   = "payload_limit"
	Gzip           = "gzip"
	FaultTolerance = "fault_tolerance"
	IstioStats     = "istio.stats"
	DSL            = "dsl"
	Mirror         = "mirror"
	DubboStream    = "dubbo_stream"
)

Stream Filter's Type

View Source
const (
	LogReporter        string = "log"
	GRPCReporter       string = "gRPC"
	DefaultServiceName string = "mosn"
)
View Source
const MaxFilePath = 128
View Source
const (
	ORIGINALDST_LISTENER_FILTER = "original_dst"
)

Listener Filter's Type

Variables

View Source
var ErrDuplicateStaticAndDynamic = errors.New("only one of static config or dynamic config should be exists")
View Source
var ErrDuplicateTLSConfig = errors.New("tls_context and tls_context_set can only exists one at the same time")
View Source
var ErrNoAddrListener = errors.New("address is required in listener config")

Functions

This section is empty.

Types

type AbortInject

type AbortInject struct {
	Status  int    `json:"status,omitempty"`
	Percent uint32 `json:"percentage,omitempty"`
}

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 {
	AntShareCloud    bool   `json:"ant_share_cloud,omitempty"`
	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"`
	InstanceId       string `json:"instance_id,omitempty"`
	RegistryEndpoint string `json:"registry_endpoint,omitempty"`
	AccessKey        string `json:"access_key,omitempty"`
	SecretKey        string `json:"secret_key,omitempty"`
}

type CidrRange

type CidrRange struct {
	Address string
	Length  uint32
	IpNet   *net.IPNet
}

CidrRange ...

func Create

func Create(address string, length uint32) *CidrRange

Create CidrRange

func (*CidrRange) IsInRange

func (c *CidrRange) IsInRange(ip net.IP) bool

IsInRange

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"`
	LBOriDstConfig       LBOriDstConfig      `json:"original_dst_lb_config,omitempty"`
	ClusterManagerTLS    bool                `json:"cluster_manager_tls,omitempty"`
	TLS                  TLSConfig           `json:"tls_context,omitempty"`
	Hosts                []Host              `json:"hosts,omitempty"`
	ConnectTimeout       *api.DurationConfig `json:"connect_timeout,omitempty"`
	LbConfig             IsCluster_LbConfig  `json:"lbconfig,omitempty"`
	DnsRefreshRate       *api.DurationConfig `json:"dns_refresh_rate,omitempty"`
	RespectDnsTTL        bool                `json:"respect_dns_ttl,omitempty"`
	DnsLookupFamily      DnsLookupFamily     `json:"dns_lookup_family,omitempty"`
	DnsResolverConfig    DnsResolverConfig   `json:"dns_resolvers,omitempty"`
	DnsResolverFile      string              `json:"dns_resolver_file,omitempty"`
	DnsResolverPort      string              `json:"dns_resolver_port,omitempty"`
}

Cluster represents a cluster's information

type ClusterManagerConfig

type ClusterManagerConfig struct {
	ClusterManagerConfigJson
	Clusters []Cluster `json:"-"`
}

ClusterManagerConfig for making up cluster manager Cluster is the global cluster of mosn

func (ClusterManagerConfig) MarshalJSON

func (cc ClusterManagerConfig) MarshalJSON() (b []byte, err error)

Marshal memory config into json, if dynamic mode is configured, write json file

func (*ClusterManagerConfig) UnmarshalJSON

func (cc *ClusterManagerConfig) UnmarshalJSON(b []byte) error

type ClusterManagerConfigJson

type ClusterManagerConfigJson struct {
	TLSContext        TLSConfig `json:"tls_context,omitempty"`
	ClusterConfigPath string    `json:"clusters_configs,omitempty"`
	ClustersJson      []Cluster `json:"clusters,omitempty"`
}

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"
	ORIGINALDST_CLUSTER ClusterType = "ORIGINAL_DST"
	STRICT_DNS_CLUSTER  ClusterType = "STRICT_DNS"
)

Group of cluster type

type ClusterWeight

type ClusterWeight struct {
	ClusterWeightConfig
	MetadataMatch api.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 CookieHashPolicy added in v0.14.0

type CookieHashPolicy struct {
	Name string             `json:"name,omitempty"`
	Path string             `json:"path,omitempty"`
	TTL  api.DurationConfig `json:"ttl,omitempty"`
}

type Decorator

type Decorator string

Decorator

type DelayInject

type DelayInject struct {
	DelayInjectConfig
	Delay time.Duration `json:"-"`
}

func (DelayInject) MarshalJSON added in v0.16.0

func (d DelayInject) MarshalJSON() (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 api.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 DnsLookupFamily added in v0.13.0

type DnsLookupFamily string
const (
	V4Only DnsLookupFamily = "V4_ONLY"
	V6Only DnsLookupFamily = "V6_ONLY"
)

type DnsResolverConfig added in v0.13.0

type DnsResolverConfig struct {
	Servers  []string `json:"servers,omitempty"`
	Search   []string `json:"search,omitempty"`
	Port     string   `json:"port,omitempty"`
	Ndots    int      `json:"ndots,omitempty"`
	Timeout  int      `json:"timeout,omitempty"`
	Attempts int      `json:"attempts,omitempty"`
}

type ExtendItem added in v0.15.0

type ExtendItem struct {
	Type   string          `json:"type"`
	Config json.RawMessage `json:"config"`
}

ExtendItem is used to extend the mosn config by user need

type FaultInject

type FaultInject struct {
	FaultInjectConfig
	DelayDuration uint64 `json:"-"`
}

FaultInject

func (FaultInject) MarshalJSON added in v0.16.0

func (f FaultInject) MarshalJSON() (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 api.DurationConfig `json:"delay_duration,omitempty"`
}

type FaultToleranceFilterConfig added in v0.13.0

type FaultToleranceFilterConfig struct {
	Enabled               bool `json:"enabled"`
	ExceptionTypes        map[uint32]bool
	TimeWindow            int64
	LeastWindowCount      int64
	ExceptionRateMultiple float64
	MaxIpCount            uint64
	MaxIpRatio            float64
	RecoverTime           int64
	TaskSize              int64
}

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 FilterChainConfig struct {
	FilterChainMatch string      `json:"match,omitempty"`
	TLSConfig        *TLSConfig  `json:"tls_context,omitempty"`
	TLSConfigs       []TLSConfig `json:"tls_context_set,omitempty"`
	Filters          []Filter    `json:"filters,omitempty"`
}

type GoogleRe2Config added in v0.15.0

type GoogleRe2Config struct {
	MaxProgramSize uint32 `json:"max_program_size,omitempty"`
}

TODO: not implement yet

type HashPolicy added in v0.14.0

type HashPolicy struct {
	Header   *HeaderHashPolicy   `json:"header,omitempty"`
	Cookie   *CookieHashPolicy   `json:"cookie,omitempty"`
	SourceIP *SourceIPHashPolicy `json:"source_ip,omitempty"`
}

type HeaderHashPolicy added in v0.14.0

type HeaderHashPolicy struct {
	Key string `json:"key,omitempty"`
}

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

type HeaderValue struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

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        api.DurationConfig     `json:"timeout,omitempty"`
	IntervalConfig       api.DurationConfig     `json:"interval,omitempty"`
	IntervalJitterConfig api.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             api.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 api.Metadata `json:"-"`
}

Host represenets a host information

func (Host) MarshalJSON

func (h Host) MarshalJSON() (b []byte, err error)

func (*Host) UnmarshalJSON

func (h *Host) UnmarshalJSON(b []byte) error

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 IsCluster_LbConfig added in v0.12.0

type IsCluster_LbConfig interface {
	// contains filtered or unexported methods
}

type LBOriDstConfig added in v0.11.0

type LBOriDstConfig struct {
	UseHeader  bool   `json:"use_header,omitempty"`
	HeaderName string `json:"header_name,omitempty"`
}

LBOriDstConfig for OriDst load balancer.

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 LbMeta

type LbMeta struct {
	LbMetaKey map[string]interface{} `json:"mosn.lb"`
}

type LbType

type LbType string

LbType

const (
	LB_RANDOM        LbType = "LB_RANDOM"
	LB_ROUNDROBIN    LbType = "LB_ROUNDROBIN"
	LB_ORIGINAL_DST  LbType = "LB_ORIGINAL_DST"
	LB_LEAST_REQUEST LbType = "LB_LEAST_REQUEST"
	LB_MAGLEV        LbType = "LB_MAGLEV"
)

Group of load balancer type

type LeastRequestLbConfig added in v0.12.0

type LeastRequestLbConfig struct {
	ChoiceCount uint32
}

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.Listener    `json:"-"`
	InheritPacketConn       *net.PacketConn `json:"-"`
	Remain                  bool            `json:"-"`
}

Listener contains the listener's information

func (Listener) MarshalJSON added in v0.11.0

func (l Listener) MarshalJSON() (b []byte, err error)

func (*Listener) UnmarshalJSON added in v0.15.0

func (l *Listener) UnmarshalJSON(b []byte) error

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"`
	Network               string              `json:"network,omitempty"`
	UseOriginalDst        bool                `json:"use_original_dst,omitempty"`
	AccessLogs            []AccessLog         `json:"access_logs,omitempty"`
	ListenerFilters       []Filter            `json:"listener_filters,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 *api.DurationConfig `json:"connection_idle_timeout,omitempty"`
}

type ListenerType

type ListenerType string

ListenerType: Ingress or Egress

const EGRESS ListenerType = "egress"
const INGRESS ListenerType = "ingress"

type MOSNConfig

type MOSNConfig struct {
	Servers         []ServerConfig       `json:"servers,omitempty"`          //server config
	ClusterManager  ClusterManagerConfig `json:"cluster_manager,omitempty"`  //cluster config
	ServiceRegistry ServiceRegistryInfo  `json:"service_registry,omitempty"` //service registry config, used by service discovery module

	CloseGraceful       bool            `json:"close_graceful,omitempty"` // graceful switch, default false
	Pid                 string          `json:"pid,omitempty"`            // pid file
	Tracing             TracingConfig   `json:"tracing,omitempty"`        // tracing config
	Metrics             MetricsConfig   `json:"metrics,omitempty"`
	RawDynamicResources json.RawMessage `json:"dynamic_resources,omitempty"` //dynamic_resources raw message
	RawStaticResources  json.RawMessage `json:"static_resources,omitempty"`  //static_resources raw message
	RawAdmin            json.RawMessage `json:"admin,omitempty"`             // admin raw message
	Debug               PProfConfig     `json:"pprof,omitempty"`
	Plugin              PluginConfig    `json:"plugin,omitempty"` // plugin config
	Extend              []ExtendItem    `json:"extend,omitempty"` // extend config
}

MOSNConfig make up mosn to start the mosn project Servers contains the listener, filter and so on ClusterManager used to manage the upstream

func (*MOSNConfig) GetAdmin

func (c *MOSNConfig) GetAdmin() *xdsboot.Admin

func (*MOSNConfig) Mode

func (c *MOSNConfig) Mode() Mode

type MetadataConfig

type MetadataConfig struct {
	MetaKey LbMeta `json:"filter_metadata"`
}

MetadataConfig is a config for metadata

type MetricsConfig

type MetricsConfig struct {
	SinkConfigs  []Filter          `json:"sinks"`
	StatsMatcher StatsMatcher      `json:"stats_matcher"`
	ShmZone      string            `json:"shm_zone"`
	ShmSize      datasize.ByteSize `json:"shm_size"`
}

MetricsConfig for metrics sinks

type Mixer

type Mixer struct {
	client.HttpClientConfig
}

type Mode

type Mode uint8

Mode is mosn's starting type

const (
	File Mode = iota
	Xds
	Mix
)

File means start from config file Xds means start from xds Mix means start both from file and Xds

type PProfConfig

type PProfConfig struct {
	StartDebug bool `json:"debug"`      // If StartDebug is true, start a pprof, default is false
	Port       int  `json:"port_value"` // If port value is 0, will use 9090 as default
}

PProfConfig is used to start a pprof server for debug

type PatternConfig added in v0.15.0

type PatternConfig struct {
	GoogleRe2 GoogleRe2Config `json:"google_re2,omitempty"`
	Regex     string          `json:"regex,omitempty"`
}

type PluginConfig

type PluginConfig struct {
	LogBase string `json:"log_base"`
}

PluginConfig for plugin config

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 level concurrency config,
	// concurrency num = worker num in worker pool per connection
	// if concurrency num == 0, use global worker pool
	ConcurrencyNum int `json:"concurrency_num,omitempty"`
}

Proxy

type ProxyGeneralExtendConfig added in v0.14.0

type ProxyGeneralExtendConfig struct {
	Http2UseStream     bool `json:"http2_use_stream,omitempty"`
	MaxRequestBodySize int  `json:"max_request_body_size,omitempty"`
	MaxHeaderSize      int  `json:"max_header_size,omitempty"`
}

ProxyGeneralExtendConfig is a general config for proxy

type PublishContent

type PublishContent struct {
	ServiceName string `json:"service_name,omitempty"`
	PubData     string `json:"pub_data,omitempty"`
}

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 RedirectAction added in v0.15.0

type RedirectAction struct {
	ResponseCode   int    `json:"response_code,omitempty"`
	PathRedirect   string `json:"path_redirect,omitempty"`
	HostRedirect   string `json:"host_redirect,omitempty"`
	SchemeRedirect string `json:"scheme_redirect,omitempty"`
}

RedirectAction represents the redirect response parameters

type RegexRewrite added in v0.15.0

type RegexRewrite struct {
	Pattern      PatternConfig `json:"pattern,omitempty"`
	Substitution string        `json:"substitution,omitempty"`
}

RegexRewrite represents the regex rewrite parameters

type RequestMirrorPolicy added in v0.15.0

type RequestMirrorPolicy struct {
	Cluster      string `json:"cluster,omitempty"`
	Percent      uint32 `json:"percent,omitempty"`
	TraceSampled bool   `json:"trace_sampled,omitempty"` // TODO not implement
}

RequestMirrorPolicy mirror policy

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 api.DurationConfig `json:"retry_timeout,omitempty"`
	NumRetries         uint32             `json:"num_retries,omitempty"`
}

type RouteAction

type RouteAction struct {
	RouterActionConfig
	MetadataMatch api.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 api.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 (r Router) MarshalJSON() (b []byte, err error)

func (*Router) UnmarshalJSON

func (r *Router) UnmarshalJSON(b []byte) error

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"`
	HashPolicy              []HashPolicy         `json:"hash_policy,omitempty"`
	MetadataConfig          *MetadataConfig      `json:"metadata_match,omitempty"`
	TimeoutConfig           api.DurationConfig   `json:"timeout,omitempty"`
	RetryPolicy             *RetryPolicy         `json:"retry_policy,omitempty"`
	PrefixRewrite           string               `json:"prefix_rewrite,omitempty"`
	RegexRewrite            *RegexRewrite        `json:"regex_rewrite,omitempty"`
	HostRewrite             string               `json:"host_rewrite,omitempty"`
	AutoHostRewrite         bool                 `json:"auto_host_rewrite,omitempty"`
	AutoHostRewriteHeader   string               `json:"auto_host_rewrite_header,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"`
	Redirect              *RedirectAction        `json:"redirect,omitempty"`
	DirectResponse        *DirectResponseAction  `json:"direct_response,omitempty"`
	MetadataConfig        *MetadataConfig        `json:"metadata,omitempty"`
	PerFilterConfig       map[string]interface{} `json:"per_filter_config,omitempty"`
	RequestMirrorPolicies *RequestMirrorPolicy   `json:"request_mirror_policies,omitempty"`
}

type RouterConfiguration

type RouterConfiguration struct {
	VirtualHosts []*VirtualHost `json:"-"`
	RouterConfigurationConfig
}

RouterConfiguration is a config for routers

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
}

func (*SdsConfig) Valid

func (c *SdsConfig) Valid() bool

Valid checks the whether the SDS Config is valid or not

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 api.DurationConfig `json:"graceful_timeout,omitempty"`

	//go processor number
	Processor int `json:"processor,omitempty"`

	Listeners []Listener `json:"listeners,omitempty"`

	Routers []*RouterConfiguration `json:"routers,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 SkyWalkingTraceConfig added in v0.12.0

type SkyWalkingTraceConfig struct {
	Reporter         string                   `json:"reporter"`
	BackendService   string                   `json:"backend_service"`
	ServiceName      string                   `json:"service_name"`
	MaxSendQueueSize int                      `json:"max_send_queue_size"`
	Authentication   string                   `json:"authentication"`
	TLS              SkyWalkingTraceTLSConfig `json:"tls"`
}

type SkyWalkingTraceTLSConfig added in v0.15.0

type SkyWalkingTraceTLSConfig struct {
	CertFile           string `json:"cert_file"`
	ServerNameOverride string `json:"server_name_override"`
}

type SourceIPHashPolicy added in v0.14.0

type SourceIPHashPolicy struct {
}

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 StreamDSL added in v0.15.0

type StreamDSL struct {
	Debug            bool   `json:"debug"` // TODO not implement
	BeforeRouterDSL  string `json:"before_router_by_dsl"`
	AfterRouterDSL   string `json:"after_router_by_dsl"`
	AfterBalancerDSL string `json:"after_balancer_by_dsl"`
	SendFilterDSL    string `json:"send_filter_by_dsl"`
	LogDSL           string `json:"log_filter_by_dsl"`
}

StreamDSL ...

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 StreamGzip added in v0.13.0

type StreamGzip struct {
	GzipLevel     uint32   `json:"gzip_level,omitempty"`
	ContentLength uint32   `json:"content_length,omitempty"`
	ContentType   []string `json:"content_types,omitempty"`
}

type StreamPayloadLimit

type StreamPayloadLimit struct {
	MaxEntitySize int32 `json:"max_entity_size "`
	HttpStatus    int32 `json:"http_status"`
}

PayloadLimitInject

type StreamProxy added in v0.15.0

type StreamProxy 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             []*StreamRoute `json:"routes,omitempty"`
}

StreamProxy

type StreamRoute added in v0.15.0

type StreamRoute struct {
	Cluster          string
	SourceAddrs      []CidrRange
	DestinationAddrs []CidrRange
	SourcePort       string
	DestinationPort  string
}

StreamRoute ...

type StreamRouteConfig added in v0.15.0

type StreamRouteConfig struct {
	Cluster string   `json:"cluster,omitempty"`
	Sources []string `json:"source_addrs,omitempty"`
	Dests   []string `json:"destination_addrs,omitempty"`
}

Stream Proxy Route

type StreamTranscoder added in v0.11.0

type StreamTranscoder struct {
	Type string `json:"type"`
}

Transcoder

type SubscribeSpec

type SubscribeSpec struct {
	Subscriber  string `json:"subscriber,omitempty"`
	ServiceName string `json:"service_name,omitempty"`
}

SubscribeSpec describes the subscribe server

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 Thresholds struct {
	MaxConnections     uint32 `json:"max_connections,omitempty"`
	MaxPendingRequests uint32 `json:"max_pending_requests,omitempty"`
	MaxRequests        uint32 `json:"max_requests,omitempty"`
	MaxRetries         uint32 `json:"max_retries,omitempty"`
}

type TracingConfig

type TracingConfig struct {
	Enable bool                   `json:"enable,omitempty"`
	Tracer string                 `json:"tracer,omitempty"` // DEPRECATED
	Driver string                 `json:"driver,omitempty"`
	Config map[string]interface{} `json:"config,omitempty"`
}

Tracing configuration for a server

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

Jump to

Keyboard shortcuts

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