新增TcpGateWay服务,支持通过配置进行路由转发

This commit is contained in:
boyce
2020-10-07 16:14:19 +08:00
parent 40ff2f7932
commit 0c55961c44
17 changed files with 1203 additions and 58 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/duanhf2012/origin/event"
"github.com/duanhf2012/origin/log"
"github.com/duanhf2012/origin/network"
"github.com/duanhf2012/origin/network/processor"
"github.com/duanhf2012/origin/service"
"sync"
)
@@ -16,7 +17,7 @@ type WSService struct {
mapClientLocker sync.RWMutex
mapClient map[uint64] *WSClient
initClientId uint64
process network.Processor
process processor.Processor
}
type WSPackType int8
@@ -28,10 +29,10 @@ const(
)
type WSPack struct {
Type WSPackType //0表示连接 1表示断开 2表示数据
MsgProcessor network.Processor
ClientId uint64
Data interface{}
Type WSPackType //0表示连接 1表示断开 2表示数据
MsgProcessor processor.Processor
ClientId uint64
Data interface{}
}
@@ -89,7 +90,7 @@ func (slf *WSService) WSEventHandler(ev *event.Event) {
}
}
func (slf *WSService) SetProcessor(process network.Processor,handler event.IEventHandler){
func (slf *WSService) SetProcessor(process processor.Processor,handler event.IEventHandler){
slf.process = process
slf.RegEventReciverFunc(event.Sys_Event_WebSocket,handler,slf.WSEventHandler)
}