middleware

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PASSWORD_LEN  = 12
	DEFALT_CIPHER = "CIPHER_A"
)

Variables

View Source
var (
	LogHttp *zap.Logger
	//LogCron *zap.Logger
	HttpLogEnable bool
)
View Source
var CIPHER_MAP = map[string]string{
	"CIPHER_A": "{cipher_a}",
}
View Source
var LocalMem = make(map[string]m.Session)
View Source
var RedisClient *redis.Client

Functions

func AesCBCDncrypt added in v1.0.1

func AesCBCDncrypt(encryptData, key []byte) ([]byte, error)

func AesCBCEncrypt added in v1.0.1

func AesCBCEncrypt(rawData, key []byte) ([]byte, error)

aes加密,填充秘钥key的16位,24,32分别对应AES-128, AES-192, or AES-256.

func AesDePassword added in v1.4.0

func AesDePassword(guid, seed, password string) (string, error)

func AesDecode added in v1.4.0

func AesDecode(key string, encryptData string) (password string, err error)

func AesEnPassword added in v1.4.0

func AesEnPassword(guid, seed, password, cipher string) (string, error)

func AesEncode added in v1.4.0

func AesEncode(key string, rawData string) (string, error)

func CreateRandomPassword added in v1.4.0

func CreateRandomPassword() string

func DelSession

func DelSession(sId string)

func Dncrypt added in v1.0.1

func Dncrypt(rawData string) (string, error)

func Encrypt added in v1.0.1

func Encrypt(rawData []byte) (string, error)

func GetOperateUser

func GetOperateUser(c *gin.Context) string

func GetSessionData

func GetSessionData(sId string) m.Session

func InitMonitorLog

func InitMonitorLog()

func InitSession added in v1.0.1

func InitSession()

func IsActive

func IsActive(sId string) bool

func IsIllegalCond added in v1.1.0

func IsIllegalCond(str string) bool

func IsIllegalLast added in v1.1.0

func IsIllegalLast(str string) bool

func IsIllegalName

func IsIllegalName(str string) bool

func LogError

func LogError(s string, e error)

func LogInfo

func LogInfo(s string)

func Md5Encode added in v1.4.0

func Md5Encode(rawData string) string

func PKCS7Padding added in v1.0.1

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding added in v1.0.1

func PKCS7UnPadding(origData []byte) []byte

func Return

func Return(c *gin.Context, j RespJson)

func ReturnData

func ReturnData(c *gin.Context, data interface{})

func ReturnError

func ReturnError(c *gin.Context, msg string, err error)

func ReturnSuccess

func ReturnSuccess(c *gin.Context, msg string)

func ReturnValidateFail

func ReturnValidateFail(c *gin.Context, msg string)

func SaveSession

func SaveSession(session m.Session) (isOk bool, sId string)

func ValidateGet

func ValidateGet(c *gin.Context)

func ValidatePost

func ValidatePost(c *gin.Context, obj interface{}, ex ...string) bool

Types

type RespJson

type RespJson struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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