-
Notifications
You must be signed in to change notification settings - Fork 18
/
filters.go
35 lines (31 loc) · 956 Bytes
/
filters.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package filterconfigs
import "github.com/iwind/TeaGo/logs"
func init() {
for code, filter := range allFilters {
err := filter.Init()
if err != nil {
logs.Println("[FILTER]init '" + code + "' failed: " + err.Error())
}
}
}
// 所有的筛选条件
var allFilters = map[string]FilterInterface{
"md5": new(Md5Filter),
"urlEncode": new(URLEncodeFilter),
"urlDecode": new(URLDecodeFilter),
"base64Encode": new(Base64EncodeFilter),
"base64Decode": new(Base64DecodeFilter),
"unicodeEncode": new(UnicodeEncodeFilter),
"unicodeDecode": new(UnicodeDecodeFilter),
"htmlEscape": new(HTMLEscapeFilter),
"htmlUnescape": new(HTMLUnescapeFilter),
"length": new(LengthFilter),
"hex2dec": new(Hex2DecFilter),
"dec2hex": new(Dec2HexFilter),
"sha1": new(Sha1Filter),
"sha256": new(Sha256Filter),
}
// 查找Filter
func FindFilter(code string) FilterInterface {
return allFilters[code]
}