global

package
v3.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package global defines XxxConfigs for collecting Dubbo configurations and is for internal use only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRegistriesConfig added in v3.3.1

func CloneRegistriesConfig(regs map[string]*RegistryConfig) map[string]*RegistryConfig

CloneRegistriesConfig clones a map of RegistryConfig

func DefaultRegistriesConfig added in v3.3.1

func DefaultRegistriesConfig() map[string]*RegistryConfig

DefaultRegistriesConfig returns an empty map for registries configuration

Types

type AffinityAware added in v3.3.1

type AffinityAware struct {
	Key   string `default:"" yaml:"key" json:"key,omitempty" property:"key"`
	Ratio int32  `default:"0" yaml:"ratio" json:"ratio,omitempty" property:"ratio"`
}

type AffinityRouter added in v3.3.1

type AffinityRouter struct {
	Scope         string        `validate:"required" yaml:"scope" json:"scope,omitempty" property:"scope"` // must be chosen from `service` and `application`.
	Key           string        `validate:"required" yaml:"key" json:"key,omitempty" property:"key"`       // specifies which service or application the rule body acts on.
	Runtime       bool          `default:"false" yaml:"runtime" json:"runtime,omitempty" property:"runtime"`
	Enabled       bool          `default:"true" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	AffinityAware AffinityAware `yaml:"affinityAware" json:"affinityAware,omitempty" property:"affinityAware"`
}

AffinityRouter -- RouteConfigVersion == v3.1

type AggregateConfig

type AggregateConfig struct {
	Enabled           *bool `default:"false" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	BucketNum         int   `default:"10" yaml:"bucket-num" json:"bucket-num,omitempty" property:"bucket-num"`
	TimeWindowSeconds int   `default:"120" yaml:"time-window-seconds" json:"time-window-seconds,omitempty" property:"time-window-seconds"`
}

func (*AggregateConfig) Clone

func (c *AggregateConfig) Clone() *AggregateConfig

type ApplicationConfig

type ApplicationConfig struct {
	Organization string `default:"dubbo-go" yaml:"organization" json:"organization,omitempty" property:"organization"`
	Name         string `default:"dubbo.io" yaml:"name" json:"name,omitempty" property:"name"`
	Module       string `default:"sample" yaml:"module" json:"module,omitempty" property:"module"`
	Group        string `yaml:"group" json:"group,omitempty" property:"module"`
	Version      string `yaml:"version" json:"version,omitempty" property:"version"`
	Owner        string `default:"dubbo-go" yaml:"owner" json:"owner,omitempty" property:"owner"`
	Environment  string `yaml:"environment" json:"environment,omitempty" property:"environment"`
	// the metadata type. remote or local
	MetadataType            string `default:"local" yaml:"metadata-type" json:"metadataType,omitempty" property:"metadataType"`
	Tag                     string `yaml:"tag" json:"tag,omitempty" property:"tag"`
	MetadataServicePort     string `yaml:"metadata-service-port" json:"metadata-service-port,omitempty" property:"metadata-service-port"`
	MetadataServiceProtocol string `` /* 128-byte string literal not displayed */
}

ApplicationConfig is a configuration for current applicationConfig, whether the applicationConfig is a provider or a consumer

func DefaultApplicationConfig

func DefaultApplicationConfig() *ApplicationConfig

func (*ApplicationConfig) Clone

Clone a new ApplicationConfig

type CenterConfig

type CenterConfig struct {
	Protocol  string            `validate:"required" yaml:"protocol"  json:"protocol,omitempty"`
	Address   string            `validate:"required" yaml:"address" json:"address,omitempty"`
	DataId    string            `yaml:"data-id" json:"data-id,omitempty"`
	Cluster   string            `yaml:"cluster" json:"cluster,omitempty"`
	Group     string            `yaml:"group" json:"group,omitempty"`
	Username  string            `yaml:"username" json:"username,omitempty"`
	Password  string            `yaml:"password" json:"password,omitempty"`
	Namespace string            `yaml:"namespace"  json:"namespace,omitempty"`
	AppID     string            `default:"dubbo" yaml:"app-id"  json:"app-id,omitempty"`
	Timeout   string            `default:"10s" yaml:"timeout"  json:"timeout,omitempty"`
	Params    map[string]string `yaml:"params"  json:"parameters,omitempty"`

	//FileExtension the suffix of config dataId, also the file extension of config content
	FileExtension string `default:"yaml" yaml:"file-extension" json:"file-extension" `
}

CenterConfig is configuration for config center

ConfigCenter also introduced concepts of namespace and group to better manage Key-Value pairs by group, those configs are already built-in in many professional third-party configuration centers. In most cases, namespace is used to isolate different tenants, while group is used to divide the key set from one tenant into groups.

CenterConfig has currently supported Zookeeper, Nacos, Etcd, Consul, Apollo

func DefaultCenterConfig

func DefaultCenterConfig() *CenterConfig

func (*CenterConfig) Clone

func (c *CenterConfig) Clone() *CenterConfig

Clone a new CenterConfig

type ClientProtocolConfig added in v3.3.1

type ClientProtocolConfig struct {
	// TODO: maybe we could use this field
	Name string `yaml:"name" json:"name,omitempty" property:"name"`

	TripleConfig *TripleConfig `yaml:"triple" json:"triple,omitempty" property:"triple"`
}

ClientProtocolConfig represents the config of client's protocol

func DefaultClientProtocolConfig added in v3.3.1

func DefaultClientProtocolConfig() *ClientProtocolConfig

DefaultClientProtocolConfig returns a default ClientProtocolConfig instance.

func (*ClientProtocolConfig) Clone added in v3.3.1

Clone a new ClientProtocolConfig

type ConditionRouter added in v3.3.1

type ConditionRouter struct {
	Scope      string           `validate:"required" yaml:"scope" json:"scope,omitempty" property:"scope"` // must be chosen from `service` and `application`.
	Key        string           `validate:"required" yaml:"key" json:"key,omitempty" property:"key"`       // specifies which service or application the rule body acts on.
	Force      bool             `default:"false" yaml:"force" json:"force,omitempty" property:"force"`
	Runtime    bool             `default:"false" yaml:"runtime" json:"runtime,omitempty" property:"runtime"`
	Enabled    bool             `default:"true" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	Conditions []*ConditionRule `yaml:"conditions" json:"conditions,omitempty" property:"conditions"`
}

ConditionRouter -- when RouteConfigVersion == v3.1, decode by this

type ConditionRule added in v3.3.1

type ConditionRule struct {
	From ConditionRuleFrom `yaml:"from" json:"from,omitempty" property:"from"`
	To   []ConditionRuleTo `yaml:"to" json:"to,omitempty" property:"to"`
}

type ConditionRuleDisable added in v3.3.1

type ConditionRuleDisable struct {
	Match string `yaml:"match" json:"match,omitempty" property:"match"`
}

type ConditionRuleFrom added in v3.3.1

type ConditionRuleFrom struct {
	Match string `yaml:"match" json:"match,omitempty" property:"match"`
}

type ConditionRuleTo added in v3.3.1

type ConditionRuleTo struct {
	Match  string `yaml:"match" json:"match,omitempty" property:"match"`
	Weight int    `default:"100" yaml:"weight" json:"weight,omitempty" property:"weight"`
}

type ConsumerConfig

type ConsumerConfig struct {
	Filter          string   `yaml:"filter" json:"filter,omitempty" property:"filter"`
	RegistryIDs     []string `yaml:"registry-ids" json:"registry-ids,omitempty" property:"registry-ids"`
	Protocol        string   `yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
	RequestTimeout  string   `default:"3s" yaml:"request-timeout" json:"request-timeout,omitempty" property:"request-timeout"`
	ProxyFactory    string   `default:"default" yaml:"proxy" json:"proxy,omitempty" property:"proxy"`
	Check           bool     `yaml:"check" json:"check,omitempty" property:"check"`
	AdaptiveService bool     `default:"false" yaml:"adaptive-service" json:"adaptive-service" property:"adaptive-service"`
	// there is no need to configure References, it will be replaced by instance.NewClient
	References                     map[string]*ReferenceConfig `yaml:"references" json:"references,omitempty" property:"references"`
	TracingKey                     string                      `yaml:"tracing-key" json:"tracing-key" property:"tracing-key"`
	FilterConf                     any                         `yaml:"filter-conf" json:"filter-conf,omitempty" property:"filter-conf"`
	MaxWaitTimeForServiceDiscovery string                      `` /* 155-byte string literal not displayed */
	MeshEnabled                    bool                        `yaml:"mesh-enabled" json:"mesh-enabled,omitempty" property:"mesh-enabled"`
}

func DefaultConsumerConfig

func DefaultConsumerConfig() *ConsumerConfig

func (*ConsumerConfig) Clone

func (c *ConsumerConfig) Clone() *ConsumerConfig

Clone a new ConsumerConfig

type CustomConfig

type CustomConfig struct {
	ConfigMap map[string]any `yaml:"config-map" json:"config-map,omitempty" property:"config-map"`
}

CustomConfig

Experimental

Notice: This struct is EXPERIMENTAL and may be changed or removed in a later release.

func DefaultCustomConfig

func DefaultCustomConfig() *CustomConfig

func (*CustomConfig) Clone

func (c *CustomConfig) Clone() *CustomConfig

Clone a new CustomConfig

type Exporter

type Exporter struct {
	Enabled *bool `default:"false" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
}

func (*Exporter) Clone

func (c *Exporter) Clone() *Exporter

type File

type File struct {
	// log file name default dubbo.log
	Name string `default:"dubbo.log" yaml:"name"`

	// log max size default 100Mb
	MaxSize int `default:"100" yaml:"max-size"`

	// log max backups default 5
	MaxBackups int `default:"5" yaml:"max-backups"`

	// log file max age default 3 day
	MaxAge int `default:"3" yaml:"max-age"`

	Compress *bool `default:"true" yaml:"compress"`
}

func (*File) Clone

func (f *File) Clone() *File

Clone a new File

type Http3Config added in v3.3.1

type Http3Config struct {
	// Whether to enable HTTP/3 support.
	// When set to true, both HTTP/2 and HTTP/3 servers will be started simultaneously.
	// When set to false, only HTTP/2 server will be started.
	// The default value is false.
	Enable bool `yaml:"enable" json:"enable,omitempty"`

	// Whether to enable HTTP/3 negotiation.
	// If set to true, HTTP/2 alt-svc negotiation will be enabled,
	// allowing clients to negotiate between HTTP/2 and HTTP/3.
	// If set to false, HTTP/2 alt-svc negotiation will be skipped,
	// Clients cannot discover HTTP/3 via Alt-Svc.
	// The default value is true.
	// ref: https://quic-go.net/docs/http3/server/#advertising-http3-via-alt-svc
	Negotiation bool `yaml:"negotiation" json:"negotiation,omitempty"`
}

Http3Config represents the config of http3

func DefaultHttp3Config added in v3.3.1

func DefaultHttp3Config() *Http3Config

DefaultHttp3Config returns a default Http3Config instance.

func (*Http3Config) Clone added in v3.3.1

func (t *Http3Config) Clone() *Http3Config

Clone a new Http3Config

type LoggerConfig

type LoggerConfig struct {
	// logger driver default zap
	Driver string `default:"zap" yaml:"driver"`

	// logger level
	Level string `default:"info" yaml:"level"`

	// logger formatter default text
	Format string `default:"text" yaml:"format"`

	// supports simultaneous file and console eg: console,file default console
	Appender string `default:"console" yaml:"appender"`

	// logger file
	File *File `yaml:"file"`
}

func DefaultLoggerConfig

func DefaultLoggerConfig() *LoggerConfig

func (*LoggerConfig) Clone

func (c *LoggerConfig) Clone() *LoggerConfig

Clone a new LoggerConfig

type MetadataReportConfig

type MetadataReportConfig struct {
	Protocol  string            `required:"true"  yaml:"protocol"  json:"protocol,omitempty"`
	Address   string            `required:"true" yaml:"address" json:"address"`
	Username  string            `yaml:"username" json:"username,omitempty"`
	Password  string            `yaml:"password" json:"password,omitempty"`
	Timeout   string            `yaml:"timeout" json:"timeout,omitempty"`
	Group     string            `yaml:"group" json:"group,omitempty"`
	Namespace string            `yaml:"namespace" json:"namespace,omitempty"`
	Params    map[string]string `yaml:"params"  json:"parameters,omitempty"`
}

MetadataReportConfig is app level configuration

func DefaultMetadataReportConfig

func DefaultMetadataReportConfig() *MetadataReportConfig

func (*MetadataReportConfig) Clone

Clone a new MetadataReportConfig

type MethodConfig

type MethodConfig struct {
	InterfaceId                 string
	InterfaceName               string
	Name                        string `yaml:"name"  json:"name,omitempty" property:"name"`
	Retries                     string `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	LoadBalance                 string `yaml:"loadbalance"  json:"loadbalance,omitempty" property:"loadbalance"`
	Weight                      int64  `yaml:"weight"  json:"weight,omitempty" property:"weight"`
	TpsLimitInterval            string `yaml:"tps.limit.interval" json:"tps.limit.interval,omitempty" property:"tps.limit.interval"`
	TpsLimitRate                string `yaml:"tps.limit.rate" json:"tps.limit.rate,omitempty" property:"tps.limit.rate"`
	TpsLimitStrategy            string `yaml:"tps.limit.strategy" json:"tps.limit.strategy,omitempty" property:"tps.limit.strategy"`
	ExecuteLimit                string `yaml:"execute.limit" json:"execute.limit,omitempty" property:"execute.limit"`
	ExecuteLimitRejectedHandler string `` /* 127-byte string literal not displayed */
	Sticky                      bool   `yaml:"sticky"   json:"sticky,omitempty" property:"sticky"`
	RequestTimeout              string `yaml:"timeout"  json:"timeout,omitempty" property:"timeout"`
}

MethodConfig defines method config

func (*MethodConfig) Clone

func (c *MethodConfig) Clone() *MethodConfig

Clone a new MethodConfig

type MetricsConfig

type MetricsConfig struct {
	Enable             *bool             `default:"false" yaml:"enable" json:"enable,omitempty" property:"enable"`
	Port               string            `default:"9090" yaml:"port" json:"port,omitempty" property:"port"`
	Path               string            `default:"/metrics" yaml:"path" json:"path,omitempty" property:"path"`
	Protocol           string            `default:"prometheus" yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
	Prometheus         *PrometheusConfig `yaml:"prometheus" json:"prometheus" property:"prometheus"`
	Aggregation        *AggregateConfig  `yaml:"aggregation" json:"aggregation" property:"aggregation"`
	EnableMetadata     *bool             `default:"true" yaml:"enable-metadata" json:"enable-metadata,omitempty" property:"enable-metadata"`
	EnableRegistry     *bool             `default:"true" yaml:"enable-registry" json:"enable-registry,omitempty" property:"enable-registry"`
	EnableConfigCenter *bool             `default:"true" yaml:"enable-config-center" json:"enable-config-center,omitempty" property:"enable-config-center"`
}

MetricsConfig This is the config struct for all metrics implementation

func DefaultMetricsConfig

func DefaultMetricsConfig() *MetricsConfig

func (*MetricsConfig) Clone

func (c *MetricsConfig) Clone() *MetricsConfig

Clone a new MetricsConfig

type OtelConfig

type OtelConfig struct {
	TracingConfig *OtelTraceConfig `yaml:"tracing" json:"trace,omitempty" property:"trace"`
}

OtelConfig is the configuration of the tracing.

func DefaultOtelConfig

func DefaultOtelConfig() *OtelConfig

func (*OtelConfig) Clone

func (c *OtelConfig) Clone() *OtelConfig

Clone a new OtelConfig

type OtelTraceConfig

type OtelTraceConfig struct {
	Enable      *bool   `default:"false" yaml:"enable" json:"enable,omitempty" property:"enable"`
	Exporter    string  `default:"stdout" yaml:"exporter" json:"exporter,omitempty" property:"exporter"` // stdout, jaeger, zipkin, otlp-http, otlp-grpc
	Endpoint    string  `default:"" yaml:"endpoint" json:"endpoint,omitempty" property:"endpoint"`
	Propagator  string  `default:"w3c" yaml:"propagator" json:"propagator,omitempty" property:"propagator"`       // one of w3c(standard), b3(for zipkin),
	SampleMode  string  `default:"ratio" yaml:"sample-mode" json:"sample-mode,omitempty" property:"sample-mode"`  // one of always, never, ratio
	SampleRatio float64 `default:"0.5" yaml:"sample-ratio" json:"sample-ratio,omitempty" property:"sample-ratio"` // [0.0, 1.0]
	Insecure    bool    `default:"false" yaml:"insecure" json:"insecure,omitempty" property:"insecure"`
}

func (*OtelTraceConfig) Clone

func (c *OtelTraceConfig) Clone() *OtelTraceConfig

Clone a new OtelTraceConfig

type ProfilesConfig

type ProfilesConfig struct {
	// active profiles
	Active string
}

func DefaultProfilesConfig

func DefaultProfilesConfig() *ProfilesConfig

func (*ProfilesConfig) Clone

func (c *ProfilesConfig) Clone() *ProfilesConfig

Clone a new ProfilesConfig

type ProfilesOption

type ProfilesOption func(*ProfilesConfig)

func WithProfiles_Active

func WithProfiles_Active(active string) ProfilesOption

type PrometheusConfig

type PrometheusConfig struct {
	Exporter    *Exporter          `yaml:"exporter" json:"exporter,omitempty" property:"exporter"`
	Pushgateway *PushgatewayConfig `yaml:"pushgateway" json:"pushgateway,omitempty" property:"pushgateway"`
}

func (*PrometheusConfig) Clone

func (c *PrometheusConfig) Clone() *PrometheusConfig

type ProtocolConfig

type ProtocolConfig struct {
	Name string `yaml:"name" json:"name,omitempty" property:"name"`
	Ip   string `yaml:"ip"  json:"ip,omitempty" property:"ip"`
	Port string `yaml:"port" json:"port,omitempty" property:"port"`

	// TODO: maybe Params is useless, find a ideal way to config dubbo protocol, ref: TripleConfig.
	Params any `yaml:"params" json:"params,omitempty" property:"params"`

	TripleConfig *TripleConfig `yaml:"triple" json:"triple,omitempty" property:"triple"`

	// TODO: remove MaxServerSendMsgSize and MaxServerRecvMsgSize when version 4.0.0
	//
	// MaxServerSendMsgSize max size of server send message, 1mb=1000kb=1000000b 1mib=1024kb=1048576b.
	// more detail to see https://pkg.go.dev/github.com/dustin/go-humanize#pkg-constants
	// Deprecated:use TripleConfig
	MaxServerSendMsgSize string `yaml:"max-server-send-msg-size" json:"max-server-send-msg-size,omitempty"`
	// TODO: remove MaxServerSendMsgSize and MaxServerRecvMsgSize when version 4.0.0
	//
	// MaxServerRecvMsgSize max size of server receive message
	// Deprecated:use TripleConfig
	MaxServerRecvMsgSize string `default:"4mib" yaml:"max-server-recv-msg-size" json:"max-server-recv-msg-size,omitempty"`
}

ProtocolConfig is protocol configuration

func DefaultProtocolConfig

func DefaultProtocolConfig() *ProtocolConfig

DefaultProtocolConfig returns a default ProtocolConfig instance.

func (*ProtocolConfig) Clone

func (c *ProtocolConfig) Clone() *ProtocolConfig

Clone a new ProtocolConfig

type ProviderConfig

type ProviderConfig struct {
	ServiceConfig
	Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
	// Deprecated Register whether registration is required
	Register bool `yaml:"register" json:"register" property:"register"`
	// RegistryIDs is registry ids list
	RegistryIDs []string `yaml:"registry-ids" json:"registry-ids" property:"registry-ids"`
	// protocol
	ProtocolIDs []string `yaml:"protocol-ids" json:"protocol-ids" property:"protocol-ids"`
	// TracingKey is tracing ids list
	TracingKey string `yaml:"tracing-key" json:"tracing-key" property:"tracing-key"`
	// there is no need to configure Services
	// Services services
	Services     map[string]*ServiceConfig `yaml:"services" json:"services,omitempty" property:"services"`
	ProxyFactory string                    `default:"default" yaml:"proxy" json:"proxy,omitempty" property:"proxy"`
	FilterConf   any                       `yaml:"filter_conf" json:"filter_conf,omitempty" property:"filter_conf"`
	ConfigType   map[string]string         `yaml:"config_type" json:"config_type,omitempty" property:"config_type"`
	// adaptive service
	AdaptiveService        bool `yaml:"adaptive-service" json:"adaptive-service" property:"adaptive-service"`
	AdaptiveServiceVerbose bool `yaml:"adaptive-service-verbose" json:"adaptive-service-verbose" property:"adaptive-service-verbose"`
}

ProviderConfig is the default configuration of service provider

func DefaultProviderConfig

func DefaultProviderConfig() *ProviderConfig

func (*ProviderConfig) Clone

func (c *ProviderConfig) Clone() *ProviderConfig

Clone a new ProviderConfig

type PushgatewayConfig

type PushgatewayConfig struct {
	Enabled  *bool  `default:"false" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	BaseUrl  string `default:"" yaml:"base-url" json:"base-url,omitempty" property:"base-url"`
	Job      string `default:"default_dubbo_job" yaml:"job" json:"job,omitempty" property:"job"`
	Username string `default:"" yaml:"username" json:"username,omitempty" property:"username"`
	Password string `default:"" yaml:"password" json:"password,omitempty" property:"password"`
	// seconds
	PushInterval int `default:"30" yaml:"push-interval" json:"push-interval,omitempty" property:"push-interval"`
}

func (*PushgatewayConfig) Clone

type ReferenceConfig

type ReferenceConfig struct {
	InterfaceName    string            `yaml:"interface"  json:"interface,omitempty" property:"interface"`
	Check            *bool             `yaml:"check"  json:"check,omitempty" property:"check"`
	URL              string            `yaml:"url"  json:"url,omitempty" property:"url"`
	Filter           string            `yaml:"filter" json:"filter,omitempty" property:"filter"`
	Protocol         string            `yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	RegistryIDs      []string          `yaml:"registry-ids"  json:"registry-ids,omitempty"  property:"registry-ids"`
	Cluster          string            `yaml:"cluster"  json:"cluster,omitempty" property:"cluster"`
	Loadbalance      string            `yaml:"loadbalance"  json:"loadbalance,omitempty" property:"loadbalance"`
	Retries          string            `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	Group            string            `yaml:"group"  json:"group,omitempty" property:"group"`
	Version          string            `yaml:"version"  json:"version,omitempty" property:"version"`
	Serialization    string            `yaml:"serialization" json:"serialization" property:"serialization"`
	ProvidedBy       string            `yaml:"provided_by"  json:"provided_by,omitempty" property:"provided_by"`
	Async            bool              `yaml:"async"  json:"async,omitempty" property:"async"`
	Params           map[string]string `yaml:"params"  json:"params,omitempty" property:"params"`
	Generic          string            `yaml:"generic"  json:"generic,omitempty" property:"generic"`
	Sticky           bool              `yaml:"sticky"   json:"sticky,omitempty" property:"sticky"`
	RequestTimeout   string            `yaml:"timeout"  json:"timeout,omitempty" property:"timeout"`
	ForceTag         bool              `yaml:"force.tag"  json:"force.tag,omitempty" property:"force.tag"`
	TracingKey       string            `yaml:"tracing-key" json:"tracing-key,omitempty" property:"tracing-key"`
	MeshProviderPort int               `yaml:"mesh-provider-port" json:"mesh-provider-port,omitempty" property:"mesh-provider-port"`

	// config
	MethodsConfig []*MethodConfig `yaml:"methods"  json:"methods,omitempty" property:"methods"`
	// TODO: rename protocol_config to protocol when publish 4.0.0.
	ProtocolClientConfig *ClientProtocolConfig `yaml:"protocol_config" json:"protocol_config,omitempty" property:"protocol_config"`

	// TODO: Deprecated:use TripleConfig
	// remove KeepAliveInterval and KeepAliveInterval in version 4.0.0
	KeepAliveInterval string `yaml:"keep-alive-interval" json:"keep-alive-interval,omitempty" property:"keep-alive-interval"`
	KeepAliveTimeout  string `yaml:"keep-alive-timeout" json:"keep-alive-timeout,omitempty" property:"keep-alive-timeout"`

	// just for new triple non-IDL mode
	// TODO: remove IDLMode when config package is removed
	IDLMode string
}

ReferenceConfig is the configuration of service consumer

func DefaultReferenceConfig

func DefaultReferenceConfig() *ReferenceConfig

func (*ReferenceConfig) Clone

func (c *ReferenceConfig) Clone() *ReferenceConfig

Clone a new ReferenceConfig

func (*ReferenceConfig) GetOptions

func (c *ReferenceConfig) GetOptions() []ReferenceOption

TODO: check if ProtocolClientConfig need get options

type ReferenceOption

type ReferenceOption func(*ReferenceConfig)

func WithReference_Async

func WithReference_Async(async bool) ReferenceOption

func WithReference_Check

func WithReference_Check(check bool) ReferenceOption

func WithReference_Cluster

func WithReference_Cluster(cluster string) ReferenceOption

func WithReference_Filter

func WithReference_Filter(filter string) ReferenceOption

func WithReference_Force

func WithReference_Force(force bool) ReferenceOption

func WithReference_Generic

func WithReference_Generic(generic string) ReferenceOption

func WithReference_Group

func WithReference_Group(group string) ReferenceOption

func WithReference_InterfaceName

func WithReference_InterfaceName(name string) ReferenceOption

func WithReference_KeepAliveInterval

func WithReference_KeepAliveInterval(interval string) ReferenceOption

func WithReference_KeepAliveTimeout

func WithReference_KeepAliveTimeout(timeout string) ReferenceOption

func WithReference_LoadBalance

func WithReference_LoadBalance(loadBalance string) ReferenceOption

func WithReference_MeshProviderPort

func WithReference_MeshProviderPort(port int) ReferenceOption

func WithReference_Params

func WithReference_Params(params map[string]string) ReferenceOption

func WithReference_Protocol

func WithReference_Protocol(protocol string) ReferenceOption

func WithReference_ProtocolClientConfig added in v3.3.1

func WithReference_ProtocolClientConfig(protocolClientConfig *ClientProtocolConfig) ReferenceOption

func WithReference_ProviderBy

func WithReference_ProviderBy(providedBy string) ReferenceOption

func WithReference_RegistryIDs

func WithReference_RegistryIDs(registryIDs []string) ReferenceOption

func WithReference_RequestTimeout

func WithReference_RequestTimeout(timeout string) ReferenceOption

func WithReference_Retries

func WithReference_Retries(retries int) ReferenceOption

func WithReference_Serialization

func WithReference_Serialization(serialization string) ReferenceOption

func WithReference_Sticky

func WithReference_Sticky(sticky bool) ReferenceOption

func WithReference_TracingKey

func WithReference_TracingKey(tracingKey string) ReferenceOption

func WithReference_URL

func WithReference_URL(url string) ReferenceOption

func WithReference_Version

func WithReference_Version(version string) ReferenceOption

type RegistryConfig

type RegistryConfig struct {
	Protocol          string            `validate:"required" yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	Timeout           string            `default:"5s" validate:"required" yaml:"timeout" json:"timeout,omitempty" property:"timeout"` // unit: second
	Group             string            `yaml:"group" json:"group,omitempty" property:"group"`
	Namespace         string            `yaml:"namespace" json:"namespace,omitempty" property:"namespace"`
	TTL               string            `default:"15m" yaml:"ttl" json:"ttl,omitempty" property:"ttl"` // unit: minute
	Address           string            `validate:"required" yaml:"address" json:"address,omitempty" property:"address"`
	Username          string            `yaml:"username" json:"username,omitempty" property:"username"`
	Password          string            `yaml:"password" json:"password,omitempty"  property:"password"`
	Simplified        bool              `yaml:"simplified" json:"simplified,omitempty"  property:"simplified"`
	Preferred         bool              `yaml:"preferred" json:"preferred,omitempty" property:"preferred"` // Always use this registry first if set to true, useful when subscribe to multiple registriesConfig
	Zone              string            `yaml:"zone" json:"zone,omitempty" property:"zone"`                // The region where the registry belongs, usually used to isolate traffics
	Weight            int64             `yaml:"weight" json:"weight,omitempty" property:"weight"`          // Affects traffic distribution among registriesConfig, useful when subscribe to multiple registriesConfig Take effect only when no preferred registry is specified.
	Params            map[string]string `yaml:"params" json:"params,omitempty" property:"params"`
	RegistryType      string            `yaml:"registry-type"`
	UseAsMetaReport   string            `yaml:"use-as-meta-report" json:"use-as-meta-report,omitempty" property:"use-as-meta-report"`
	UseAsConfigCenter string            `yaml:"use-as-config-center" json:"use-as-config-center,omitempty" property:"use-as-config-center"`
}

todo(DMwangnima): finish refactoring and move related logic from config package to this file. This RegistryConfig is a copy of /config/RegistryConfig right now. Please refer to issue(https://github.com/apache/dubbo-go/issues/2377). RegistryConfig is the configuration of the registry center

func DefaultRegistryConfig

func DefaultRegistryConfig() *RegistryConfig

func (*RegistryConfig) Clone

func (c *RegistryConfig) Clone() *RegistryConfig

Clone a new RegistryConfig

func (*RegistryConfig) UseAsMetadataReport

func (c *RegistryConfig) UseAsMetadataReport() (bool, error)

type RouterConfig added in v3.3.1

type RouterConfig struct {
	Scope      string   `validate:"required" yaml:"scope" json:"scope,omitempty" property:"scope"`
	Key        string   `validate:"required" yaml:"key" json:"key,omitempty" property:"key"`
	Force      *bool    `default:"false" yaml:"force" json:"force,omitempty" property:"force"`
	Runtime    *bool    `default:"false" yaml:"runtime" json:"runtime,omitempty" property:"runtime"`
	Enabled    *bool    `default:"true" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	Valid      *bool    `default:"true" yaml:"valid" json:"valid,omitempty" property:"valid"`
	Priority   int      `default:"0" yaml:"priority" json:"priority,omitempty" property:"priority"`
	Conditions []string `yaml:"conditions" json:"conditions,omitempty" property:"conditions"`
	Tags       []Tag    `yaml:"tags" json:"tags,omitempty" property:"tags"`
	ScriptType string   `yaml:"type" json:"type,omitempty" property:"type"`
	Script     string   `yaml:"script" json:"script,omitempty" property:"script"`
}

func DefaultRouterConfig added in v3.3.1

func DefaultRouterConfig() *RouterConfig

func (*RouterConfig) Clone added in v3.3.1

func (c *RouterConfig) Clone() *RouterConfig

type ServiceConfig

type ServiceConfig struct {
	Filter                      string            `yaml:"filter" json:"filter,omitempty" property:"filter"`
	ProtocolIDs                 []string          `yaml:"protocol-ids"  json:"protocol-ids,omitempty" property:"protocol-ids"` // multi protocolIDs support, split by ','
	Interface                   string            `yaml:"interface"  json:"interface,omitempty" property:"interface"`
	RegistryIDs                 []string          `yaml:"registry-ids"  json:"registry-ids,omitempty"  property:"registry-ids"`
	Cluster                     string            `default:"failover" yaml:"cluster"  json:"cluster,omitempty" property:"cluster"`
	Loadbalance                 string            `default:"random" yaml:"loadbalance"  json:"loadbalance,omitempty"  property:"loadbalance"`
	Group                       string            `yaml:"group"  json:"group,omitempty" property:"group"`
	Version                     string            `yaml:"version"  json:"version,omitempty" property:"version" `
	Methods                     []*MethodConfig   `yaml:"methods"  json:"methods,omitempty" property:"methods"`
	Warmup                      string            `yaml:"warmup"  json:"warmup,omitempty"  property:"warmup"`
	Retries                     string            `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	Serialization               string            `yaml:"serialization" json:"serialization" property:"serialization"`
	Params                      map[string]string `yaml:"params"  json:"params,omitempty" property:"params"`
	Token                       string            `yaml:"token" json:"token,omitempty" property:"token"`
	AccessLog                   string            `yaml:"accesslog" json:"accesslog,omitempty" property:"accesslog"`
	TpsLimiter                  string            `yaml:"tps.limiter" json:"tps.limiter,omitempty" property:"tps.limiter"`
	TpsLimitInterval            string            `yaml:"tps.limit.interval" json:"tps.limit.interval,omitempty" property:"tps.limit.interval"`
	TpsLimitRate                string            `yaml:"tps.limit.rate" json:"tps.limit.rate,omitempty" property:"tps.limit.rate"`
	TpsLimitStrategy            string            `yaml:"tps.limit.strategy" json:"tps.limit.strategy,omitempty" property:"tps.limit.strategy"`
	TpsLimitRejectedHandler     string            `yaml:"tps.limit.rejected.handler" json:"tps.limit.rejected.handler,omitempty" property:"tps.limit.rejected.handler"`
	ExecuteLimit                string            `yaml:"execute.limit" json:"execute.limit,omitempty" property:"execute.limit"`
	ExecuteLimitRejectedHandler string            `` /* 127-byte string literal not displayed */
	Auth                        string            `yaml:"auth" json:"auth,omitempty" property:"auth"`
	NotRegister                 bool              `yaml:"not_register" json:"not_register,omitempty" property:"not_register"`
	ParamSign                   string            `yaml:"param.sign" json:"param.sign,omitempty" property:"param.sign"`
	Tag                         string            `yaml:"tag" json:"tag,omitempty" property:"tag"`
	TracingKey                  string            `yaml:"tracing-key" json:"tracing-key,omitempty" propertiy:"tracing-key"`
	Weight                      int64             `yaml:"weight" json:"weight,omitempty" property:"weight"`

	RCProtocolsMap  map[string]*ProtocolConfig
	RCRegistriesMap map[string]*RegistryConfig
	ProxyFactoryKey string
}

ServiceConfig is the configuration of the service provider

func DefaultServiceConfig

func DefaultServiceConfig() *ServiceConfig

func (*ServiceConfig) Clone

func (c *ServiceConfig) Clone() *ServiceConfig

Clone a new ServiceConfig

type ServiceOption

type ServiceOption func(*ServiceConfig)

type ShutdownConfig

type ShutdownConfig struct {
	/*
	 * Total timeout. Even though we don't release all resources,
	 * the applicationConfig will shutdown if the costing time is over this configuration. The unit is ms.
	 * default value is 60 * 1000 ms = 1 minutes
	 * In general, it should be bigger than 3 * StepTimeout.
	 */
	Timeout string `default:"60s" yaml:"timeout" json:"timeout,omitempty" property:"timeout"`
	/*
	 * the timeout on each step. You should evaluate the response time of request
	 * and the time that client noticed that server shutdown.
	 * For example, if your client will received the notification within 10s when you start to close server,
	 * and the 99.9% requests will return response in 2s, so the StepTimeout will be bigger than(10+2) * 1000ms,
	 * maybe (10 + 2*3) * 1000ms is a good choice.
	 */
	StepTimeout string `default:"3s" yaml:"step-timeout" json:"step.timeout,omitempty" property:"step.timeout"`

	/*
	 * ConsumerUpdateWaitTime means when provider is shutting down, after the unregister, time to wait for client to
	 * update invokers. During this time, incoming invocation can be treated normally.
	 */
	ConsumerUpdateWaitTime string `default:"3s" yaml:"consumer-update-wait-time" json:"consumerUpdate.waitTIme,omitempty" property:"consumerUpdate.waitTIme"`
	// when we try to shutdown the applicationConfig, we will reject the new requests. In most cases, you don't need to configure this.
	RejectRequestHandler string `yaml:"reject-handler" json:"reject-handler,omitempty" property:"reject_handler"`
	// internal listen kill signal,the default is true.
	InternalSignal *bool `default:"true" yaml:"internal-signal" json:"internal.signal,omitempty" property:"internal.signal"`
	// offline request window length
	OfflineRequestWindowTimeout string `yaml:"offline-request-window-timeout" json:"offlineRequestWindowTimeout,omitempty" property:"offlineRequestWindowTimeout"`
	// true -> new request will be rejected.
	RejectRequest atomic.Bool
	// active invocation
	ConsumerActiveCount atomic.Int32
	ProviderActiveCount atomic.Int32

	// provider last received request timestamp
	ProviderLastReceivedRequestTime atomic.Time
}

ShutdownConfig is used as configuration for graceful shutdown

func DefaultShutdownConfig

func DefaultShutdownConfig() *ShutdownConfig

func (*ShutdownConfig) Clone

func (c *ShutdownConfig) Clone() *ShutdownConfig

Clone a new ShutdownConfig

type TLSConfig

type TLSConfig struct {
	CACertFile    string `yaml:"ca-cert-file" json:"ca-cert-file" property:"ca-cert-file"`
	TLSCertFile   string `yaml:"tls-cert-file" json:"tls-cert-file" property:"tls-cert-file"`
	TLSKeyFile    string `yaml:"tls-key-file" json:"tls-key-file" property:"tls-key-file"`
	TLSServerName string `yaml:"tls-server-name" json:"tls-server-name" property:"tls-server-name"`
}

TLSConfig tls config

Experimental

Notice: This struct is EXPERIMENTAL and may be changed or removed in a later release.

func DefaultTLSConfig

func DefaultTLSConfig() *TLSConfig

func (*TLSConfig) Clone

func (c *TLSConfig) Clone() *TLSConfig

Clone a new TLSConfig

type Tag added in v3.3.1

type Tag struct {
	Name      string               `yaml:"name" json:"name,omitempty" property:"name"`
	Match     []*common.ParamMatch `yaml:"match" json:"match,omitempty" property:"match"`
	Addresses []string             `yaml:"addresses" json:"addresses,omitempty" property:"addresses"`
}

type TracingConfig

type TracingConfig struct {
	Name        string `default:"jaeger" yaml:"name" json:"name,omitempty" property:"name"` // jaeger or zipkin(todo)
	ServiceName string `yaml:"serviceName" json:"serviceName,omitempty" property:"serviceName"`
	Address     string `yaml:"address" json:"address,omitempty" property:"address"`
	UseAgent    *bool  `default:"false" yaml:"use-agent" json:"use-agent,omitempty" property:"use-agent"`
}

TracingConfig is the configuration of the tracing. Deprecated: it's designed to be replaced with global.OtelConfig

type TripleConfig added in v3.3.1

type TripleConfig struct {

	// MaxServerSendMsgSize max size of server send message, 1mb=1000kb=1000000b 1mib=1024kb=1048576b.
	// more detail to see https://pkg.go.dev/github.com/dustin/go-humanize#pkg-constants
	MaxServerSendMsgSize string `yaml:"max-server-send-msg-size" json:"max-server-send-msg-size,omitempty"`
	// MaxServerRecvMsgSize max size of server receive message
	MaxServerRecvMsgSize string `yaml:"max-server-recv-msg-size" json:"max-server-recv-msg-size,omitempty"`

	// the config of http3 transport
	Http3 *Http3Config `yaml:"http3" json:"http3,omitempty"`

	KeepAliveInterval string `yaml:"keep-alive-interval" json:"keep-alive-interval,omitempty" property:"keep-alive-interval"`
	KeepAliveTimeout  string `yaml:"keep-alive-timeout" json:"keep-alive-timeout,omitempty" property:"keep-alive-timeout"`
}

TripleConfig represents the config of triple protocol

func DefaultTripleConfig added in v3.3.1

func DefaultTripleConfig() *TripleConfig

DefaultTripleConfig returns a default TripleConfig instance.

func (*TripleConfig) Clone added in v3.3.1

func (t *TripleConfig) Clone() *TripleConfig

Clone a new TripleConfig

Jump to

Keyboard shortcuts

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