Files
logs/internal/models/trap_shield.go
2026-03-30 18:03:40 +08:00

30 lines
1.2 KiB
Go
Raw Permalink 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 models
import "time"
// TrapShield 表示一条针对 SNMP Trap 的“屏蔽/防护”规则。
type TrapShield struct {
// ID 是数据库主键。
ID uint `gorm:"primaryKey" json:"id"`
// CreatedAt 记录创建时间GORM 自动维护)。
CreatedAt time.Time `json:"created_at"`
// UpdatedAt 记录更新时间GORM 自动维护)。
UpdatedAt time.Time `json:"updated_at"`
// Name 规则名称,用于展示/标识。
Name string `gorm:"size:256" json:"name"`
// Enabled 表示该规则是否启用。
Enabled bool `gorm:"default:true" json:"enabled"`
// SourceIPCIDR 表示规则适用的源 IP 网段CIDR
SourceIPCIDR string `gorm:"size:64" json:"source_ip_cidr"`
// OIDPrefix 表示匹配的 OID 前缀。
OIDPrefix string `gorm:"size:512" json:"oid_prefix"`
// InterfaceHint 关联提示信息(例如接口/线路标识),用于定位设备来源。
InterfaceHint string `gorm:"size:256" json:"interface_hint"`
// TimeWindowsJSON 以 JSON 文本形式描述规则生效时间窗口。
TimeWindowsJSON string `gorm:"type:text" json:"time_windows_json"`
}
func (TrapShield) TableName() string {
return "logs_trap_shields"
}