catalog

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package catalog 由规则文件中的产品声明生成 SDK 的内置产品目录(sdk/catalog.json)。

产品目录不再手工维护:每条内置规则在 info.product 中声明产品,同一产品标识的声明在 全部规则中完全相同;目录按产品标识归并声明并列出声明它的规则标识。生成结果是确定的 (产品按标识排序,规则标识排序),SDK 的测试断言入库的 catalog.json 与规则文件一致。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(fsys fs.FS) ([]byte, error)

Generate 返回 fsys 中规则对应的 catalog.json 内容:两个空格缩进,不转义 HTML 字符,以换行结尾。

Types

type Product

type Product struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Vendor      string   `json:"vendor,omitempty"`
	Category    string   `json:"category,omitempty"`
	Identity    string   `json:"identity,omitempty"`
	Assurance   string   `json:"assurance,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Aliases     []string `json:"aliases,omitempty"`
	CPE         []string `json:"cpe,omitempty"`
	References  []string `json:"references,omitempty"`
	Description string   `json:"description,omitempty"`
	RuleIDs     []string `json:"rule_ids"`
}

Product 是目录中的一个产品,字段与 sdk.ProductDefinition 的 JSON 形式相同。

func Build

func Build(fsys fs.FS) ([]Product, error)

Build 读取 fsys 中的全部规则,返回按产品标识排序的产品目录。内置规则库要求每条规则都 声明产品、规则标识不重复、同一产品标识的声明完全相同,任一不满足即返回错误。

Directories

Path Synopsis
命令 gen 由规则文件的产品声明生成 SDK 的内置产品目录。
命令 gen 由规则文件的产品声明生成 SDK 的内置产品目录。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL