header

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// Enable 启用脱敏功能
	Enable()

	// Disable 禁用脱敏功能
	Disable()

	// IsEnabled 检查脱敏功能是否已启用
	IsEnabled() bool

	// RegisterStrategy 注册新的脱敏策略
	RegisterStrategy(name string, strategy dlp.DesensitizeFunc)
}

Config 配置接口定义

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine 实现了 EngineAPI 接口

func NewEngine

func NewEngine() (*Engine, error)

NewEngine 创建新的DLP引擎实例

func (*Engine) Config

func (e *Engine) Config() Config

Config 获取配置接口

func (*Engine) Deidentify

func (e *Engine) Deidentify(text string) (string, string, error)

Deidentify 对文本进行默认脱敏处理

func (*Engine) DesensitizeStruct

func (e *Engine) DesensitizeStruct(data interface{}) error

DesensitizeStruct 对结构体进行脱敏处理

func (*Engine) DesensitizeText

func (e *Engine) DesensitizeText(text string) string

DesensitizeText 对文本进行脱敏处理

func (*Engine) Mask

func (e *Engine) Mask(text string, model string) (string, error)

Mask 使用指定模型对文本进行脱敏

type EngineAPI

type EngineAPI interface {
	// Config 获取配置接口
	Config() Config

	// DesensitizeText 对文本内容进行脱敏处理
	DesensitizeText(text string) string

	// DesensitizeStruct 对结构体进行脱敏处理
	DesensitizeStruct(data interface{}) error

	// Mask 使用指定模型对文本进行脱敏
	Mask(text string, model string) (string, error)

	// Deidentify 对文本进行默认脱敏处理
	Deidentify(text string) (string, string, error)
}

EngineAPI 定义了DLP引擎必须实现的接口

Jump to

Keyboard shortcuts

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