config

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigPathFlag = "config"
	LogLevelFlag   = "level"

	DefaultPProfAddress          = "localhost:6060"
	DefaultLoggingThrottleMaxRPS = 10.0
)

Variables

View Source
var Module = fx.Provide(
	newConfigProvider,
)

Functions

func FromClientTLSConfig added in v0.1.14

func FromClientTLSConfig(cfg ClientTLSConfig) encryption.TLSConfig

func FromServerTLSConfig added in v0.1.14

func FromServerTLSConfig(cfg ServerTLSConfig) encryption.TLSConfig

func LoadConfig

func LoadConfig[T any](configFilePath string) (T, error)

func WriteConfig

func WriteConfig[T any](config T, filePath string) error

Types

type ACLPolicy

type ACLPolicy struct {
	AllowedMethods    AllowedMethods `yaml:"allowedMethods"`
	AllowedNamespaces []string       `yaml:"allowedNamespaces"`
}

type APIOverridesConfig added in v0.1.1

type APIOverridesConfig struct {
	AdminService AdminServiceOverrides `yaml:"adminService"`
}

type AddOrUpdateRemoteClusterOverride added in v0.1.14

type AddOrUpdateRemoteClusterOverride struct {
	Request AddOrUpdateRemoteClusterRequestOverrides `yaml:"request"`
}

type AddOrUpdateRemoteClusterRequestOverrides added in v0.1.14

type AddOrUpdateRemoteClusterRequestOverrides struct {
	FrontendAddress string `yaml:"FrontendAddress"`
}

type AdminServiceOverrides added in v0.1.1

type AdminServiceOverrides struct {
	AddOrUpdateRemoteCluster *AddOrUpdateRemoteClusterOverride `yaml:"AddOrUpdateRemoteCluster"`
	DescribeCluster          *DescribeClusterOverride          `yaml:"DescribeCluster"`
}

type AllowedMethods

type AllowedMethods struct {
	AdminService []string `yaml:"adminService"`
}

type ClientTLSConfig added in v0.1.14

type ClientTLSConfig struct {
	CertificatePath string `yaml:"certificatePath"`
	KeyPath         string `yaml:"keyPath"`
	ServerName      string `yaml:"serverName"`
	ServerCAPath    string `yaml:"serverCAPath"`
}

ClientTLSConfig provides backwards compatibility with existing configurations. Prefer config.ClusterConnConfig instead. TODO: This will be removed soon!

type ClusterConnConfig added in v0.1.14

type ClusterConnConfig struct {
	Name                       string              `yaml:"name"`
	Local                      ClusterDefinition   `yaml:"local"`
	Remote                     ClusterDefinition   `yaml:"remote"`
	ReplicationEndpoint        string              `yaml:"replicationEndpoint"`
	FVITranslation             IntMapping          `yaml:"failoverVersionIncrementTranslation"`
	ACLPolicy                  *ACLPolicy          `yaml:"aclPolicy"`
	NamespaceTranslation       StringTranslator    `yaml:"namespaceTranslation"`
	SearchAttributeTranslation SATranslationConfig `yaml:"searchAttributeTranslation"`
	RemoteClusterHealthCheck   HealthCheckConfig   `yaml:"remoteClusterHealthCheck"`
	LocalClusterHealthCheck    HealthCheckConfig   `yaml:"localClusterHealthCheck"`
	ShardCountConfig           ShardCountConfig    `yaml:"shardCount"`
	MemberlistConfig           *MemberlistConfig   `yaml:"memberlist"`
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

type ClusterDefinition added in v0.1.14

type ClusterDefinition struct {
	ConnectionType ConnectionType `yaml:"connectionType"`
	TcpClient      TCPTLSInfo     `yaml:"tcpClient"`
	TcpServer      TCPTLSInfo     `yaml:"tcpServer"`
	MuxCount       int            `yaml:"muxCount"`
	MuxAddressInfo TCPTLSInfo     `yaml:"muxAddressInfo"`
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

type ConfigProvider

type ConfigProvider interface {
	GetS2SProxyConfig() S2SProxyConfig
}

type ConnectionType added in v0.1.14

type ConnectionType string

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

const (
	ConnTypeTCP       ConnectionType = "tcp"
	ConnTypeMuxServer ConnectionType = "mux-server"
	ConnTypeMuxClient ConnectionType = "mux-client"
)

type DescribeClusterOverride added in v0.1.1

type DescribeClusterOverride struct {
	Response DescribeClusterResponseOverrides `yaml:"response"`
}

type DescribeClusterResponseOverrides added in v0.1.1

type DescribeClusterResponseOverrides struct {
	FailoverVersionIncrement *int64 `yaml:"failover_version_increment,omitempty"`
}

type HealthCheckConfig

type HealthCheckConfig struct {
	Protocol      HealthCheckProtocol `yaml:"protocol"`
	ListenAddress string              `yaml:"listenAddress"`
}

type HealthCheckProtocol

type HealthCheckProtocol string
const (
	HTTP HealthCheckProtocol = "http"
)

type IntMapping added in v0.1.16

type IntMapping struct {
	Local  int64 `yaml:"local"`
	Remote int64 `yaml:"remote"`
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

type LoggingConfig added in v0.1.9

type LoggingConfig struct {
	ThrottleMaxRPS float64 `yaml:"throttleMaxRPS"`
	Disabled       bool    `yaml:"disabled"`
}

func (LoggingConfig) GetThrottleMaxRPS added in v0.1.9

func (l LoggingConfig) GetThrottleMaxRPS() float64

type MemberlistConfig added in v0.1.16

type MemberlistConfig struct {
	// Enable distributed shard management using memberlist
	Enabled bool `yaml:"enabled"`
	// Node name for this proxy instance in the cluster
	NodeName string `yaml:"nodeName"`
	// Bind address for memberlist cluster communication
	BindAddr string `yaml:"bindAddr"`
	// Bind port for memberlist cluster communication
	BindPort int `yaml:"bindPort"`
	// List of existing cluster members to join
	JoinAddrs []string `yaml:"joinAddrs"`
	// Shard assignment strategy (deprecated - now uses actual ownership tracking)
	ShardStrategy string `yaml:"shardStrategy"`
	// Map of node names to their proxy service addresses for forwarding
	ProxyAddresses map[string]string `yaml:"proxyAddresses"`
	// Use TCP-only transport (disables UDP) for restricted networks
	TCPOnly bool `yaml:"tcpOnly"`
	// Disable TCP pings when using TCP-only mode
	DisableTCPPings bool `yaml:"disableTCPPings"`
	// Probe timeout for memberlist health checks
	ProbeTimeoutMs int `yaml:"probeTimeoutMs"`
	// Probe interval for memberlist health checks
	ProbeIntervalMs int `yaml:"probeIntervalMs"`
}

type MetricsConfig

type MetricsConfig struct {
	Prometheus PrometheusConfig `yaml:"prometheus"`
}

type MockConfigProvider

type MockConfigProvider struct {
	// contains filtered or unexported fields
}
var (
	EmptyConfigProvider MockConfigProvider
)

func NewMockConfigProvider

func NewMockConfigProvider(config S2SProxyConfig) *MockConfigProvider

func (*MockConfigProvider) GetS2SProxyConfig

func (mc *MockConfigProvider) GetS2SProxyConfig() S2SProxyConfig

type MuxMode

type MuxMode string
const (
	ClientMode MuxMode = "client" // client of the underly tcp connection in mux mode.
	ServerMode MuxMode = "server" // server of underly tcp connection in mux mode.
)

type MuxTransportConfig

type MuxTransportConfig struct {
	Name           string           `yaml:"name"`
	Mode           MuxMode          `yaml:"mode"`
	Client         TCPClientSetting `yaml:"client"`
	Server         TCPServerSetting `yaml:"server"`
	NumConnections int              `yaml:"num_connections"`
}

func (MuxTransportConfig) GetLabelValues added in v0.1.13

func (o MuxTransportConfig) GetLabelValues() []string

func (MuxTransportConfig) String

func (o MuxTransportConfig) String() string

type NameMappingConfig

type NameMappingConfig struct {
	LocalName  string `yaml:"localName"`
	RemoteName string `yaml:"remoteName"`
}

type NameTranslationConfig added in v0.1.4

type NameTranslationConfig struct {
	Mappings []NameMappingConfig `yaml:"mappings"`
}

func (NameTranslationConfig) IsEnabled added in v0.1.4

func (n NameTranslationConfig) IsEnabled() bool

func (NameTranslationConfig) ToMaps added in v0.1.4

func (n NameTranslationConfig) ToMaps(inBound bool) (map[string]string, map[string]string)

ToMaps returns request and response mappings.

type ProfilingConfig added in v0.1.4

type ProfilingConfig struct {
	PProfHTTPAddress string `yaml:"pprofAddress"`
}

func (*ProfilingConfig) UnmarshalYAML added in v0.1.4

func (c *ProfilingConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type PrometheusConfig

type PrometheusConfig struct {
	ListenAddress string `yaml:"listenAddress"`
	Framework     string `yaml:"framework"`
}

type ProxyClientConfig

type ProxyClientConfig struct {
	Type             TransportType `yaml:"type"`
	TCPClientSetting `yaml:"tcp"`
	MuxTransportName string `yaml:"mux"`
}

func (ProxyClientConfig) IsMux

func (c ProxyClientConfig) IsMux() bool

func (ProxyClientConfig) IsTCP

func (c ProxyClientConfig) IsTCP() bool

func (ProxyClientConfig) String

func (o ProxyClientConfig) String() string

func (*ProxyClientConfig) UnmarshalYAML added in v0.1.1

func (c *ProxyClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type ProxyConfig

type ProxyConfig struct {
	Name         string              `yaml:"name"`
	Server       ProxyServerConfig   `yaml:"server"`
	Client       ProxyClientConfig   `yaml:"client"`
	ACLPolicy    *ACLPolicy          `yaml:"aclPolicy"`
	APIOverrides *APIOverridesConfig `yaml:"api_overrides"`
}

type ProxyServerConfig

type ProxyServerConfig struct {
	Type             TransportType `yaml:"type"`
	TCPServerSetting `yaml:"tcp"`
	MuxTransportName string `yaml:"mux"`
}

func (ProxyServerConfig) IsMux

func (c ProxyServerConfig) IsMux() bool

func (ProxyServerConfig) IsTCP

func (c ProxyServerConfig) IsTCP() bool

func (ProxyServerConfig) String

func (o ProxyServerConfig) String() string

func (*ProxyServerConfig) UnmarshalYAML added in v0.1.1

func (c *ProxyServerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type S2SProxyConfig

type S2SProxyConfig struct {
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	Inbound *ProxyConfig `yaml:"inbound"`
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	Outbound *ProxyConfig `yaml:"outbound"`
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	MuxTransports []MuxTransportConfig `yaml:"mux"`
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	HealthCheck *HealthCheckConfig `yaml:"healthCheck"`
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	OutboundHealthCheck *HealthCheckConfig `yaml:"outboundHealthCheck"`
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	ShardCountConfig ShardCountConfig `yaml:"shardCount"`
	// TODO: Soon to be deprecated! Create an item in ClusterConnections instead
	MemberlistConfig           *MemberlistConfig        `yaml:"memberlist"`
	NamespaceNameTranslation   NameTranslationConfig    `yaml:"namespaceNameTranslation"`
	SearchAttributeTranslation SATranslationConfig      `yaml:"searchAttributeTranslation"`
	Metrics                    *MetricsConfig           `yaml:"metrics"`
	ProfilingConfig            ProfilingConfig          `yaml:"profiling"`
	Logging                    LoggingConfig            `yaml:"logging"`
	LogConfigs                 map[string]LoggingConfig `yaml:"logConfigs"`
	ClusterConnections         []ClusterConnConfig      `yaml:"clusterConnections"`
}

func ToClusterConnConfig added in v0.1.14

func ToClusterConnConfig(config S2SProxyConfig) S2SProxyConfig

ToClusterConnConfig converts from previous versions of proxy config to the new format without requiring a rewrite.

type SAMapping added in v0.1.4

type SAMapping struct {
	LocalName  string `yaml:"localFieldName"`
	RemoteName string `yaml:"remoteFieldName"`
}

type SANamespaceMapping added in v0.1.4

type SANamespaceMapping struct {
	Name        string      `yaml:"name"`
	NamespaceId string      `yaml:"namespaceId"`
	Mappings    []SAMapping `yaml:"mappings"`
}

type SATranslationConfig added in v0.1.4

type SATranslationConfig struct {
	NamespaceMappings []SANamespaceMapping `yaml:"namespaceMappings"`
	// contains filtered or unexported fields
}

func (*SATranslationConfig) AsLocalToRemoteSATranslation added in v0.1.14

func (s *SATranslationConfig) AsLocalToRemoteSATranslation() (SearchAttributeTranslation, error)

AsLocalToRemoteSATranslation converts the flat list of namespace + local/remote pairs into a map of BiMaps, with local->remote as the direction returned. The remote->local mapping can be accessed with saTranslator[namespaceId].Inverse()

func (*SATranslationConfig) IsEnabled added in v0.1.4

func (s *SATranslationConfig) IsEnabled() bool

func (*SATranslationConfig) ToMaps added in v0.1.4

func (s *SATranslationConfig) ToMaps(inBound bool) (map[string]map[string]string, map[string]map[string]string)

ToMaps returns request and response mappings.

type SearchAttributeTranslation added in v0.1.14

type SearchAttributeTranslation struct {
	// contains filtered or unexported fields
}

func (SearchAttributeTranslation) FlattenMaps added in v0.1.14

func (s SearchAttributeTranslation) FlattenMaps() map[string]map[string]string

func (SearchAttributeTranslation) Get added in v0.1.14

func (s SearchAttributeTranslation) Get(namespace string, searchAttr string) string

func (SearchAttributeTranslation) GetExists added in v0.1.14

func (s SearchAttributeTranslation) GetExists(namespace string, searchAttr string) (string, bool)

func (SearchAttributeTranslation) Inverse added in v0.1.14

func (SearchAttributeTranslation) Len added in v0.1.14

func (s SearchAttributeTranslation) Len(namespace string) int

func (SearchAttributeTranslation) LenNamespaces added in v0.1.14

func (s SearchAttributeTranslation) LenNamespaces() int

type ServerTLSConfig added in v0.1.14

type ServerTLSConfig struct {
	CertificatePath   string `yaml:"certificatePath"`
	KeyPath           string `yaml:"keyPath"`
	ClientCAPath      string `yaml:"clientCAPath"`
	RequireClientAuth bool   `yaml:"requireClientAuth"`
}

ServerTLSConfig provides backwards compatibility with existing configurations. Prefer config.ClusterConnConfig instead. TODO: This will be removed soon!

type ShardCountConfig added in v0.1.16

type ShardCountConfig struct {
	Mode             ShardCountMode `yaml:"mode"`
	LocalShardCount  int32          `yaml:"localShardCount"`
	RemoteShardCount int32          `yaml:"remoteShardCount"`
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

type ShardCountMode added in v0.1.16

type ShardCountMode string
const (
	ShardCountDefault ShardCountMode = ""
	ShardCountLCM     ShardCountMode = "lcm"
	ShardCountRouting ShardCountMode = "routing"
)

type StringMapping added in v0.1.14

type StringMapping struct {
	Local  string `yaml:"local"`
	Remote string `yaml:"remote"`
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

type StringTranslator added in v0.1.14

type StringTranslator struct {
	Mappings []StringMapping `yaml:"mappings"`
	// contains filtered or unexported fields
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

func (*StringTranslator) AsLocalToRemoteBiMap added in v0.1.14

func (config *StringTranslator) AsLocalToRemoteBiMap() (collect.StaticBiMap[string, string], error)

type TCPClientSetting

type TCPClientSetting struct {
	// ServerAddress indicates the address (Host:Port) for forwarding requests
	ServerAddress string          `yaml:"serverAddress"`
	TLS           ClientTLSConfig `yaml:"tls"`
}

func (TCPClientSetting) String

func (o TCPClientSetting) String() string

type TCPServerSetting

type TCPServerSetting struct {
	// ListenAddress indicates the server address (Host:Port) for listening requests
	ListenAddress string          `yaml:"listenAddress"`
	TLS           ServerTLSConfig `yaml:"tls"`
	// ExternalAddress is the externally reachable address of this server.
	ExternalAddress string `yaml:"externalAddress"`
}

func (TCPServerSetting) String

func (o TCPServerSetting) String() string

type TCPTLSInfo added in v0.1.14

type TCPTLSInfo struct {
	ConnectionString string               `yaml:"address"`
	TLSConfig        encryption.TLSConfig `yaml:"tls"`
}

Looking for examples? Check ./develop/sample-cluster-conn-config.yaml

type TransportType

type TransportType string
const (
	TCPTransport TransportType = "tcp"
	MuxTransport TransportType = "mux" // transport based on multiplexing over TCP
)

Jump to

Keyboard shortcuts

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