mask

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaskPartialDisplay = "partial-display"
	MaskPartialMask    = "partial-masking"
	MaskTruncation     = "truncation"
	MaskReplacement    = "replacement"
	MaskShuffling      = "shuffling"
)
View Source
const (
	ReplaceRandom = "random"
	ReplaceCustom = "custom"
)
View Source
const (
	MatchInner    = "inner"
	MatchKeyword  = "keyword"
	MatchRegex    = "regex"
	MatchJsonPath = "json_path"
)
View Source
const (
	MatchInnerValueName     = "name"
	MatchInnerValuePhone    = "phone"
	MatchInnerValueIDCard   = "id-card"
	MatchInnerValueBankCard = "bank-card"
	MatchInnerValueDate     = "date"
	MatchInnerValueAmount   = "amount"
)

Variables

This section is empty.

Functions

func RegisterMaskFactory

func RegisterMaskFactory(name string, factory IMaskFactory)

Types

type BasicItem

type BasicItem struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type DataMask

type DataMask struct {
	Rules []*Rule `json:"rules"`
}

type IInnerMask

type IInnerMask interface {
	Exec(body []byte) ([]byte, error)
}

type IMaskDriver

type IMaskDriver interface {
	Exec(body []byte) ([]byte, error)
	String() string
}

type IMaskFactory

type IMaskFactory interface {
	Create(cfg *Rule, maskFunc MaskFunc) (IMaskDriver, error)
}

func GetMaskFactory

func GetMaskFactory(name string) (IMaskFactory, bool)

type Mask

type Mask struct {
	Type    string     `json:"type"`
	Begin   int        `json:"begin"`
	Length  int        `json:"length"`
	Replace *BasicItem `json:"replace"`
}

type MaskFunc

type MaskFunc func(origin string) string

func GenMaskFunc

func GenMaskFunc(cfg *Mask) (MaskFunc, error)

type MaskManager

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

func NewMaskManager

func NewMaskManager() *MaskManager

func (*MaskManager) Del

func (m *MaskManager) Del(name string)

func (*MaskManager) Get

func (m *MaskManager) Get(name string) (IMaskFactory, bool)

func (*MaskManager) Register

func (m *MaskManager) Register(name string, driver IMaskFactory)

type Rule

type Rule struct {
	Match *BasicItem `json:"match"`
	Mask  *Mask      `json:"mask"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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