MCPcopy
hub / github.com/aceld/zinx / Server

Struct Server

znet/server.go:31–92  ·  view source on GitHub ↗

Server interface implementation, defines a Server service class (接口实现,定义一个Server服务类)

Source from the content-addressed store, hash-verified

29// Server interface implementation, defines a Server service class
30// (接口实现,定义一个Server服务类)
31type Server struct {
32 // Name of the server (服务器的名称)
33 Name string
34 //tcp4 or other
35 IPVersion string
36 // IP version (e.g. "tcp4") - 服务绑定的IP地址
37 IP string
38 // IP address the server is bound to (服务绑定的端口)
39 Port int
40 // 服务绑定的websocket 端口 (Websocket port the server is bound to)
41 WsPort int
42 // 服务绑定的websocket 路径 (Websocket path the server is bound to)
43 WsPath string
44 // 服务绑定的kcp 端口 (kcp port the server is bound to)
45 KcpPort int
46
47 // Current server's message handler module, used to bind MsgID to corresponding processing methods
48 // (当前Server的消息管理模块,用来绑定MsgID和对应的处理方法)
49 msgHandler ziface.IMsgHandle
50
51 // Routing mode (路由模式)
52 RouterSlicesMode bool
53 // Request 对象池模式
54 RequestPoolMode bool
55 // Current server's connection manager (当前Server的连接管理器)
56 ConnMgr ziface.IConnManager
57
58 // Hook function called when a new connection is established
59 // (该Server的连接创建时Hook函数)
60 onConnStart func(conn ziface.IConnection)
61
62 // Hook function called when a connection is terminated
63 // (该Server的连接断开时的Hook函数)
64 onConnStop func(conn ziface.IConnection)
65
66 // Data packet encapsulation method
67 // (数据报文封包方式)
68 packet ziface.IDataPack
69
70 // Asynchronous capture of connection closing status
71 // (异步捕获连接关闭状态)
72 exitChan chan struct{}
73
74 // Decoder for dealing with message fragmentation and reassembly
75 // (断粘包解码器)
76 decoder ziface.IDecoder
77
78 // Heartbeat checker
79 // (心跳检测器)
80 hc ziface.IHeartbeatChecker
81
82 // websocket
83 upgrader *websocket.Upgrader
84
85 // websocket connection authentication
86 websocketAuth func(r *http.Request) error
87
88 kcpConfig *KcpConfig

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected