1 Star 0 Fork 97

Leytton / xingo

forked from BossHX / xingo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

xingo

高性能golang网络库,游戏开发脚手架

默认通信协议如下(支持自定义协议处理部分代码,支持灵活的重载协议部分代码):

Len uint32 数据Data部分长度
MsgId uint32 消息号
Data []byte 数据
消息默认通过google 的protobuf进行序列化

服务器全局配置对象为GlobalObject,支持的配置选项及默认值如下:
TcpPort: 8109,//服务器监听端口
MaxConn: 12000,//支持最大链接数
LogPath: "./log",//日志文件路径
LogName: "server.log",//日志文件名
MaxLogNum: 10,//最大日志数
MaxFileSize: 100,//per日志文件大小
LogFileUnit: logger.KB,//日志文件大小对应单位
LogLevel: logger.ERROR,//日志级别
SetToConsole: true,//是否输出到console
PoolSize: 10,//api接口工作线程数量
IsUsePool: true,//是否使用worker pool false 每个请求开启单独的协程处理
MaxWorkerLen: 1024 * 2,//任务缓冲池大小
MaxSendChanLen: 1024,//发送队列从缓冲池
FrameSpeed: 30,//未使用
OnConnectioned: func(fconn iface.Iconnection) {},//链接建立事件回调
OnClosed: func(fconn iface.Iconnection) {},//链接断开事件回调

如何使用?
只需要一步,添加消息路由:
s := fserver.NewServer()
//add api ---------------start
FightingRouterObj := &api.FightingRouter{}
s.AddRouter(FightingRouterObj)
//add api ---------------end
xingo会自动注册FightingRouter中的方法处理对应消息
例如:msgId =1 则会寻找FightingRouter中的Func_1的方法从进行处理
具体使用请参考项目(也是xingo的demo(帧同步服务器)):
https://github.com/viphxin/fighting
mmo demo: https://git.oschina.net/viphxin/xingo_demo

MIT License Copyright (c) 2016 viphxin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

高性能golang网络库,游戏开发脚手架 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/Leytton/xingo.git
git@gitee.com:Leytton/xingo.git
Leytton
xingo
xingo
master

搜索帮助

14c37bed 8189591 565d56ea 8189591