model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Encrpt_Type_Hash int32 = iota + 1
	Encrpt_Type_Cover
	Encrpt_Type_Replace
	Encrpt_Type_Transform
)
View Source
const (
	Encrpt_SubType_Hash_Sha1 int32 = Encrpt_Type_Hash<<16 + iota + 1
	Encrpt_SubType_Hash_Sha256
	Encrpt_SubType_Hash_Hmac
)
View Source
const (
	Encrpt_SubType_Cover_Full int32 = Encrpt_Type_Cover<<16 + iota + 1
	Encrpt_SubType_Cover_ByPos
	Encrpt_SubType_Cover_ByStr
)
View Source
const (
	Encrpt_SubType_Replace_Full int32 = Encrpt_Type_Replace<<16 + iota + 1
	Encrpt_SubType_Replace_ByStr
	Encrpt_SubType_Replace_FPE
)
View Source
const (
	Encrpt_SubType_Transform_ForFloat int32 = Encrpt_Type_Transform<<16 + iota + 1
	Encrpt_SubType_Transform_ForDate
	Encrpt_SubType_Transform_ForStr
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CoverByPositionEncrypter

type CoverByPositionEncrypter struct {
	Replacer     string
	Locs         [][2]int16
	RandomSelect bool
}

func (*CoverByPositionEncrypter) Handle

func (h *CoverByPositionEncrypter) Handle(input interface{}) (interface{}, error)

func (*CoverByPositionEncrypter) Init

func (h *CoverByPositionEncrypter) Init()

type CoverByStrEncrypter

type CoverByStrEncrypter struct {
	Replacer     string
	Strings      []string
	RandomSelect bool
	// contains filtered or unexported fields
}

func (*CoverByStrEncrypter) Handle

func (h *CoverByStrEncrypter) Handle(input interface{}) (interface{}, error)

func (*CoverByStrEncrypter) Init

func (h *CoverByStrEncrypter) Init()

type CoverFullEncrypter

type CoverFullEncrypter struct {
	Replacer     string
	RandomSelect bool
}

func (*CoverFullEncrypter) Handle

func (h *CoverFullEncrypter) Handle(input interface{}) (interface{}, error)

func (*CoverFullEncrypter) Init

func (h *CoverFullEncrypter) Init()

type DecrptHandler

type DecrptHandler interface {
	HandleVersa(input interface{}) (interface{}, error)
}

type EncrypHandler

type EncrypHandler interface {
	Init()
	Handle(input interface{}) (interface{}, error)
}

type EncryptRule

type EncryptRule struct {
	Id          int64  `xorm:"pk autoincr"`
	Name        string `xorm:"unique"`
	Title       string
	Description string
	Matcher     string
	Encrypter   *Encrypter `xorm:"json"`
	Disabled    bool       //默认为启动状态,加强防护
	// contains filtered or unexported fields
}

智能脱敏配置规则

func (*EncryptRule) Handle

func (e *EncryptRule) Handle(value interface{}) (interface{}, error)

func (*EncryptRule) HandleVersa

func (e *EncryptRule) HandleVersa(value interface{}) (interface{}, error)

func (*EncryptRule) Init

func (e *EncryptRule) Init()

func (*EncryptRule) Match

func (e *EncryptRule) Match(value interface{}) bool

func (*EncryptRule) SupportDecrpt

func (e *EncryptRule) SupportDecrpt() bool

type Encrypter

type Encrypter struct {
	Type      int32
	Encrypter EncrypHandler
	Decrypter DecrptHandler
}

func (*Encrypter) MarshalJSON

func (s *Encrypter) MarshalJSON() ([]byte, error)

func (*Encrypter) UnmarshalJSON

func (s *Encrypter) UnmarshalJSON(data []byte) error

func (*Encrypter) UnmarshalYAML

func (s *Encrypter) UnmarshalYAML(value *yaml.Node) error

func (*Encrypter) Valid

func (s *Encrypter) Valid() bool

func (*Encrypter) ViseVersa

func (s *Encrypter) ViseVersa() bool

type FpeEncrypter

type FpeEncrypter struct {
	Key   string
	Tweak string
	// contains filtered or unexported fields
}

func (*FpeEncrypter) Handle

func (h *FpeEncrypter) Handle(input interface{}) (interface{}, error)

func (*FpeEncrypter) HandleVersa

func (h *FpeEncrypter) HandleVersa(input interface{}) (interface{}, error)

func (*FpeEncrypter) Init

func (h *FpeEncrypter) Init()

type HashHMACEncrypter

type HashHMACEncrypter struct {
	Secret    string
	Mechenism string
}

func (*HashHMACEncrypter) Handle

func (h *HashHMACEncrypter) Handle(input interface{}) (interface{}, error)

func (*HashHMACEncrypter) Init

func (h *HashHMACEncrypter) Init()

type HashSHA1Encrypter

type HashSHA1Encrypter struct {
}

func (*HashSHA1Encrypter) Handle

func (h *HashSHA1Encrypter) Handle(input interface{}) (interface{}, error)

func (*HashSHA1Encrypter) Init

func (h *HashSHA1Encrypter) Init()

type HashSHA256Encrypter

type HashSHA256Encrypter struct {
}

func (*HashSHA256Encrypter) Handle

func (h *HashSHA256Encrypter) Handle(input interface{}) (interface{}, error)

func (*HashSHA256Encrypter) Init

func (h *HashSHA256Encrypter) Init()

type QpsManager

type QpsManager struct {
	QMap sync.Map
	// contains filtered or unexported fields
}

func (*QpsManager) Init

func (q *QpsManager) Init()

func (*QpsManager) Request

func (q *QpsManager) Request(path string, targetQps int64) bool

type ReplacerByStrEncrypter

type ReplacerByStrEncrypter struct {
	Strings map[string]string
	// contains filtered or unexported fields
}

func (*ReplacerByStrEncrypter) Handle

func (h *ReplacerByStrEncrypter) Handle(input interface{}) (interface{}, error)

func (*ReplacerByStrEncrypter) Init

func (h *ReplacerByStrEncrypter) Init()

type ReplacerFullEncrypter

type ReplacerFullEncrypter struct {
	Replacer string
}

func (*ReplacerFullEncrypter) Handle

func (h *ReplacerFullEncrypter) Handle(input interface{}) (interface{}, error)

func (*ReplacerFullEncrypter) Init

func (h *ReplacerFullEncrypter) Init()

type SmartEncrypter

type SmartEncrypter struct {
	Rules map[string]*EncryptRule
}

func (*SmartEncrypter) AddOrUpdate

func (s *SmartEncrypter) AddOrUpdate(rule *EncryptRule)

AddOrUpdate 添加或更新规则

func (*SmartEncrypter) DeleteById

func (s *SmartEncrypter) DeleteById(id int64)

func (*SmartEncrypter) DisableById

func (s *SmartEncrypter) DisableById(id int64)

func (*SmartEncrypter) EnableById

func (s *SmartEncrypter) EnableById(id int64)

func (*SmartEncrypter) HandleByRule

func (g *SmartEncrypter) HandleByRule(name string, value interface{}) (interface{}, error)

func (*SmartEncrypter) HandleVersaByRule

func (g *SmartEncrypter) HandleVersaByRule(name string, value interface{}) (interface{}, error)

func (*SmartEncrypter) Init

func (s *SmartEncrypter) Init(rules []*EncryptRule)

func (*SmartEncrypter) Match

func (g *SmartEncrypter) Match(value interface{}) string

type SourceIPRange

type SourceIPRange struct {
	Id       int64 `xorm:"pk autoincr"`
	SourceId int64
	CIDR     *net.IPNet `xorm:"json"`
	Mark     byte
	Denied   bool //是否为黑名单
}

type TransformForDate

type TransformForDate struct {
	Origin  string
	Formate string
}

func (*TransformForDate) Handle

func (h *TransformForDate) Handle(input interface{}) (interface{}, error)

func (*TransformForDate) Init

func (h *TransformForDate) Init()

type TransformForFloat

type TransformForFloat struct {
	Fixed int
	// contains filtered or unexported fields
}

func (*TransformForFloat) Handle

func (h *TransformForFloat) Handle(input interface{}) (interface{}, error)

func (*TransformForFloat) Init

func (h *TransformForFloat) Init()

type TransformForString

type TransformForString struct {
	Locs    [][2]int16
	Formate []int
	// contains filtered or unexported fields
}

从选定的位置获取字符,组成新的字符,并按位设置到新的位置,比如Formate设置为135790246,则按位取原数据拼成新数据

func (*TransformForString) Handle

func (h *TransformForString) Handle(input interface{}) (interface{}, error)

func (*TransformForString) Init

func (h *TransformForString) Init()

Jump to

Keyboard shortcuts

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