Documentation
¶
Index ¶
- Variables
- type Base
- type Etcd
- type Grpc
- type KCP
- type Log
- type Mgr
- func (p *Mgr) GetCustomBool(key string, defaultValue ...bool) bool
- func (p *Mgr) GetCustomDuration(key string, defaultValue ...time.Duration) time.Duration
- func (p *Mgr) GetCustomInt(key string, defaultValue ...int) int
- func (p *Mgr) GetCustomInt64(key string, defaultValue ...int64) int64
- func (p *Mgr) GetCustomString(key string, defaultValue ...string) string
- func (p *Mgr) GetCustomUint32(key string, defaultValue ...uint32) uint32
- func (p *Mgr) GetCustomUint64(key string, defaultValue ...uint64) uint64
- func (p *Mgr) Parse(executablePath string) error
- type Nats
- type Net
- type Redis
- type Timer
Constants ¶
This section is empty.
Variables ¶
View Source
var GConfigMgr = NewMgr()
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
ProjectName *string `yaml:"projectName"` // 项目名称 [default]:constants.ProjectNameDefault
GroupID *uint32 `yaml:"groupID"` // 分组ID
Name *string `yaml:"name"` // 服务名称
ServerID *uint32 `yaml:"serverID"` // 服务ID
Version *string `yaml:"version"` // 版本号 [default]: constants.VersionDefault
PprofHttpPort *uint16 `yaml:"pprofHttpPort"` // pprof性能分析 http端口 [default]: nil 不使用
GoMaxProcess *int `yaml:"goMaxProcess"` // [default]: runtime.NumCPU()
PacketLengthMax *uint32 `yaml:"packetLengthMax"` // bytes,用户 上行 每个包的最大长度 [default]: math.MaxUint32
SendChannelCapacity *uint32 `yaml:"sendChannelCapacity"` // bytes,每个链接的发送chan容量 [default]: 1024
RunMode *uint32 `yaml:"runMode"` // 运行模式 [0:release 1:debug] [default]: 1
AvailableLoad *uint32 `yaml:"availableLoad"` // 可用资源数 [default]: 1000000
PacketLimitRecvCntPreSecond *uint32 `yaml:"packetLimitRecvCntPreSecond"` // 每秒接收包数限制 [default]: math.MaxUint32
ProcessingMode *xconfigconstants.ProcessingMode `yaml:"processingMode"` // 处理-模式 [0:bus 1:actor] [default]: ProcessingModeActor
}
func (*Base) ProcessingModeIsActor ¶
type Etcd ¶
type Grpc ¶
type Grpc struct {
PackageName *string `yaml:"packageName"` // 包名
ServiceName *string `yaml:"serviceName"` // 服务名称
ListenAddr *string `yaml:"listenAddr"` // 服务地址-Listen (如果配置,则Listen服务) e.g.: 127.0.0.1:8989 [default]: "127.0.0.1:6523"
ExternalAddr *string `yaml:"externalAddr"` // 服务地址-对外 e.g.: 127.0.0.1:8989 [default]: 未配置-使用 -> 服务地址-Listen
}
Grpc gRPC 服务配置 通过
func (*Grpc) HasListenAddr ¶
type KCP ¶
type Log ¶
type Mgr ¶
type Mgr struct {
ExecutablePath string // 绝对路径
Content string // 内容
Etcd Etcd `yaml:"etcd"`
Base Base `yaml:"base"`
Log Log `yaml:"log"`
Timer Timer `yaml:"timer"`
Net []*Net `yaml:"net"`
KCP KCP `yaml:"kcp"`
Grpc Grpc `yaml:"grpc"`
Redis []*Redis `yaml:"redis"`
Nats []*Nats `yaml:"nats"`
Custom map[string]any `yaml:"custom"` // 自定义配置,支持各模块自行解析
}
func (*Mgr) GetCustomBool ¶
GetCustomBool 获取 bool 类型的配置值(额外提供)
func (*Mgr) GetCustomDuration ¶
GetCustomDuration 获取 time.Duration 类型的配置值,支持 "3s"、"1m" 等 Go duration 字符串。
func (*Mgr) GetCustomInt ¶
GetCustomInt 获取 int 类型的配置值(额外提供)
func (*Mgr) GetCustomString ¶
GetCustomString 获取 string 类型的配置值
func (*Mgr) GetCustomUint32 ¶
GetCustomUint32 获取 uint32 类型的配置值
func (*Mgr) GetCustomUint64 ¶
type Nats ¶
type Net ¶
type Net struct {
Name *string `yaml:"name"` // 链接名称 [default]: "netName"
Type *string `yaml:"type"` // [tcp, kcp, websocket] [default]: common.ServerNetTypeNameTCP
ListenAddr *string `yaml:"listenAddr"` // 服务地址-Listen (如果配置,则Listen服务) e.g.: 127.0.0.1:8989
ExternalAddr *string `yaml:"externalAddr"` // 服务地址-对外 e.g.: 127.0.0.1:8989 [default]: 未配置-使用 -> 服务地址-Listen
Pattern *string `yaml:"pattern"` // 用于 type: websocket
}
type Redis ¶
type Redis struct {
Name *string `yaml:"name"` // 名称 [default]: "redisName"
Addrs []string `yaml:"addrs"` // 地址
Password *string `yaml:"password"` // 密码 [default]:"123456"
// YAML 须为 Go duration 字面量,如 100ms, 1s
DialTimeoutDuration *time.Duration `yaml:"dialTimeoutDuration"` // 连接超时时间 [default]: 3s
// YAML 须为 Go duration 字面量,如 100ms, 1s
ReadTimeoutDuration *time.Duration `yaml:"readTimeoutDuration"` // 读超时时间 [default]: 3s
// YAML 须为 Go duration 字面量,如 100ms, 1s
WriteTimeoutDuration *time.Duration `yaml:"writeTimeoutDuration"` // 写超时时间 [default]: 3s
}
type Timer ¶
type Timer struct {
// 秒级定时器扫描间隔 [default]: timer.ScanSecondDurationDefault
// YAML 须为 Go duration 字面量,如 100ms, 1s
ScanSecondDuration *time.Duration `yaml:"scanSecondDuration"`
// 毫秒级定时器扫描间隔 [default]: timer.ScanMillisecondDurationDefault
ScanMillisecondDuration *time.Duration `yaml:"scanMillisecondDuration"`
// 毫秒级定时器实现类型 [default]: timer.MillisecondTypeList
MillisecondType *xtimerconstants.MillisecondType `yaml:"millisecondType"`
}
func (*Timer) GetMillisecondType ¶
func (p *Timer) GetMillisecondType() xtimerconstants.MillisecondType
func (*Timer) GetScanMillisecondDuration ¶
func (*Timer) GetScanSecondDuration ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.