service.xpcool.com/internal/controller/serversecurity/controller.go

22 lines
797 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package serversecurity 服务器安全日志模块控制器。
// 分为两个 ControllerReportController 绑定 open 组(宿主机脚本上报,内部令牌鉴权);
// ManageController 绑定 admin 受权限保护组(查询/统计)。
package serversecurity
import (
serversecurityv1 "service.xpcool.com/api/serversecurity"
"service.xpcool.com/internal/model/dto"
)
// toInput 将 API 上报项转为服务层入参。
func toInput(items []serversecurityv1.SecurityLogItem) []dto.SecurityLogInput {
out := make([]dto.SecurityLogInput, 0, len(items))
for _, it := range items {
out = append(out, dto.SecurityLogInput{
LogTime: it.LogTime, SrcIp: it.SrcIp, SrcPort: it.SrcPort,
DestPort: it.DestPort, EventType: it.EventType, Detail: it.Detail,
})
}
return out
}