Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultKafka ¶
func DefaultKafka() []kafka.ProducerConf
func InitConfig ¶
Types ¶
type Backoff ¶
type Backoff struct { BaseDelay int32 `yaml:"baseDelay"` Multiplier float32 `yaml:"multiplier"` Jitter float32 `yaml:"jitter"` MaxDelay int32 `yaml:"maxDelay"` }
Backoff GRPC Client用到的配置
type Config ¶
type Config struct { Name string `yaml:"name"` // 服务名 Debug bool `yaml:"debug"` // 是否开启debug Discovery *Discovery `yaml:"discovery"` // etcd的配置 RPC *RPC `yaml:"rpc"` // RPC配置 HTTPServer *HTTPServer `yaml:"http"` // HTTP配置 Kafka []kafka.ProducerConf `yaml:"kafka"` // Kafka的配置 Redis []Redis `yaml:"redis"` // Redis的配置 MySQL []MySQL `yaml:"mysql"` // MySQL的配置 Node *Node `yaml:"node"` // 节点配置(客户端获取节点配置,然后根据配置进行TCP连接) Backoff *Backoff `yaml:"backoff"` // GRPC Client用到的配置 Regions map[string][]string `yaml:"regions"` // 省份与Region的映射关系 }
var Conf *Config
type HTTPServer ¶
type HTTPServer struct { Network string `yaml:"network"` // Addr string `yaml:"addr"` ReadTimeout newtime.Duration `yaml:"readTimeout"` WriteTimeout newtime.Duration `yaml:"writeTimeout"` }
HTTPServer is http server config.
type MySQL ¶
type MySQL struct { Addr string `yaml:"addr"` Port string `yaml:"port"` UserName string `yaml:"userName"` Password string `yaml:"password"` DbName string `yaml:"dbName"` }
func DefaultMySQL ¶
func DefaultMySQL() []MySQL
type Node ¶
type Node struct { DefaultDomain string `yaml:"defaultDomain"` // 默认域名 HostDomain string `yaml:"hostDomain"` // 主机域名 TCPPort int32 `yaml:"tcpPort"` // 如果采用TCP连接,采用哪个端口? WSPort int32 `yaml:"wsPort"` // 如果采用WS连接,采用哪个端口? WSSPort int32 `yaml:"wssPort"` // 如果采用WSS连接,采用哪个端口? Heartbeat Heartbeat `yaml:"heartbeat"` // 心跳配置 RegionWeight float64 `yaml:"regionWeight"` // 权重扩大比例(如果节点地址所属的Region与当前客户端Region一致,则增加该节点的权重值) }
Node node config.
type RPC ¶
func DefaultRPC ¶
func DefaultRPC() *RPC
type RPCClient ¶
type RPCClient struct { Dial newtime.Duration `yaml:"dial"` Timeout newtime.Duration `yaml:"timeout"` }
RPCClient is RPC client config.
type RPCServer ¶
type RPCServer struct { Network string `yaml:"network"` // 使用协议,如:tcp Addr string `yaml:"addr"` // 服务器地址 Timeout newtime.Duration `yaml:"timeout"` IdleTimeout newtime.Duration `yaml:"idleTimeout"` MaxLifeTime newtime.Duration `yaml:"maxLifeTime"` ForceCloseWait newtime.Duration `yaml:"forceCloseWait"` KeepAliveInterval newtime.Duration `yaml:"keepAliveInterval"` KeepAliveTimeout newtime.Duration `yaml:"keepAliveTimeout"` }
RPCServer is RPC server config.
type Redis ¶
type Redis struct { Network string `yaml:"network"` Addr string `yaml:"addr"` Auth string `yaml:"auth"` Active int `yaml:"active"` Idle int `yaml:"idle"` DialTimeout newtime.Duration `yaml:"dialTimeout"` ReadTimeout newtime.Duration `yaml:"readTimeout"` WriteTimeout newtime.Duration `yaml:"writeTimeout"` IdleTimeout newtime.Duration `yaml:"idleTimeout"` KeyExpire newtime.Duration `yaml:"keyExpire"` }
Redis .
func DefaultRedis ¶
func DefaultRedis() []Redis
Click to show internal directories.
Click to hide internal directories.