Documentation
¶
Index ¶
Constants ¶
View Source
const SafeDefaultErrorCode = "content_security_policy_blocking"
View Source
const SafeDefaultErrorMessage = "content contains sensitive information"
View Source
const SafeDefaultSuccessCode = "content_security_policy_through"
View Source
const SafeDefaultSuccessMessage = "content safe"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckConfig ¶
type CheckConfig struct {
// Threshold 检查阈值,用于判断内容是否安全
Threshold float64 `json:"threshold"`
// Options 其他配置选项,具体含义由检查器自行定义
Options map[string]interface{} `json:"options,omitempty"`
}
CheckConfig 定义了安全检查器的配置
type CheckResult ¶
type CheckResult struct {
// IsSafe 表示内容是否安全
IsSafe bool `json:"is_safe"`
// 安全原因代码
Code string `json:"code"`
// Reason 如果不安全,说明原因
Reason string `json:"reason,omitempty"`
// Details 详细的检查结果,可能包含多个违规项
Details []string `json:"details,omitempty"`
// RiskLevel 风险等级,数值越大风险越高
RiskLevel int `json:"risk_level,omitempty"`
}
CheckResult 定义了内容安全检查的结果
Click to show internal directories.
Click to hide internal directories.