Skip to content

Commit d8ef23b

Browse files
committed
add
1 parent b4d4954 commit d8ef23b

File tree

22 files changed

+421
-0
lines changed

22 files changed

+421
-0
lines changed
756 KB
Loading
Binary file not shown.
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package base
2+
3+
import (
4+
"LollipopGo/conf"
5+
6+
"github.com/LollipopGo/lollipopgo/chanrpc"
7+
"github.com/LollipopGo/lollipopgo/module"
8+
)
9+
10+
func NewSkeleton() *module.Skeleton {
11+
skeleton := &module.Skeleton{
12+
GoLen: conf.GoLen,
13+
TimerDispatcherLen: conf.TimerDispatcherLen,
14+
AsynCallLen: conf.AsynCallLen,
15+
ChanRPCServer: chanrpc.NewServer(conf.ChanRPCLen),
16+
}
17+
skeleton.Init()
18+
return skeleton
19+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package conf
2+
3+
import (
4+
"log"
5+
"time"
6+
)
7+
8+
var (
9+
// log conf
10+
LogFlag = log.LstdFlags
11+
12+
// gate conf // 网关配置
13+
PendingWriteNum = 2000
14+
MaxMsgLen uint32 = 4096 // 消息的长度
15+
HTTPTimeout = 10 * time.Second
16+
LenMsgLen = 2
17+
LittleEndian = false
18+
19+
// skeleton conf 框架配置
20+
GoLen = 10000
21+
TimerDispatcherLen = 10000
22+
AsynCallLen = 10000
23+
ChanRPCLen = 10000
24+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package conf
2+
3+
import (
4+
"encoding/json"
5+
"io/ioutil"
6+
7+
"FenDZ/glog-master"
8+
)
9+
10+
// 服务器结构
11+
var Server struct {
12+
LogLevel string
13+
LogPath string
14+
WSAddr string
15+
CertFile string
16+
KeyFile string
17+
TCPAddr string
18+
MaxConnNum int
19+
ConsolePort int
20+
ProfilePath string
21+
}
22+
23+
// 加载服务器配置
24+
func init() {
25+
data, err := ioutil.ReadFile("conf/server.json")
26+
if err != nil {
27+
glog.Info("-------------%v", err)
28+
}
29+
err = json.Unmarshal(data, &Server)
30+
if err != nil {
31+
glog.Info("+++++++++++++%v", err)
32+
}
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"LogLevel": "debug",
3+
"LogPath": "",
4+
"WSAddr": "127.0.0.1:8889",
5+
"CertFile": "",
6+
"KeyFile": "",
7+
"TCPAddr": "127.0.0.1:8888",
8+
"MaxConnNum": 20000,
9+
"ConsolePort": 8012,
10+
"ProfilePath": ""
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package gate
2+
3+
import (
4+
"LollipopGo/gate/internal"
5+
)
6+
7+
var (
8+
Module = new(internal.Module)
9+
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package internal
2+
3+
import (
4+
"LollipopGo/conf"
5+
//"LollipopGo/game"
6+
"LollipopGo/msg"
7+
8+
"github.com/LollipopGo/lollipopgo/gate"
9+
)
10+
11+
type Module struct {
12+
*gate.Gate
13+
}
14+
15+
func (m *Module) OnInit() {
16+
m.Gate = &gate.Gate{
17+
MaxConnNum: conf.Server.MaxConnNum,
18+
PendingWriteNum: conf.PendingWriteNum,
19+
MaxMsgLen: conf.MaxMsgLen,
20+
WSAddr: conf.Server.WSAddr,
21+
HTTPTimeout: conf.HTTPTimeout,
22+
CertFile: conf.Server.CertFile,
23+
KeyFile: conf.Server.KeyFile,
24+
TCPAddr: conf.Server.TCPAddr,
25+
LenMsgLen: conf.LenMsgLen,
26+
LittleEndian: conf.LittleEndian,
27+
Processor: msg.Processor,
28+
//AgentChanRPC: game.ChanRPC,
29+
}
30+
}

0 commit comments

Comments
 (0)