Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateRuleDirectory ¶
ValidateRuleDirectory 严格验证规则目录下的所有规则文件。
行为: - 遍历目录中的所有 YAML 规则文件 - 对每个文件调用 LoadRuleStrict 收集 YAML/Matcher 的所有错误 - 不会中断整个遍历,所有问题都会被返回
fatalErr 仅在目录本身不可访问等致命场景下返回; errs 列出所有规则文件级别的问题,用于 validate 模式报告。
Types ¶
type Finger ¶
Finger 根据协议分组
func ScanRuleDirectory ¶
func (Finger) Match ¶
func (f Finger) Match(service string, getMatchPart MatchPartGetter) []*MatchResult
Match 执行指纹匹配并返回包含规则的匹配结果
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 规则管理器,实现单例模式和热更新
func NewManagerWithPath ¶
NewManagerWithPath 创建一个新的规则管理器实例并加载指定路径的规则
func (*Manager) FindRuleByName ¶
FindRuleByName 根据名称查找规则
func (*Manager) GetLastLoadTime ¶
GetLastLoadTime 获取最后加载时间
type MatchPartGetter ¶
MatchPartGetter 定义了获取匹配部分的函数类型 CaseSensitive 大小写敏感
type MatchResult ¶
MatchResult 表示匹配结果
func (MatchResult) IsPlugin ¶
func (m MatchResult) IsPlugin() bool
type Rule ¶
type Rule struct {
Name string `json:"name,omitempty"`
Service string `yaml:"service" json:"service,omitempty"`
MatchersCondition string `yaml:"matchers-condition" json:"matchers_condition,omitempty"`
// 组件太多 采用层级匹配 优化匹配速度
Require []string `json:"require,omitempty"`
Matchers []*matchers.Matcher `json:"matchers,omitempty"`
Plugins []*Plugin `yaml:"plugins"`
Cpe map[string]interface{} `yaml:"cpe" json:"cpe,omitempty"`
}
func LoadRuleStrict ¶
LoadRuleStrict 与 LoadRule 类似,但用于严格校验: - 收集 YAML 解析错误 - 收集 matcher 编译错误 返回规则和累积错误(如果有)。
Click to show internal directories.
Click to hide internal directories.