Documentation ¶
Index ¶
- Constants
- func AesDecrypt(encrypted, key []byte) ([]byte, error)
- func AesDecryptV2(crypted, key []byte) ([]byte, error)
- func AesEncrypt(src, key string) ([]byte, error)
- func AesEncryptV2(src, key string) ([]byte, error)
- func Base64Decode(str string) (string, error)
- func Base64Encode(str string) string
- func Bin2hex(binStr string) string
- func BytesToString(b []byte) string
- func CompareSortedStrings(lhs, rhs []string) bool
- func CompareVersion(ver1, ver2 string, ignoreCase ...bool) int
- func Copy(toValue interface{}, fromValue interface{}) (err error)
- func DecodeAQid(qStr string) (qid int, err error)
- func DecodeCid(qStr string) (qid int, err error)
- func DecodeLid(qStr string) (qid int, err error)
- func DecodeOuid(qStr string) (qid int, err error)
- func DecodeQid(qstr string, qType int) (qid int, err error)
- func DecodeUid(qStr string) (qid int, err error)
- func DecryptDesEcb(src, key string, paddingType int) (d string, err error)
- func DeviceUUIDByMAC() string
- func DiffStrings(oldStrings, newStrings []string) ([]string, []string)
- func DoZlibCompress(src []byte) ([]byte, error)
- func DoZlibUnCompress(compressSrc []byte) ([]byte, error)
- func EncodeAQid(qid int) (e string, err error)
- func EncodeCid(qid int) (e string, err error)
- func EncodeLid(qid int) (e string, err error)
- func EncodeOuid(qid int) (e string, err error)
- func EncodeQid(qid, qType int) (e string, err error)
- func EncodeUid(qid int) (e string, err error)
- func EncryptDesEcb(src, key string, paddingType int) (e string, err error)
- func Exists(path string) bool
- func FileSize(file string) (int64, error)
- func Format(format string, t time.Time) string
- func FormatTimeByUnixSec(sec int64) string
- func GenUUID() string
- func GetClientIp(ctx context.Context) string
- func GetContextValue(ctx context.Context, key string) (value any)
- func GetContextValueInt64(ctx context.Context, key string) (value int64)
- func GetContextValueString(ctx context.Context, key string) (value string)
- func GetFormatRequestTime(time time.Time) string
- func GetFunctionName(i interface{}, seps ...rune) string
- func GetHandler(ctx context.Context) (handler string)
- func GetLocalIPList() []string
- func GetLocalIp() string
- func GetLocalServerID() (string, error)
- func GetMacAddr() (macAddr string, err error)
- func GetRequestCost(start, end time.Time) float64
- func GetUuidString() string
- func GetUuidUInt64() uint64
- func Hex2bin(hexStr string) (string, error)
- func InitUnCompress(sourceReader io.Reader) (obj *unCompress)
- func Int64SliceToString(s []int64, sepF ...string) string
- func Int64sContain(a []int64, x int64) bool
- func IntStringContain(a []string, x string) bool
- func IsExist(path string) bool
- func IsJsonMap(s string) bool
- func IsJsonSlice(s string) bool
- func IsJsonString(s string) bool
- func IsStringNotEmpty(str ...string) bool
- func JoinArgs(showByte int, args ...interface{}) string
- func LoadConf(path string, cf interface{}) bool
- func LoadFile(path string) ([]byte, bool)
- func Md5(plain string) string
- func MultiJoinString(str ...string) string
- func NewMail() *mail
- func PKCS5Padding(cipherText []byte) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func PKCS7Padding(cipherText []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func RandNum(num ...int) int
- func Rc4Decode(key, encrypted string) (string, error)
- func Rc4DecodeBytes(key []byte, encrypted string) ([]byte, error)
- func Rc4Encode(key, plainText string) (string, error)
- func Rc4EncodeBytes(key, plainText []byte) (string, error)
- func SHA1()
- func SHA256()
- func SaveConf(conf interface{}, path string) bool
- func SetContextValue(ctx context.Context, key string, value any) context.Context
- func StrToUint(strNumber string, value interface{}) error
- func StringToBytes(s string) (b []byte)
- func StructToMap(obj interface{}) map[string]interface{}
- func UnmarshalJson(jsonVal []byte, objVal interface{}) error
- func Xor(arr []byte)
- func ZeroPadding(cipherText []byte, blockSize int) []byte
- func ZeroUnPadding(origData []byte) []byte
- type BufferPool
- type Conf
- type MailContact
Constants ¶
const ( PaddingTypePKCS7 = iota // 推荐使用 PaddingTypePKCS5 PaddingTypeZero // 不推荐使用 PaddingTypeNoPadding // 不要用 )
const HandlerName = "handlerName"
const INT32MAX = 4294967296
const MagicNum = 65521
const MagicNum2 = 65519
const NapiArticleCryptKey = "^.vAy$TT"
const NapiQuestionCryptKey = "iVPed<7K"
const QbQuestionCryptKey = "lVPed<8K"
const ZybChargeCryptKey = "^.vAy$TG"
const ZybLectureCryptKey = "*)<~0YZS"
const ZybOpenidCryptKey = "^.iC$eSC"
const ZybUidCryptKey = "^.vB>$TS"
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
func Base64Encode ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func CompareVersion ¶
CompareVersion 版本比较 -1: ver1 < ver2 0: ver1 == ver2 1: ver1 > ver2
func DecodeAQid ¶
func DecodeOuid ¶
func DecryptDesEcb ¶
ECB解密, 使用PKCS7进行填充
func DeviceUUIDByMAC ¶
func DeviceUUIDByMAC() string
func DiffStrings ¶
return adds, dels
func DoZlibUnCompress ¶
DoZlibUnCompress ZIP解压数据
func EncodeAQid ¶
func EncodeOuid ¶
func EncryptDesEcb ¶
ECB加密, 使用PKCS7进行填充
func Format ¶
Format 格式化时间 %Y-%m-%d %H:%I:%S This is an alternative to time.Format because no one knows what date 040305 is supposed to create when used as a 'layout' string this takes standard strftime format options. For a complete list of format options see http://strftime.org/
func FormatTimeByUnixSec ¶
func GetClientIp ¶
过 ingress 的请求clientIp 优先从 "X-Original-Forwarded-For" 中获取
func GetContextValueInt64 ¶
func GetContextValueString ¶
func GetFormatRequestTime ¶
func GetHandler ¶
func GetLocalServerID ¶
func GetRequestCost ¶
func GetUuidString ¶
func GetUuidString() string
func GetUuidUInt64 ¶
func GetUuidUInt64() uint64
func InitUnCompress ¶
func Int64SliceToString ¶
func Int64sContain ¶
func IntStringContain ¶
func IsJsonSlice ¶
func IsJsonString ¶
func IsStringNotEmpty ¶
func MultiJoinString ¶
func NewMail ¶
func NewMail() *mail
NewMail 构造新邮件实例
NewMail().Server(host, port).Auth(username, password).Timeout(5*time.Second).WithTLS().WithHTML().Content(subject, content).Send(sendto, from) 构造实例 -> 服务器信息 -> 用户认证信息 -> 设置连接超时(optional) -> 启用SSL(optional) -> 使用text/html(optional) -> 填写邮件内容 -> 投递邮件
func PKCS5UnPadding ¶
func PKCS7Padding ¶
假设数据长度需要填充n(n>0)个字节才对齐,那么填充n个字节,每个字节都是n; 如果数据本身就已经对齐了,则填充一块长度为块大小的数据,每个字节都是块大小
func PKCS7UnPadding ¶
func Rc4EncodeBytes ¶
func SetContextValue ¶
SetContextValue 上下文设置值 注意!如果是go默认的上下文,则需要重建ctx,注意接收,否则不生效
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
func UnmarshalJson ¶
func ZeroPadding ¶
ZeroPadding,数据长度不对齐时使用0填充,否则不填充 只适合以\0结尾的字符串加解密
func ZeroUnPadding ¶
Types ¶
type BufferPool ¶
type MailContact ¶
type MailContact struct {
// contains filtered or unexported fields
}
MailContact 邮件联系人
func NewMailContact ¶
func NewMailContact(name, email string) *MailContact