gins

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJwtRefreshToken

func GenerateJwtRefreshToken(secret string, duration time.Duration) (string, error)

func GenerateJwtToken

func GenerateJwtToken(secret string, duration time.Duration, memberId string, channel int64, accountPlat string, phonePlat int32, deviceID string) (string, error)

func HttpJsonResponse

func HttpJsonResponse(g *gin.Context, httpCode int, err error, data JsonResponse)

返回json response

func JWT

func JWT() gin.HandlerFunc

获取远程客户端ip要设置SetTrustedProxies 参考 https://www.cnblogs.com/mayanan/p/15703234.html

Types

type BaseJsonResponse

type BaseJsonResponse struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg"`
}

func (*BaseJsonResponse) SetCode

func (self *BaseJsonResponse) SetCode(v int32)

func (*BaseJsonResponse) SetMsg

func (self *BaseJsonResponse) SetMsg(v string)

type Claims

type Claims struct {
	jwt.StandardClaims
	MemberId    string `json:"member_id"`
	AccountPlat string `json:"account_plat"`
	PhonePlat   int32  `json:"phone_plat"`
	DeviceId    string `json:"device_id"`
	Channel     int64  `json:"channel"`
}

func ParseJwtToken

func ParseJwtToken(token string, secret string) (*Claims, error)

type HttpServer

type HttpServer struct {
	Handler http.Handler
	// contains filtered or unexported fields
}

func NewConfigHttpServer

func NewConfigHttpServer(ctx context.Context, config gira.HttpConfig, router http.Handler) (*HttpServer, error)

func (*HttpServer) Serve

func (self *HttpServer) Serve() error

func (*HttpServer) Stop

func (self *HttpServer) Stop() error

type JsonResponse

type JsonResponse interface {
	SetCode(v int32)
	SetMsg(v string)
}

Jump to

Keyboard shortcuts

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