types

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

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 定义了内容安全检查的结果

Jump to

Keyboard shortcuts

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