- 新增 StopAndParseCapture 函数,整合停止抓包和解析数据流程 -重构 ReadRawJsonFile 函数,返回解析后的 ParsedResult 对象 - 优化数据解析流程,提高代码可读性和性能 - 调整前端 CapturePage组件,使用新的解析接口
38 lines
835 B
Go
38 lines
835 B
Go
package model
|
|
|
|
// TCPData TCP数据包模型
|
|
type TCPData struct {
|
|
Payload []byte
|
|
Seq uint32
|
|
Ack uint32
|
|
SrcPort uint16
|
|
DstPort uint16
|
|
}
|
|
|
|
// CaptureResult 抓包结果
|
|
type CaptureResult struct {
|
|
Data []Equipment `json:"data"`
|
|
Units []interface{} `json:"units"`
|
|
}
|
|
|
|
// NetworkInterface 网络接口信息
|
|
type NetworkInterface struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Addresses []string `json:"addresses"`
|
|
IsLoopback bool `json:"is_loopback"`
|
|
}
|
|
|
|
// CaptureStatus 抓包状态
|
|
type CaptureStatus struct {
|
|
IsCapturing bool `json:"is_capturing"`
|
|
Status string `json:"status"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
// ParsedResult 解析结果
|
|
type ParsedResult struct {
|
|
Items []interface{} `json:"items"`
|
|
Heroes []interface{} `json:"heroes"`
|
|
}
|