()
| 43 | } |
| 44 | |
| 45 | func main() { |
| 46 | // Create server / 创建服务器 |
| 47 | s := znet.NewServer() |
| 48 | |
| 49 | // Set connection start and stop callbacks / 设置连接开始和断开的回调 |
| 50 | s.SetOnConnStart(DoConnectionBegin) |
| 51 | s.SetOnConnStop(DoConnectionLost) |
| 52 | |
| 53 | // Add router / 添加路由 |
| 54 | s.AddRouter(1, &router.PingRouter{}) |
| 55 | |
| 56 | // Start server / 启动服务器 |
| 57 | fmt.Println("Server starting") |
| 58 | s.Serve() |
| 59 | } |
nothing calls this directly
no test coverage detected