Documentation
¶
Index ¶
- Variables
- func ArrayToString(array []interface{}) string
- func Decrypt(privateKeyFile, ciphertext string, types string) (plaintext string, err error)
- func DecryptOAEP(privateKeyFile, ciphertext string) (plaintext string, err error)
- func DecryptPKCS1v15(privateKeyFile, ciphertext string) (plaintext string, err error)
- func Encrypt(privateKeyFile, ciphertext string, types string) (plaintext string, err error)
- func EncryptOAEP(publicKeyFile string, content string) (ciphertext string, err error)
- func EncryptPKCS1v15(publicKeyFile string, content string) (ciphertext string, err error)
- func EncryptPassword(password string, salt string) (string, error)
- func EncryptString(data string) (encrypt string, err error)
- func EqualFoldWithoutChars(s1, s2 string) bool
- func FormatCmdKey(s string) string
- func FormatEnvKey(s string) string
- func GenerateKeyPair(bits int, privateKeyFile string, publicKeyFile string) (err error)
- func IpInBlackListRange(ip string, ipList []string) (result bool)
- func IsDebugEnabled() bool
- func IsEmpty(value interface{}) bool
- func IsFloat(value interface{}) bool
- func IsInt(value interface{}) bool
- func IsLetter(b byte) bool
- func IsLetterLower(b byte) bool
- func IsLetterUpper(b byte) bool
- func IsMap(value interface{}) bool
- func IsNil(value interface{}) bool
- func IsNumeric(s string) bool
- func IsSlice(value interface{}) bool
- func IsStruct(value interface{}) bool
- func IsUint(value interface{}) bool
- func MapContainsPossibleKey(data map[string]interface{}, key string) bool
- func MapPossibleItemByKey(data map[string]interface{}, key string) (foundKey string, foundValue interface{})
- func ParseIpRange(cidr string) ([]string, error)
- func ParsePrivateKeyFromPEM(pemBytes []byte) (privateKey *rsa.PrivateKey, err error)
- func ParsePublicKeyFromPEM(pemBytes []byte) (publicKey *rsa.PublicKey, err error)
- func RemoveSymbols(s string) string
- func Replace(pattern string, replace, src []byte) ([]byte, error)
- func ReplaceByMap(origin string, replaces map[string]string) string
- func ReplaceString(pattern, replace, src string) (string, error)
- func ReplaceTemplate(content string, variable map[string]interface{}) (result string, err error)
- func SavePrivateKeyToFile(privateKey *rsa.PrivateKey, filename string) (err error)
- func SavePublicKeyToFile(publicKey *rsa.PublicKey, filename string) (err error)
- func SetDebugEnabled(enabled bool)
- func SplitAndTrim(str, delimiter string, characterMask ...string) []string
- func StripSlashes(str string) string
- func StructToMap(obj interface{}) map[string]interface{}
- func Trim(str string, characterMask ...string) string
- func UcFirst(s string) string
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultTrimChars are the characters which are stripped by Trim* functions in default. DefaultTrimChars = string([]byte{ '\t', '\v', '\n', '\r', '\f', ' ', 0x00, 0x85, 0xA0, }) )
Functions ¶
func ArrayToString ¶
func ArrayToString(array []interface{}) string
func DecryptOAEP ¶ added in v0.0.2
DecryptOAEP 使用私钥解密数据
func DecryptPKCS1v15 ¶ added in v0.0.2
DecryptPKCS1v15 使用私钥解密数据
func EncryptOAEP ¶ added in v0.0.2
EncryptOAEP 使用公钥加密数据
func EncryptPKCS1v15 ¶ added in v0.0.2
EncryptPKCS1v15 使用公钥加密数据
func EncryptPassword ¶ added in v0.0.2
func EncryptString ¶ added in v0.0.2
EncryptString encrypts `data` using MD5 algorithms.
func EqualFoldWithoutChars ¶
EqualFoldWithoutChars checks string `s1` and `s2` equal case-insensitively, with/without chars '-'/'_'/'.'/' '.
func FormatCmdKey ¶
FormatCmdKey formats string `s` as command key using uniformed format.
func FormatEnvKey ¶
FormatEnvKey formats string `s` as environment key using uniformed format.
func GenerateKeyPair ¶ added in v0.0.2
GenerateKeyPair 生成RSA密钥对
func IpInBlackListRange ¶ added in v0.0.2
IpInBlackListRange 判断IP是否在黑名单
func IsDebugEnabled ¶
func IsDebugEnabled() bool
IsDebugEnabled checks and returns whether debug mode is enabled. The debug mode is enabled when command argument "gf.debug" or environment "GF_DEBUG" is passed.
func IsFloat ¶
func IsFloat(value interface{}) bool
IsFloat checks whether `value` is type of float.
func IsLetterLower ¶
IsLetterLower checks whether the given byte b is in lower case.
func IsLetterUpper ¶
IsLetterUpper checks whether the given byte b is in upper case.
func IsNil ¶
func IsNil(value interface{}) bool
IsNil checks whether `value` is nil, especially for interface{} type value.
func IsNumeric ¶
IsNumeric checks whether the given string s is numeric. Note that float string like "123.456" is also numeric.
func IsSlice ¶
func IsSlice(value interface{}) bool
IsSlice checks whether `value` is type of slice.
func IsStruct ¶
func IsStruct(value interface{}) bool
IsStruct checks whether `value` is type of struct.
func MapContainsPossibleKey ¶
MapContainsPossibleKey checks if the given `key` is contained in given map `data`. It checks the key ignoring cases and symbols.
Note that this function might be of low performance.
func MapPossibleItemByKey ¶
func MapPossibleItemByKey(data map[string]interface{}, key string) (foundKey string, foundValue interface{})
MapPossibleItemByKey tries to find the possible key-value pair for given key ignoring cases and symbols.
Note that this function might be of low performance.
func ParseIpRange ¶ added in v0.0.2
ParseIpRange 用于将以 "," 分割的多个 CIDR 范围字符串解析为 CIDR 数组。 如果一个 CIDR 范围是以 "-" 分割的两个 IP 地址,那么我们会使用 binaryToInt 和 intToIP 函数将它们转换为整数并再次转换为 CIDR 字符串, 并将其加入到 CIDR 数组中。
func ParsePrivateKeyFromPEM ¶ added in v0.0.2
func ParsePrivateKeyFromPEM(pemBytes []byte) (privateKey *rsa.PrivateKey, err error)
ParsePrivateKeyFromPEM 从 PEM 格式的字节切片中解析 RSA 私钥
func ParsePublicKeyFromPEM ¶ added in v0.0.2
ParsePublicKeyFromPEM 从 PEM 格式的字节切片中解析 RSA 公钥
func RemoveSymbols ¶
RemoveSymbols removes all symbols from string and lefts only numbers and letters.
func ReplaceByMap ¶
ReplaceByMap returns a copy of `origin`, which is replaced by a map in unordered way, case-sensitively.
func ReplaceString ¶
ReplaceString replace all matched `pattern` in string `src` with string `replace`.
func ReplaceTemplate ¶ added in v0.0.2
func SavePrivateKeyToFile ¶ added in v0.0.2
func SavePrivateKeyToFile(privateKey *rsa.PrivateKey, filename string) (err error)
SavePrivateKeyToFile 将 RSA 私钥保存到文件
func SavePublicKeyToFile ¶ added in v0.0.2
SavePublicKeyToFile 将 RSA 公钥保存到文件
func SetDebugEnabled ¶
func SetDebugEnabled(enabled bool)
SetDebugEnabled enables/disables the internal debug info.
func SplitAndTrim ¶
SplitAndTrim splits string `str` by a string `delimiter` to an array, and calls Trim to every element of this array. It ignores the elements which are empty after Trim.
func StripSlashes ¶
StripSlashes un-quotes a quoted string by AddSlashes.
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package empty provides functions for checking empty/nil variables.
|
Package empty provides functions for checking empty/nil variables. |
|
Package ratelimit 提供了一个灵活的令牌桶实现,用于速率限制。
|
Package ratelimit 提供了一个灵活的令牌桶实现,用于速率限制。 |
|
Package reflection provides some reflection functions for internal usage.
|
Package reflection provides some reflection functions for internal usage. |
|
Package rwmutex provides switch of concurrent safety feature for sync.RWMutex.
|
Package rwmutex provides switch of concurrent safety feature for sync.RWMutex. |
|
Package gtag providing tag content storing for struct.
|
Package gtag providing tag content storing for struct. |