mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-14 07:34:43 +08:00
新增tcpsocket协议
This commit is contained in:
23
Test/main.go
23
Test/main.go
@@ -3,9 +3,28 @@ package main
|
||||
import (
|
||||
"github.com/duanhf2012/origin/cluster"
|
||||
"github.com/duanhf2012/origin/originnode"
|
||||
"github.com/duanhf2012/origin/sysservice"
|
||||
"github.com/duanhf2012/origin/sysservice/originhttp"
|
||||
"github.com/duanhf2012/origin/network"
|
||||
)
|
||||
|
||||
|
||||
type TcpSocketServerReciver struct {
|
||||
|
||||
}
|
||||
|
||||
func (slf *TcpSocketServerReciver) OnConnected(pClient *network.SClient){
|
||||
|
||||
}
|
||||
|
||||
func (slf *TcpSocketServerReciver) OnDisconnect(pClient *network.SClient){
|
||||
|
||||
}
|
||||
|
||||
func (slf *TcpSocketServerReciver) OnRecvMsg(pClient *network.SClient, pPack *network.MsgBasePack){
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
node := originnode.NewOriginNode()
|
||||
@@ -18,9 +37,11 @@ func main() {
|
||||
for _, ca := range nodeCfg.CAFile {
|
||||
httpserver.SetHttps(ca.CertFile, ca.KeyFile)
|
||||
}
|
||||
|
||||
pTcpService := sysservice.NewTcpSocketPbService(":9004",&TcpSocketServerReciver{})
|
||||
httpserver.SetPrintRequestTime(true)
|
||||
|
||||
node.SetupService(httpserver)
|
||||
node.SetupService(httpserver,pTcpService)
|
||||
node.Init()
|
||||
node.Start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user