Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Tools = make(map[string]SaftyTool)
Tools 存储所有注册的安全检查器 key: 检查器名称 value: 检查器实例
Functions ¶
func CheckContent ¶
func CheckContent(content interface{}) (types.CheckResult, error)
CheckContent 使用指定的检查器检查内容 参数:
- content: 要检查的内容,可以是任意类型
返回值:
- bool: 内容是否安全
- CheckResult: 检查结果,包括是否安全、风险级别、原因和详细信息
- error: 检查过程中发生的错误
func CheckContentByToolName ¶
func CheckContentByToolName(toolName string, content interface{}) (types.CheckResult, error)
CheckContentByToolName 使用指定的检查器检查内容 参数:
- toolName: 要使用的检查器名称
- content: 要检查的内容,可以是任意类型
返回值:
- bool: 内容是否安全
- CheckResult: 检查结果,包括是否安全、风险级别、原因和详细信息
- error: 检查过程中发生的错误
func InitSaftyTools ¶
func InitSaftyTools() error
InitSaftyTools 初始化所有安全检查器 在系统启动时调用此函数来注册所有可用的安全检查器
Types ¶
type SaftyTool ¶
type SaftyTool interface {
// Name 返回检查器的名称
Name() string
// Init 初始化检查器
// 返回值:
// - error: 初始化过程中发生的错误
Init() error
// Check 执行内容安全检查
// 参数:
// - data: 要检查的内容
// 返回值:
// - bool: 内容是否安全
// - types.CheckResult: 检查结果
// - error: 检查过程中发生的错误
Check(data string) (types.CheckResult, error)
}
SaftyTool 定义了内容安全检查器的接口 所有具体的安全检查器都需要实现这个接口
Click to show internal directories.
Click to hide internal directories.