config

package
v0.0.0-...-89d789c Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultClusterName = "default"
)
View Source
const (
	MIN_SESSION_TIMEOUT = 600
)

Variables

This section is empty.

Functions

func MarshalNamespaceConfig

func MarshalNamespaceConfig(cfg *Namespace) ([]byte, error)

func MarshalProxyConfig

func MarshalProxyConfig(cfg *Proxy) ([]byte, error)

Types

type AdminServer

type AdminServer struct {
	Addr            string `yaml:"addr"`
	EnableBasicAuth bool   `yaml:"enable_basic_auth"`
	User            string `yaml:"user"`
	Password        string `yaml:"password"`
}

type BackendNamespace

type BackendNamespace struct {
	Username     string   `yaml:"username"`
	Password     string   `yaml:"password"`
	Instances    []string `yaml:"instances"`
	SelectorType string   `yaml:"selector_type"`
	PoolSize     int      `yaml:"pool_size"`
	IdleTimeout  int      `yaml:"idle_timeout"`
}

type BreakerInfo

type BreakerInfo struct {
	Scope      string         `yaml:"scope"`
	Strategies []StrategyInfo `yaml:"strategies"`
}

type ConfigCenter

type ConfigCenter struct {
	Type       string     `yaml:"type"`
	ConfigFile ConfigFile `yaml:"config_file"`
	ConfigEtcd ConfigEtcd `yaml:"config_etcd"`
}

type ConfigEtcd

type ConfigEtcd struct {
	Addrs    []string `yaml:"addrs"`
	BasePath string   `yaml:"base_path"`
	Username string   `yaml:"username"`
	Password string   `yaml:"password"`
	// If strictParse is disabled, parsing namespace error will be ignored when list all namespaces.
	StrictParse bool `yaml:"strict_parse"`
}

type ConfigFile

type ConfigFile struct {
	Path string `yaml:"path"`
}

type FrontendNamespace

type FrontendNamespace struct {
	AllowedDBs   []string           `yaml:"allowed_dbs"`
	SlowSQLTime  int                `yaml:"slow_sql_time"`
	DeniedIPs    []string           `yaml:"denied_ips"`
	IdleTimeout  int                `yaml:"idle_timeout"`
	Users        []FrontendUserInfo `yaml:"users"`
	SQLBlackList []SQLInfo          `yaml:"sql_blacklist"`
	SQLWhiteList []SQLInfo          `yaml:"sql_whitelist"`
}

type FrontendUserInfo

type FrontendUserInfo struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type Log

type Log struct {
	Level   string  `yaml:"level"`
	Format  string  `yaml:"format"`
	LogFile LogFile `yaml:"log_file"`
}

type LogFile

type LogFile struct {
	Filename   string `yaml:"filename"`
	MaxSize    int    `yaml:"max_size"`
	MaxDays    int    `yaml:"max_days"`
	MaxBackups int    `yaml:"max_backups"`
}

type Namespace

type Namespace struct {
	Version     string            `yaml:"version"`
	Namespace   string            `yaml:"namespace"`
	Frontend    FrontendNamespace `yaml:"frontend"`
	Backend     BackendNamespace  `yaml:"backend"`
	Breaker     BreakerInfo       `yaml:"breaker"`
	RateLimiter RateLimiterInfo   `yaml:"rate_limiter"`
}

func UnmarshalNamespaceConfig

func UnmarshalNamespaceConfig(data []byte) (*Namespace, error)

type Performance

type Performance struct {
	TCPKeepAlive bool `yaml:"tcp_keep_alive"`
}

type Proxy

type Proxy struct {
	Version      string       `yaml:"version"`
	Cluster      string       `yaml:"cluster"`
	ProxyServer  ProxyServer  `yaml:"proxy_server"`
	AdminServer  AdminServer  `yaml:"admin_server"`
	Log          Log          `yaml:"log"`
	Registry     Registry     `yaml:"registry"`
	ConfigCenter ConfigCenter `yaml:"config_center"`
	Performance  Performance  `yaml:"performance"`
}

func UnmarshalProxyConfig

func UnmarshalProxyConfig(data []byte) (*Proxy, error)

type ProxyServer

type ProxyServer struct {
	Addr           string `yaml:"addr"`
	MaxConnections uint32 `yaml:"max_connections"`
	SessionTimeout int    `yaml:"session_timeout"`
}

type RateLimiterInfo

type RateLimiterInfo struct {
	Scope string `yaml:"scope"`
	QPS   int    `yaml:"qps"`
}

type Registry

type Registry struct {
	Enable bool     `yaml:"enable"`
	Type   string   `yaml:"type"`
	Addrs  []string `yaml:"addrs"`
}

type SQLInfo

type SQLInfo struct {
	SQL string `yaml:"sql"`
}

type StrategyInfo

type StrategyInfo struct {
	MinQps               int64 `yaml:"min_qps"`
	SqlTimeoutMs         int64 `yaml:"sql_timeout_ms"`
	FailureRatethreshold int64 `yaml:"failure_rate_threshold"`
	FailureNum           int64 `yaml:"failure_num"`
	OpenStatusDurationMs int64 `yaml:"open_status_duration_ms"`
	Size                 int64 `yaml:"size"`
	CellIntervalMs       int64 `yaml:"cell_interval_ms"`
}

Jump to

Keyboard shortcuts

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