conf

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerModeTcp       = "tcp"
	ServerModeWebsocket = "websocket"
)

Variables

This section is empty.

Functions

func UserConfToGlobal

func UserConfToGlobal(config *Config)

UserConfToGlobal, Note that if UserConf is used, the method should be called to synchronize with GlobalConfObject because other parameters are called from this structure parameter. (注意如果使用UserConf应该调用方法同步至 GlobalConfObject 因为其他参数是调用的此结构体参数)

Types

type Config

type Config struct {
	// server
	Host    string //The IP address of the current server. (当前服务器主机IP)
	TCPPort int    //The port number on which the server listens for TCP connections.(当前服务器主机监听端口号)
	WsPort  int    //The port number on which the server listens for WebSocket connections.(当前服务器主机websocket监听端口)
	Name    string //The name of the current server.(当前服务器名称)

	// zinx
	Version          string //The version of the Zinx framework.(当前Zinx版本号)
	MaxPacketSize    uint32 //The maximum size of the packets that can be sent or received.(读写数据包的最大值)
	MaxConn          int    //The maximum number of connections that the server can handle.(当前服务器主机允许的最大链接个数)
	WorkerPoolSize   uint32 //The number of worker pools in the business logic.(业务工作Worker池的数量)
	MaxWorkerTaskLen uint32 //The maximum number of tasks that a worker pool can handle.(业务工作Worker对应负责的任务队列最大任务存储数量)
	MaxMsgChanLen    uint32 //The maximum length of the send buffer message queue.(SendBuffMsg发送消息的缓冲最大长度)
	IOReadBuffSize   uint32 //The maximum size of the read buffer for each IO operation.(每次IO最大的读取长度)

	//The server mode, which can be "tcp" or "websocket". If it is empty, both modes are enabled.
	//"tcp":tcp监听, "websocket":websocket 监听 为空时同时开启
	Mode string
	// A boolean value that indicates whether the new or old version of the router is used. The default value is false.
	//路由模式 false为旧版本路由,true为启用新版本的路由 默认使用旧版本
	RouterSlicesMode bool

	// Keepalive
	// The maximum interval for heartbeat detection in seconds.
	// 最长心跳检测间隔时间(单位:秒),超过改时间间隔,则认为超时
	HeartbeatMax int

	// TLS
	CertFile       string // The name of the certificate file. If it is empty, TLS encryption is not enabled.(证书文件名称 默认"")
	PrivateKeyFile string // The name of the private key file. If it is empty, TLS encryption is not enabled.(私钥文件名称 默认"" --如果没有设置证书和私钥文件,则不启用TLS加密)
}
   Store all global parameters related to the Zinx framework for use by other modules.
   Some parameters can also be configured by the user based on the zinx.json file.
	(存储一切有关Zinx框架的全局参数,供其他模块使用
	一些参数也可以通过 用户根据 zinx.json来配置)
var GlobalObject *Config

Define a global object.(定义一个全局的对象)

func (*Config) HeartbeatMaxDuration

func (g *Config) HeartbeatMaxDuration() time.Duration

func (*Config) Show

func (g *Config) Show()

Show Zinx Config Info

Jump to

Keyboard shortcuts

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