func (m *middleware) GlobalRecover() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		defer func(ctx *gin.Context) {
			if !preCheck(ctx) {
				return
			}
			m.logger.Info("middleware GlobalRecover()")
			if ctx.IsAborted() {
				m.logger.Debug("GlobalRecover", zap.Bool("c.IsAborted()", ctx.IsAborted()))
				m.setResponse(ctx, getErrMsg(ctx), ctx.Writer.Status())
				return
			}
			if m.developConf.RecoverEnable {
				if rec := recover(); rec != nil {
					m.logger.Debug("GlobalRecover", zap.Any("recover()", rec))
					m.setResponse(ctx, str.Itos(rec), http.StatusInternalServerError)
					return
				}
			}
		}(ctx)
		ctx.Next()
	}
}
-----------------------------------------------------------------------------
basic
-----------------------------------------------------------------------------
GlobalRecover is after request, handle aborted code or 500 error.
When 404 or 405 error occurred, response already been set in controller/errors/errors.go
package server
import (
	"fmt"
	"net/http"
	"strings"
	"github.com/gin-gonic/gin"
	"github.com/pkg/errors"
	"go.uber.org/zap"
	"github.com/hiromaily/go-gin-wrapper/pkg/auth/jwts"
	"github.com/hiromaily/go-gin-wrapper/pkg/config"
	"github.com/hiromaily/go-gin-wrapper/pkg/files"
	"github.com/hiromaily/go-gin-wrapper/pkg/reverseproxy/types"
	"github.com/hiromaily/go-gin-wrapper/pkg/server/ginctx"
	"github.com/hiromaily/go-gin-wrapper/pkg/server/ginsession"
	"github.com/hiromaily/go-gin-wrapper/pkg/server/ginurl"
	hh "github.com/hiromaily/go-gin-wrapper/pkg/server/httpheader"
	"github.com/hiromaily/go-gin-wrapper/pkg/server/httpheader/cors"
	str "github.com/hiromaily/go-gin-wrapper/pkg/strings"
)
type Middlewarer interface {
	GlobalRecover() gin.HandlerFunc
	FilterIP() gin.HandlerFunc
	CheckGinError() gin.HandlerFunc
	SetMetaData() gin.HandlerFunc
	UpdateUserSession() gin.HandlerFunc
	CheckHTTPReferer() gin.HandlerFunc
	CheckCSRF() gin.HandlerFunc
	RejectNonHTTPS() gin.HandlerFunc
	CheckHTTPHeader() gin.HandlerFunc
	CheckJWT() gin.HandlerFunc
	CheckCORS() gin.HandlerFunc
	SetResponseHeader() gin.HandlerFunc
	SetCORSHeader() gin.HandlerFunc
}
type middleware struct {
	logger      *zap.Logger
	session     ginsession.Sessioner
	jwter       jwts.JWTer
	corser      cors.CORSer
	rejectIPs   []string
	serverConf  *config.Server
	proxyConf   *config.Proxy
	apiConf     *config.API
	developConf *config.Develop
}
func NewMiddleware(
	logger *zap.Logger,
	session ginsession.Sessioner,
	jwter jwts.JWTer,
	corser cors.CORSer,
	rejectIPs []string,
	serverConf *config.Server,
	proxyConf *config.Proxy,
	apiConf *config.API,
	developConf *config.Develop,
) Middlewarer {
	return &middleware{
		logger:      logger,
		session:     session,
		jwter:       jwter,
		corser:      corser,
		rejectIPs:   rejectIPs,
		serverConf:  serverConf,
		proxyConf:   proxyConf,
		apiConf:     apiConf,
		developConf: developConf,
	}
}
var RefererURLs = map[string]string{
	"/login": "login",
	"/user":  "user",
}