Versions in this module Expand all Collapse all v1 v1.0.2 Sep 18, 2023 v1.0.1 Sep 13, 2023 Changes in this version + type AesOption struct + Mode string type GoAES + func NewAES(key []byte, opt *AesOption) *GoAES + func (a *GoAES) DecryptV2(crypted []byte) ([]byte, error) + func (a *GoAES) EncryptV2(origData []byte) ([]byte, error) v1.0.0 Aug 28, 2018 Changes in this version + const Oneday + const RSAAlgorithmSign + func BinFileToStruct(filepath string, to interface{}) error + func BytesToFile(data []byte, filepath string) error + func BytesToImage(imgbytes []byte, filepath string) error + func BytesToStruct(data []byte, to interface{}) error + func CryptPassword(password, salt string) string + func CurrentDir() string + func CurrentUser() string + func GenRandomString(length int, specialChar string) string + func GetMD5(text string) string + func GetNowTime() string + func GetNowTime2() string + func GetNowTimeStamp() int64 + func ImageToBytes(filepath string) ([]byte, error) + func ImageType(imgbytes []byte) string + func InStringSlice(s []string, x string) (bool, int) + func IsExist(name string) bool + func IsNumber(input string) bool + func JSONBytesToFile(data []byte, filepath string) error + func JSONBytesToStruct(data []byte, structObj interface{}) error + func JSONFileToBytes(filepath string) ([]byte, error) + func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte + func NewRSAFile(pubKeyFilename, priKeyFilename string, keyLength int) error + func NewRSAString(keyLength int) (string, string, error) + func QRCodeParse(fi io.Reader) (string, error) + func ReadRSAKeyPair(pubKeyFilename, priKeyFilename string) ([]byte, []byte, error) + func SendMessage(notice Notice) (bool, error) + func StructToBinFile(structObj interface{}, filepath string) error + func StructToBytes(structObj interface{}) ([]byte, error) + func TwoStepAuthGenNumber(t *TOTP) (string, int64, error) + func UserHome() (string, error) + func WriteRSAKeyPair(publicKeyWriter, privateKeyWriter io.Writer, keyLength int) error + type BoltDB struct + DBPath string + TableName string + func NewBoltDB(dbPath, tableName string) (*BoltDB, error) + func (btb *BoltDB) Backup(filepath string) error + func (btb *BoltDB) Delete(keys []string) error + func (btb *BoltDB) Get(keys []string) (map[string][]byte, error) + func (btb *BoltDB) GetAll() (map[string][]byte, error) + func (btb *BoltDB) Set(kv map[string][]byte) error + type DingTalkClient struct + Message *DingTalkMessage + RobotURL string + func (d *DingTalkClient) SendMessage() (bool, error) + type DingTalkMessage struct + Message string + Title string + Type string + type EmailClient struct + Host string + Message *EmailMessage + Password string + Port int + Username string + func NewEmailClient(host, username, password string, port int, message *EmailMessage) *EmailClient + func (c *EmailClient) SendMessage() (bool, error) + type EmailMessage struct + Attach string + Cc []string + Content string + ContentType string + From string + Subject string + To []string + func NewEmailMessage(from, subject, contentType, content, attach string, to, cc []string) *EmailMessage + type GoAES struct + Key []byte + func NewGoAES(key []byte) *GoAES + func (a *GoAES) Decrypt(crypted []byte) ([]byte, error) + func (a *GoAES) Encrypt(origData []byte) ([]byte, error) + type GoRSA struct + PrivateKey *rsa.PrivateKey + PublicKey *rsa.PublicKey + func NewGoRSA(pubKeyFilename, priKeyFilename string) (*GoRSA, error) + func (r *GoRSA) PrivateDecrypt(encrypted []byte) ([]byte, error) + func (r *GoRSA) PublicEncrypt(data []byte) ([]byte, error) + func (r *GoRSA) Sign(data string) (string, error) + func (r *GoRSA) Verify(data string, sign string) error + type HLog struct + FileNameDateFormat string + IsSeparateLevelLog bool + LogLevel log.Level + LogPath string + LogType string + MaxAge time.Duration + RotationTime time.Duration + TimestampFormat string + func NewHLog(logpath string) (*HLog, error) + func (hl *HLog) GetLogger() (*HLogger, error) + func (hl *HLog) SetDateFormat(format string) + func (hl *HLog) SetLevel(level string) + func (hl *HLog) SetLogType(logType string) + func (hl *HLog) SetMaxAge(day time.Duration) + func (hl *HLog) SetRotationTime(day time.Duration) + func (hl *HLog) SetSeparateLevelLog(yes bool) + type HLogger struct + func (logger *HLogger) Debug(commonFields map[string]interface{}, message string) + func (logger *HLogger) Error(commonFields map[string]interface{}, message string) + func (logger *HLogger) Fatal(commonFields map[string]interface{}, message string) + func (logger *HLogger) Info(commonFields map[string]interface{}, message string) + func (logger *HLogger) Panic(commonFields map[string]interface{}, message string) + func (logger *HLogger) Warn(commonFields map[string]interface{}, message string) + type JWToken struct + SignString string + func NewJWToken(signString string) *JWToken + func (t *JWToken) GenJWToken(rawContent map[string]interface{}) (string, error) + func (t *JWToken) ParseJWToken(tokenString string) (map[string]interface{}, error) + type Notice interface + SendMessage func() (bool, error) + type TOTP struct + Algorithm string + Digits int + Issuer string + Name string + SecretKey string + func TwoStepAuthParseQRCode(qrcodePath string) (*TOTP, error)