handler

package
v0.0.0-...-ea31202 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Manager    go_cache.CacheManager
	IpMap      *sync.Map
	PrivateKey *rsa.PrivateKey
)
View Source
var (
	RsaDecryptErrorMsg = "解密失败"
)

Functions

func CheckErrWithCode

func CheckErrWithCode(err error, code StatusCode, c *gin.Context) (ref bool)

func CheckWithCode

func CheckWithCode(ok bool, code StatusCode, c *gin.Context) (ref bool)

func PingHandler

func PingHandler(c *gin.Context)

func SetCacheManager

func SetCacheManager(mem uint64, shardSize uintptr, mode uint8) func()

func SetIpMap

func SetIpMap(_ipMap *sync.Map)

func SetPrivateKey

func SetPrivateKey(privateKeyPath string) error

Types

type ApiResponse

type ApiResponse struct {
	Msg  string     `json:"err,omitempty"`
	Data string     `json:"data,omitempty"`
	Code StatusCode `json:"code,omitempty"`
}

type StatusCode

type StatusCode int
const (
	SUCCESS StatusCode = 0

	DecodeError StatusCode = 1001
	EncodeError StatusCode = 1002
	MapPutError StatusCode = 2001

	RsaDecryptError StatusCode = 4001
	RsaEncryptError StatusCode = 4002

	RasCipherTextUnValidError StatusCode = 4003
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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