整理依赖库
This commit is contained in:
1 parent
aad8d90724
commit
0ce607f7cc
6 files changed
+2
-80
No files matched your search
@@ -1,41 +0,0 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/flswld/dpdk-go/dpdk"
|
||||
"github.com/flswld/dpdk-go/engine"
|
||||
)
|
||||
|
||||
func TestDpdk(t *testing.T) {
|
||||
ec := &engine.Config{
|
||||
DebugLog: true, // 调试日志
|
||||
MacAddr: "00:0C:29:3E:3E:DF", // mac地址
|
||||
IpAddr: "192.168.199.199", // ip地址
|
||||
NetworkMask: "255.255.255.0", // 子网掩码
|
||||
GatewayIpAddr: "192.168.199.1", // 网关ip地址
|
||||
}
|
||||
// 初始化协议栈
|
||||
e, err := engine.InitEngine(ec)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
dc := &dpdk.Config{
|
||||
GolangCpuCoreList: []int{4, 5}, // golang侧使用的核心编号列表 非单核模式下至少需要两个核心
|
||||
DpdkCpuCoreList: []int{0, 1, 2, 3}, // dpdk侧使用的核心编号列表 非单核模式下至少需要四个核心
|
||||
DpdkMemChanNum: 1, // dpdk内存通道数
|
||||
DebugLog: true, // 收发包调试日志
|
||||
IdleSleep: false, // 空闲睡眠 降低cpu占用
|
||||
SingleCore: false, // 单核模式 物理单核机器需要开启
|
||||
KniBypassTargetIp: false, // kni旁路目标ip dpdk-go只接收来自目标ip的包 其他的包全部送到kni网卡
|
||||
TargetIpAddr: "", // 目标ip地址
|
||||
}
|
||||
// 启动协议栈
|
||||
e.RunEngine(dc)
|
||||
|
||||
// 停止协议栈
|
||||
e.StopEngine()
|
||||
}
|
||||
@@ -40,32 +40,6 @@ func main() {
|
||||
logger.CloseLogger()
|
||||
}()
|
||||
|
||||
// // DPDK模式需开启
|
||||
// ec := &engine.Config{
|
||||
// DebugLog: true, // 调试日志
|
||||
// MacAddr: "00:0C:29:3E:3E:DF", // mac地址
|
||||
// IpAddr: "192.168.199.199", // ip地址
|
||||
// NetworkMask: "255.255.255.0", // 子网掩码
|
||||
// GatewayIpAddr: "192.168.199.1", // 网关ip地址
|
||||
// }
|
||||
// // 初始化协议栈
|
||||
// e, err := engine.InitEngine(ec)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// dc := &dpdk.Config{
|
||||
// GolangCpuCoreList: []int{4, 5}, // golang侧使用的核心编号列表 非单核模式下至少需要两个核心
|
||||
// DpdkCpuCoreList: []int{0, 1, 2, 3}, // dpdk侧使用的核心编号列表 非单核模式下至少需要四个核心
|
||||
// DpdkMemChanNum: 1, // dpdk内存通道数
|
||||
// DebugLog: true, // 收发包调试日志
|
||||
// IdleSleep: false, // 空闲睡眠 降低cpu占用
|
||||
// SingleCore: false, // 单核模式 物理单核机器需要开启
|
||||
// KniBypassTargetIp: false, // kni旁路目标ip dpdk-go只接收来自目标ip的包 其他的包全部送到kni网卡
|
||||
// TargetIpAddr: "", // 目标ip地址
|
||||
// }
|
||||
// // 启动协议栈
|
||||
// e.RunEngine(dc)
|
||||
|
||||
if config.GetConfig().Hk4e.ForwardModeEnable {
|
||||
// natsrpc client
|
||||
discoveryClient, err := rpc.NewDiscoveryClient()
|
||||
@@ -118,9 +92,6 @@ func main() {
|
||||
s := <-c
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
// // DPDK模式需开启
|
||||
// // 停止协议栈
|
||||
// e.StopEngine()
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
default:
|
||||
|
||||
@@ -50,9 +50,6 @@ require github.com/yuin/gopher-lua v1.0.0
|
||||
// lz4
|
||||
require github.com/pierrec/lz4/v4 v4.1.17
|
||||
|
||||
// dpdk-go
|
||||
require github.com/flswld/dpdk-go v1.0.1
|
||||
|
||||
// websocket
|
||||
require github.com/gorilla/websocket v1.4.2
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/flswld/dpdk-go v1.0.1 h1:5yZZVRTj0jlm98BYURERRSSJtn/AnvGR6AO9xOpdL9g=
|
||||
github.com/flswld/dpdk-go v1.0.1/go.mod h1:KC1XGgTu+M0+gUbXNBVhdoSDyXs5GObx6J4KPLYuMes=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
func GateLogin(dispatchInfo *DispatchInfo, accountInfo *AccountInfo, keyId string, req *proto.GetPlayerTokenReq, clientSeq uint32) (*net.Session, error, *proto.GetPlayerTokenRsp) {
|
||||
gateAddr := dispatchInfo.GateIp + ":" + strconv.Itoa(int(dispatchInfo.GatePort))
|
||||
logger.Debug("connect gate addr: %v", gateAddr)
|
||||
session, err := net.NewSession(gateAddr, dispatchInfo.DispatchKey, 30000)
|
||||
session, err := net.NewSession(gateAddr, dispatchInfo.DispatchKey)
|
||||
if err != nil {
|
||||
return nil, err, nil
|
||||
}
|
||||
|
||||
@@ -46,10 +46,7 @@ type Session struct {
|
||||
PktLock sync.Mutex
|
||||
}
|
||||
|
||||
func NewSession(gateAddr string, dispatchKey []byte, localPort int) (*Session, error) {
|
||||
// // DPDK模式需开启
|
||||
// conn, err := kcp.DialWithOptions(gateAddr, "0.0.0.0:"+strconv.Itoa(localPort))
|
||||
|
||||
func NewSession(gateAddr string, dispatchKey []byte) (*Session, error) {
|
||||
conn, err := kcp.DialWithOptions(gateAddr)
|
||||
if err != nil {
|
||||
logger.Error("kcp client conn to server error: %v", err)
|
||||
|
||||
Reference in new issue
Block a user