style: 变更trace模块函数实例命名
This commit is contained in:
@@ -13,26 +13,24 @@ import (
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
// 实例化控制层 TcpdumpController 结构体
|
||||
var NewTcpdump = &TcpdumpController{
|
||||
TcpdumpService: traceService.NewTCPdump,
|
||||
// 实例化控制层 TCPdumpController 结构体
|
||||
var NewTCPdump = &TCPdumpController{
|
||||
tcpdumpService: traceService.NewTCPdump,
|
||||
neInfoService: neService.NewNeInfoImpl,
|
||||
}
|
||||
|
||||
// 信令抓包请求
|
||||
// 信令抓包
|
||||
//
|
||||
// PATH /tcpdump
|
||||
type TcpdumpController struct {
|
||||
// 信令抓包服务
|
||||
TcpdumpService *traceService.TCPdump
|
||||
// 网元信息服务
|
||||
neInfoService neService.INeInfo
|
||||
type TCPdumpController struct {
|
||||
tcpdumpService *traceService.TCPdump // 信令抓包服务
|
||||
neInfoService neService.INeInfo // 网元信息服务
|
||||
}
|
||||
|
||||
// 网元抓包PACP 开始
|
||||
//
|
||||
// POST /start
|
||||
func (s *TcpdumpController) DumpStart(c *gin.Context) {
|
||||
func (s *TCPdumpController) DumpStart(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var body struct {
|
||||
NeType string `json:"neType" binding:"required"` // 网元类型
|
||||
@@ -45,7 +43,7 @@ func (s *TcpdumpController) DumpStart(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
taskCode, err := s.TcpdumpService.DumpStart(body.NeType, body.NeId, body.Cmd)
|
||||
taskCode, err := s.tcpdumpService.DumpStart(body.NeType, body.NeId, body.Cmd)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
@@ -56,7 +54,7 @@ func (s *TcpdumpController) DumpStart(c *gin.Context) {
|
||||
// 网元抓包PACP 结束
|
||||
//
|
||||
// POST /stop
|
||||
func (s *TcpdumpController) DumpStop(c *gin.Context) {
|
||||
func (s *TCPdumpController) DumpStop(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var body struct {
|
||||
NeType string `json:"neType" binding:"required"` // 网元类型
|
||||
@@ -69,7 +67,7 @@ func (s *TcpdumpController) DumpStop(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
taskLog, err := s.TcpdumpService.DumpStop(body.NeType, body.NeId, body.TaskCode)
|
||||
taskLog, err := s.tcpdumpService.DumpStop(body.NeType, body.NeId, body.TaskCode)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
@@ -80,7 +78,7 @@ func (s *TcpdumpController) DumpStop(c *gin.Context) {
|
||||
// 网元抓包PACP 下载
|
||||
//
|
||||
// GET /download
|
||||
func (s *TcpdumpController) DumpDownload(c *gin.Context) {
|
||||
func (s *TCPdumpController) DumpDownload(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var query struct {
|
||||
NeType string `form:"neType" binding:"required"` // 网元类型
|
||||
@@ -93,7 +91,7 @@ func (s *TcpdumpController) DumpDownload(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
zipFilePath, err := s.TcpdumpService.DumpDownload(query.NeType, query.NeID, query.TaskCode)
|
||||
zipFilePath, err := s.tcpdumpService.DumpDownload(query.NeType, query.NeID, query.TaskCode)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
@@ -110,7 +108,7 @@ func (s *TcpdumpController) DumpDownload(c *gin.Context) {
|
||||
// UPF标准版内部抓包
|
||||
//
|
||||
// POST /upf
|
||||
func (s *TcpdumpController) UPFTrace(c *gin.Context) {
|
||||
func (s *TCPdumpController) UPFTrace(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var body struct {
|
||||
NeType string `json:"neType" binding:"required"` // 网元类型
|
||||
@@ -123,7 +121,7 @@ func (s *TcpdumpController) UPFTrace(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
msg, err := s.TcpdumpService.UPFTrace(body.NeType, body.NeId, body.Cmd)
|
||||
msg, err := s.tcpdumpService.UPFTrace(body.NeType, body.NeId, body.Cmd)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
|
||||
@@ -17,34 +17,32 @@ func Setup(router *gin.Engine) {
|
||||
// 启动时需要的初始参数
|
||||
InitLoad()
|
||||
|
||||
traceGroup := router.Group("/trace")
|
||||
|
||||
// 信令抓包
|
||||
tcpdumpGroup := traceGroup.Group("/tcpdump")
|
||||
tcpdumpGroup := router.Group("/trace/tcpdump")
|
||||
{
|
||||
tcpdumpGroup.POST("/start",
|
||||
middleware.PreAuthorize(nil),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.tcpdump", collectlogs.BUSINESS_TYPE_OTHER)),
|
||||
controller.NewTcpdump.DumpStart,
|
||||
controller.NewTCPdump.DumpStart,
|
||||
)
|
||||
tcpdumpGroup.POST("/stop",
|
||||
middleware.PreAuthorize(nil),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.tcpdump", collectlogs.BUSINESS_TYPE_OTHER)),
|
||||
controller.NewTcpdump.DumpStop,
|
||||
controller.NewTCPdump.DumpStop,
|
||||
)
|
||||
tcpdumpGroup.GET("/download",
|
||||
middleware.PreAuthorize(nil),
|
||||
controller.NewTcpdump.DumpDownload,
|
||||
controller.NewTCPdump.DumpDownload,
|
||||
)
|
||||
tcpdumpGroup.POST("/upf",
|
||||
middleware.PreAuthorize(nil),
|
||||
collectlogs.OperateLog(collectlogs.OptionNew("log.operate.title.tcpdump", collectlogs.BUSINESS_TYPE_OTHER)),
|
||||
controller.NewTcpdump.UPFTrace,
|
||||
controller.NewTCPdump.UPFTrace,
|
||||
)
|
||||
}
|
||||
|
||||
// 跟踪任务 网元HLR (免登录)
|
||||
taskHLRGroup := traceGroup.Group("/task/hlr")
|
||||
taskHLRGroup := router.Group("/trace/task/hlr")
|
||||
{
|
||||
taskHLRGroup.GET("/list",
|
||||
controller.NewTraceTaskHlr.List,
|
||||
@@ -67,7 +65,7 @@ func Setup(router *gin.Engine) {
|
||||
}
|
||||
|
||||
// 跟踪任务
|
||||
taskGroup := traceGroup.Group("/task")
|
||||
taskGroup := router.Group("/trace/task")
|
||||
{
|
||||
taskGroup.GET("/list",
|
||||
middleware.PreAuthorize(nil),
|
||||
@@ -99,7 +97,7 @@ func Setup(router *gin.Engine) {
|
||||
}
|
||||
|
||||
// 跟踪数据
|
||||
taskDataGroup := traceGroup.Group("/data")
|
||||
taskDataGroup := router.Group("/trace/data")
|
||||
{
|
||||
taskDataGroup.GET("/list",
|
||||
middleware.PreAuthorize(nil),
|
||||
|
||||
Reference in New Issue
Block a user