config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNode    = "node"
	TypeCluster = "cluster"
)

Variables

View Source
var (
	ErrConfigNotInit       = errors.New("Config not init")
	ErrDuplicateInitConfig = errors.New("Duplicate init config!")
)

Functions

func CmdToUpper

func CmdToUpper(list []string)

func InitConfig

func InitConfig() error

Types

type CacheS

type CacheS struct {
	Enable bool `mapstructure:"enable"`
	// cache The maximum number of items in
	MaxItemsSize int `mapstructure:"max_items_size"`
	// cache Kv default expiration time (unit: milliseconds)
	DefaultExpiration int `mapstructure:"default_expiration"`
	// cache Expired KV cleaning cycle (unit: second)
	CleanupInterval int `mapstructure:"cleanup_interval"`
}

type Config

type Config struct {
	Proxy       ProxyS       `mapstructure:"proxy"`
	RedisDB     RedisDBS     `mapstructure:"redisdb"`
	PprofDebug  PprofDebugS  `mapstructure:"pprof_debug"`
	Log         LogS         `mapstructure:"log"`
	IPWhiteList IPWhiteListS `mapstructure:"ip_white_list"`
	Cache       CacheS       `mapstructure:"cache"`
	IgnoreCMD   IgnoreCMDS   `mapstructure:"ignore_cmd"`

	P2P P2PS `mapstructure:"p2p"`
}

func Get

func Get() *Config

type IPWhiteListS

type IPWhiteListS struct {
	Enable bool     `json:"enable"`
	List   []string `json:"list"`
}

type IgnoreCMDS

type IgnoreCMDS struct {
	Enable bool `mapstructure:"enable" json:"enable"`
	// Slowly check omitted keys
	CMDList []string `mapstructure:"cmd_list" json:"cmd_list"`
}

type LogS

type LogS struct {
	Level string `mapstructure:"level"`

	OutPut    string `mapstructure:"output"`
	Key       string `mapstructure:"key"`
	RedisHost string `mapstructure:"redis_host"`
	RedisPort int    `mapstructure:"redis_port"`
	// contains filtered or unexported fields
}

type P2PS added in v1.0.1

type P2PS struct {
	Enable              bool   `mapstructure:"enable" json:"enable"`
	ServiceDiscoveryID  string `mapstructure:"service_discovery_id" json:"service_discovery_id"`
	ServiceCommandTopic string `mapstructure:"service_command_topic" json:"service_command_topic"`
	ServiceDiscoverMode string `mapstructure:"service_discover_mode" json:"service_discover_mode"`
}

type PprofDebugS

type PprofDebugS struct {
	Enable bool   `mapstructure:"enable"`
	Port   uint16 `mapstructure:"port"`
}

type ProxyS

type ProxyS struct {
	LocalPort  int  `mapstructure:"local_port" json:"local_port"`   // Port to listen on locally when proxying
	EnableMTLS bool `mapstructure:"enable_mtls" json:"enable_mtls"` // Cluster nodes, multiple, split
}

type RedisDBS

type RedisDBS struct {
	// node、cluster
	Type       string `mapstructure:"type"`
	StartNodes string `mapstructure:"start_nodes"`
	// Connection timeout parameter of cluster nodes Unit: ms
	ConnTimeOut int `mapstructure:"conn_timeout"`
	// Cluster node read timeout parameter Unit: ms
	ConnReadTimeOut int `mapstructure:"conn_read_timeout"`
	// Cluster node write timeout parameter Unit: ms
	ConnWriteTimeOut int `mapstructure:"conn_write_timeout"`
	// Cluster node TCP idle survival time Unit: seconds
	ConnAliveTimeOut int `mapstructure:"conn_alive_timeout"`
	// The size of the TCP connection pool for each node in the cluster
	ConnPoolSize int `mapstructure:"conn_pool_size"`
}

RedisClusterConf is redis cluster configure options

Jump to

Keyboard shortcuts

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