feat: 信令跟踪功能接口定义
This commit is contained in:
@@ -149,7 +149,7 @@ func (s *Packet) LiveStart(taskNo, deviceName, filterBPF string, outputPCAP bool
|
||||
|
||||
go s.capturePacketSource(taskInfo)
|
||||
s.taskMap.Store(taskNo, taskInfo)
|
||||
return fmt.Sprintf("task no. %s initiated", taskNo), nil
|
||||
return fmt.Sprintf("task no: %s initiated", taskNo), nil
|
||||
}
|
||||
|
||||
// verifyDevice 检查网卡设备是否存在
|
||||
@@ -400,7 +400,7 @@ func (s *Packet) outputPCAPFile(snaplen uint32, linktype layers.LinkType, output
|
||||
func (s *Packet) LiveFilter(taskNo, expr string) error {
|
||||
info, ok := s.taskMap.Load(taskNo)
|
||||
if !ok {
|
||||
return fmt.Errorf("task no. %s not exist", taskNo)
|
||||
return fmt.Errorf("task no: %s does not exist or has stopped", taskNo)
|
||||
}
|
||||
task := info.(*Task)
|
||||
task.Filter = expr
|
||||
@@ -416,7 +416,7 @@ func (s *Packet) LiveFilter(taskNo, expr string) error {
|
||||
func (s *Packet) LiveTimeout(taskNo string, seconds int) error {
|
||||
info, ok := s.taskMap.Load(taskNo)
|
||||
if !ok {
|
||||
return fmt.Errorf("task no. %s not exist", taskNo)
|
||||
return fmt.Errorf("task no: %s does not exist or has stopped", taskNo)
|
||||
}
|
||||
info.(*Task).Ticker.Reset(time.Duration(seconds) * time.Second)
|
||||
return nil
|
||||
@@ -426,7 +426,7 @@ func (s *Packet) LiveTimeout(taskNo string, seconds int) error {
|
||||
func (s *Packet) LiveStop(taskNo string) error {
|
||||
info, ok := s.taskMap.Load(taskNo)
|
||||
if !ok {
|
||||
return fmt.Errorf("task no. %s not exist", taskNo)
|
||||
return fmt.Errorf("task no: %s does not exist or has stopped", taskNo)
|
||||
}
|
||||
info.(*Task).Ticker.Reset(time.Millisecond)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user