Documentation ¶
Index ¶
- func AddCorsSupport(ctx *gin.Context)
- func AddPoweredBy(ctx *gin.Context)
- func BuildJsonWebToken(arg0 interface{}, isRefreshToken bool, claims ...map[string]interface{}) (token string, err error)
- func ExecuteTimeLogEnabled() bool
- func ExecuteTimeLogLogger(logger ...logx.Logger) logx.Logger
- func GetJwtPrivateKeyPemFile() string
- func GetJwtPublicKeyPemFile() string
- func JwtClaimBool(arg0 interface{}, name string, defaultValue ...bool) bool
- func JwtClaimFloat32(arg0 interface{}, name string, defaultValue ...float32) float32
- func JwtClaimFloat64(arg0 interface{}, name string, defaultValue ...float64) float64
- func JwtClaimInt(arg0 interface{}, name string, defaultValue ...int) int
- func JwtClaimInt64(arg0 interface{}, name string, defaultValue ...int64) int64
- func JwtClaimIntSlice(arg0 interface{}, name string) []int
- func JwtClaimString(arg0 interface{}, name string, defaultValue ...string) string
- func JwtClaimStringSlice(arg0 interface{}, name string) []string
- func LogExecuteTime(ctx *gin.Context)
- func LogRequestBody(flag ...bool) bool
- func MidFinalStep() gin.HandlerFunc
- func MidJwtAuth(settingsKey string) gin.HandlerFunc
- func MidOptionsReq() gin.HandlerFunc
- func MidRateLimit(handlerName string, settings interface{}) gin.HandlerFunc
- func MidRecover() gin.HandlerFunc
- func MidRequestBody() gin.HandlerFunc
- func MidRequestLog() gin.HandlerFunc
- func MidValidate(arg0 interface{}) gin.HandlerFunc
- func NeedCorsSupport(ctx *gin.Context) bool
- func NewFilePart(formFieldName, clientFileName, fpath string) filePart
- func NewFilePartFromBuffer(formFieldName, clientFileName string, buf []byte) filePart
- func NewHttpClient(requestUrl string) httpClient
- func NewJwtAuthErrorHandler() *jwtAuthErrorHandler
- func NewNoopLogger() *noopLogger
- func NewNormalPart(data map[string]string) normalPart
- func NewRateLimitErrorHandler() *rateLimitErrorHandler
- func NewValidateErrorHandler() *validateErrorHandler
- func ParseJsonWebToken(token string, pubpem ...string) (*jwt.Token, error)
- func RatelimiterCacheDir() string
- func RatelimiterLuaFile() string
- func ReplaceBuiltinErrorHandler(errName string, handler ErrorHandler)
- func RequestLogEnabled() bool
- func RequestLogLogger(logger ...logx.Logger) logx.Logger
- func RuntimeLogger(logger ...logx.Logger) logx.Logger
- func VerifyJsonWebToken(arg0 interface{}, settings *JwtSettings) int
- func WithBuiltinErrorHandlers()
- func WithCorsSettings(settings ...map[string]interface{})
- func WithErrorHandler(handler ErrorHandler)
- func WithErrorHandlers(handlers []ErrorHandler)
- func WithJwtPrivateKeyPemFile(fpath string)
- func WithJwtPublicKeyPemFile(fpath string)
- func WithJwtSettings(key string, settings ...map[string]interface{})
- func WithRatelimiterCacheDir(dir string)
- func WithRatelimiterLuaFile(fpath string)
- type AttachmentResponse
- type CorsSettings
- type ErrorHandler
- type HtmlResponse
- type HttpErrorResponse
- type ImageResponse
- type JsonResponse
- type JwtAuthError
- type JwtSettings
- type RateLimitError
- type Request
- func (r *Request) DtoBind(dto interface{}) error
- func (r *Request) GetClientIp() string
- func (r *Request) GetFormData() map[string]string
- func (r *Request) GetHeader(name string) string
- func (r *Request) GetHeaders() map[string]string
- func (r *Request) GetJwt() *jwt.Token
- func (r *Request) GetMap(rules ...interface{}) map[string]interface{}
- func (r *Request) GetMethod() string
- func (r *Request) GetQueryParams() map[string]string
- func (r *Request) GetQueryString(urlencode ...bool) string
- func (r *Request) GetRawBody() []byte
- func (r *Request) GetRequestUrl(withQueryString ...bool) string
- func (r *Request) GetUploadedFile(formFieldName string) *multipart.FileHeader
- func (r *Request) JwtClaimBool(name string, defaultValue ...interface{}) bool
- func (r *Request) JwtClaimFloat32(name string, defaultValue ...interface{}) float32
- func (r *Request) JwtClaimFloat64(name string, defaultValue ...interface{}) float64
- func (r *Request) JwtClaimInt(name string, defaultValue ...interface{}) int
- func (r *Request) JwtClaimInt64(name string, defaultValue ...interface{}) int64
- func (r *Request) JwtClaimIntSlice(name string) []int
- func (r *Request) JwtClaimString(name string, defaultValue ...interface{}) string
- func (r *Request) JwtClaimStringSlice(name string) []string
- func (r *Request) ParamBool(name string, defaultValue ...interface{}) bool
- func (r *Request) ParamFloat32(name string, defaultValue ...interface{}) float32
- func (r *Request) ParamFloat64(name string, defaultValue ...interface{}) float64
- func (r *Request) ParamInt(name string, defaultValue ...interface{}) int
- func (r *Request) ParamInt64(name string, defaultValue ...interface{}) int64
- func (r *Request) ParamString(name string, defaultValue ...interface{}) string
- func (r *Request) ParamStringWithSecurityMode(name string, mode int, defaultValue ...interface{}) string
- func (r *Request) PathvariableBool(name string, defaultValue ...interface{}) bool
- func (r *Request) PathvariableFloat32(name string, defaultValue ...interface{}) float32
- func (r *Request) PathvariableFloat64(name string, defaultValue ...interface{}) float64
- func (r *Request) PathvariableInt(name string, defaultValue ...interface{}) int
- func (r *Request) PathvariableInt64(name string, defaultValue ...interface{}) int64
- func (r *Request) PathvariableString(name string, defaultValue ...interface{}) string
- type ResponsePayload
- type ValidateError
- type XmlResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCorsSupport ¶
func AddPoweredBy ¶
func BuildJsonWebToken ¶
func BuildJsonWebToken(arg0 interface{}, isRefreshToken bool, claims ...map[string]interface{}) (token string, err error)
@param *JwtSettings|string arg0
func ExecuteTimeLogEnabled ¶
func ExecuteTimeLogEnabled() bool
func GetJwtPrivateKeyPemFile ¶
func GetJwtPrivateKeyPemFile() string
func GetJwtPublicKeyPemFile ¶
func GetJwtPublicKeyPemFile() string
func JwtClaimBool ¶
@param *jwt.Token|string arg0
func JwtClaimFloat32 ¶
@param *jwt.Token|string arg0
func JwtClaimFloat64 ¶
@param *jwt.Token|string arg0
func JwtClaimInt ¶
@param *jwt.Token|string arg0
func JwtClaimInt64 ¶
@param *jwt.Token|string arg0
func JwtClaimIntSlice ¶
@param *jwt.Token|string arg0
func JwtClaimString ¶
@param *jwt.Token|string arg0
func JwtClaimStringSlice ¶
@param *jwt.Token|string arg0
func LogExecuteTime ¶
func LogRequestBody ¶
func MidFinalStep ¶
func MidFinalStep() gin.HandlerFunc
func MidJwtAuth ¶
func MidJwtAuth(settingsKey string) gin.HandlerFunc
func MidOptionsReq ¶
func MidOptionsReq() gin.HandlerFunc
func MidRateLimit ¶
func MidRateLimit(handlerName string, settings interface{}) gin.HandlerFunc
func MidRecover ¶
func MidRecover() gin.HandlerFunc
func MidRequestBody ¶
func MidRequestBody() gin.HandlerFunc
func MidRequestLog ¶
func MidRequestLog() gin.HandlerFunc
func MidValidate ¶
func MidValidate(arg0 interface{}) gin.HandlerFunc
func NeedCorsSupport ¶
func NewFilePart ¶
func NewFilePart(formFieldName, clientFileName, fpath string) filePart
noinspection GoExportedFuncWithUnexportedType
func NewFilePartFromBuffer ¶
noinspection GoExportedFuncWithUnexportedType
func NewHttpClient ¶
func NewHttpClient(requestUrl string) httpClient
noinspection GoExportedFuncWithUnexportedType
func NewJwtAuthErrorHandler ¶
func NewJwtAuthErrorHandler() *jwtAuthErrorHandler
func NewNoopLogger ¶
func NewNoopLogger() *noopLogger
func NewNormalPart ¶
noinspection GoExportedFuncWithUnexportedType
func NewRateLimitErrorHandler ¶
func NewRateLimitErrorHandler() *rateLimitErrorHandler
func NewValidateErrorHandler ¶
func NewValidateErrorHandler() *validateErrorHandler
func ParseJsonWebToken ¶
func RatelimiterCacheDir ¶
func RatelimiterCacheDir() string
func RatelimiterLuaFile ¶
func RatelimiterLuaFile() string
func ReplaceBuiltinErrorHandler ¶
func ReplaceBuiltinErrorHandler(errName string, handler ErrorHandler)
func RequestLogEnabled ¶
func RequestLogEnabled() bool
func VerifyJsonWebToken ¶
func VerifyJsonWebToken(arg0 interface{}, settings *JwtSettings) int
@param *jwt.Token|string arg0
func WithBuiltinErrorHandlers ¶
func WithBuiltinErrorHandlers()
func WithCorsSettings ¶
func WithCorsSettings(settings ...map[string]interface{})
func WithErrorHandler ¶
func WithErrorHandler(handler ErrorHandler)
func WithErrorHandlers ¶
func WithErrorHandlers(handlers []ErrorHandler)
func WithJwtPrivateKeyPemFile ¶
func WithJwtPrivateKeyPemFile(fpath string)
func WithJwtPublicKeyPemFile ¶
func WithJwtPublicKeyPemFile(fpath string)
func WithJwtSettings ¶
func WithRatelimiterCacheDir ¶
func WithRatelimiterCacheDir(dir string)
func WithRatelimiterLuaFile ¶
func WithRatelimiterLuaFile(fpath string)
Types ¶
type AttachmentResponse ¶
type AttachmentResponse struct {
// contains filtered or unexported fields
}
func NewAttachmentResponseFromBuffer ¶
func NewAttachmentResponseFromBuffer(buf []byte, attachmentFileName string, mimeType ...string) AttachmentResponse
func NewAttachmentResponseFromFile ¶
func NewAttachmentResponseFromFile(fpath, attachmentFileName string, mimeType ...string) AttachmentResponse
func (AttachmentResponse) AddSpecifyHeaders ¶
func (p AttachmentResponse) AddSpecifyHeaders(ctx *gin.Context)
func (AttachmentResponse) Buffer ¶
func (p AttachmentResponse) Buffer() []byte
func (AttachmentResponse) GetContentType ¶
func (p AttachmentResponse) GetContentType() string
func (AttachmentResponse) GetContents ¶
func (p AttachmentResponse) GetContents() (int, string)
type CorsSettings ¶
type CorsSettings struct {
// contains filtered or unexported fields
}
func GetCorsSettings ¶
func GetCorsSettings() *CorsSettings
func NewCorsSettings ¶
func NewCorsSettings(settings map[string]interface{}) *CorsSettings
func (*CorsSettings) AllowCredentials ¶
func (st *CorsSettings) AllowCredentials() bool
func (*CorsSettings) AllowedHeaders ¶
func (st *CorsSettings) AllowedHeaders() []string
func (*CorsSettings) AllowedMethods ¶
func (st *CorsSettings) AllowedMethods() []string
func (*CorsSettings) AllowedOrigins ¶
func (st *CorsSettings) AllowedOrigins() []string
func (*CorsSettings) ExposedHeaders ¶
func (st *CorsSettings) ExposedHeaders() []string
func (*CorsSettings) MaxAge ¶
func (st *CorsSettings) MaxAge() time.Duration
type ErrorHandler ¶
type ErrorHandler interface { GetErrorName() string MatchError(err error) bool HandleError(err error) ResponsePayload }
func ErrorHandlers ¶
func ErrorHandlers() []ErrorHandler
type HtmlResponse ¶
type HtmlResponse struct {
// contains filtered or unexported fields
}
func NewHtmlResponse ¶
func NewHtmlResponse(contents string) HtmlResponse
func (HtmlResponse) GetContentType ¶
func (p HtmlResponse) GetContentType() string
func (HtmlResponse) GetContents ¶
func (p HtmlResponse) GetContents() (int, string)
type HttpErrorResponse ¶
type HttpErrorResponse struct {
// contains filtered or unexported fields
}
func NewHttpErrorResponse ¶
func NewHttpErrorResponse(statusCode int) HttpErrorResponse
func (HttpErrorResponse) GetContentType ¶
func (p HttpErrorResponse) GetContentType() string
func (HttpErrorResponse) GetContents ¶
func (p HttpErrorResponse) GetContents() (int, string)
type ImageResponse ¶
type ImageResponse struct {
// contains filtered or unexported fields
}
func NewImageResponseFromBuffer ¶
func NewImageResponseFromBuffer(buf []byte, mimeType ...string) ImageResponse
func NewImageResponseFromFile ¶
func NewImageResponseFromFile(fpath string, mimeType ...string) ImageResponse
func (ImageResponse) Buffer ¶
func (p ImageResponse) Buffer() []byte
func (ImageResponse) GetContentType ¶
func (p ImageResponse) GetContentType() string
func (ImageResponse) GetContents ¶
func (p ImageResponse) GetContents() (int, string)
type JsonResponse ¶
type JsonResponse struct {
// contains filtered or unexported fields
}
func NewJsonResponse ¶
func NewJsonResponse(payload interface{}) JsonResponse
func (JsonResponse) GetContentType ¶
func (p JsonResponse) GetContentType() string
func (JsonResponse) GetContents ¶
func (p JsonResponse) GetContents() (statusCode int, contents string)
type JwtAuthError ¶
type JwtAuthError struct {
// contains filtered or unexported fields
}
func NewJwtAuthError ¶
func NewJwtAuthError(errno int) JwtAuthError
func (JwtAuthError) Errno ¶
func (ex JwtAuthError) Errno() int
func (JwtAuthError) Error ¶
func (ex JwtAuthError) Error() string
type JwtSettings ¶
type JwtSettings struct {
// contains filtered or unexported fields
}
func GetJwtSettings ¶
func GetJwtSettings(key string) *JwtSettings
func NewJwtSettings ¶
func NewJwtSettings(settings map[string]interface{}) *JwtSettings
func (*JwtSettings) Issuer ¶
func (st *JwtSettings) Issuer() string
func (*JwtSettings) PrivateKeyPemFile ¶
func (st *JwtSettings) PrivateKeyPemFile() string
func (*JwtSettings) PublicKeyPemFile ¶
func (st *JwtSettings) PublicKeyPemFile() string
func (*JwtSettings) RefreshTokenTtl ¶
func (st *JwtSettings) RefreshTokenTtl() time.Duration
func (*JwtSettings) Ttl ¶
func (st *JwtSettings) Ttl() time.Duration
type RateLimitError ¶
type RateLimitError struct {
// contains filtered or unexported fields
}
func NewRateLimitError ¶
func NewRateLimitError(data map[string]interface{}) RateLimitError
func (RateLimitError) AddSpecifyHeaders ¶
func (ex RateLimitError) AddSpecifyHeaders(ctx *gin.Context)
func (RateLimitError) Error ¶
func (ex RateLimitError) Error() string
func (RateLimitError) Remaining ¶
func (ex RateLimitError) Remaining() int
func (RateLimitError) RetryAfter ¶
func (ex RateLimitError) RetryAfter() string
func (RateLimitError) Total ¶
func (ex RateLimitError) Total() int
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func (*Request) GetClientIp ¶
func (*Request) GetFormData ¶
func (*Request) GetHeaders ¶
func (*Request) GetQueryParams ¶
func (*Request) GetQueryString ¶
func (*Request) GetRawBody ¶
func (*Request) GetRequestUrl ¶
func (*Request) GetUploadedFile ¶
func (r *Request) GetUploadedFile(formFieldName string) *multipart.FileHeader
func (*Request) JwtClaimBool ¶
func (*Request) JwtClaimFloat32 ¶
func (*Request) JwtClaimFloat64 ¶
func (*Request) JwtClaimInt ¶
func (*Request) JwtClaimInt64 ¶
func (*Request) JwtClaimIntSlice ¶
func (*Request) JwtClaimString ¶
func (*Request) JwtClaimStringSlice ¶
func (*Request) ParamFloat32 ¶
func (*Request) ParamFloat64 ¶
func (*Request) ParamInt64 ¶
func (*Request) ParamString ¶
func (*Request) ParamStringWithSecurityMode ¶
func (*Request) PathvariableBool ¶
func (*Request) PathvariableFloat32 ¶
func (*Request) PathvariableFloat64 ¶
func (*Request) PathvariableInt ¶
func (*Request) PathvariableInt64 ¶
func (*Request) PathvariableString ¶
type ResponsePayload ¶
type ValidateError ¶
type ValidateError struct {
// contains filtered or unexported fields
}
func NewValidateError ¶
func NewValidateError(args ...interface{}) ValidateError
func (ValidateError) Error ¶
func (ex ValidateError) Error() string
func (ValidateError) Failfast ¶
func (ex ValidateError) Failfast() bool
func (ValidateError) ValidateErrors ¶
func (ex ValidateError) ValidateErrors() map[string]string
type XmlResponse ¶
type XmlResponse struct {
// contains filtered or unexported fields
}
func NewXmlResponse ¶
func NewXmlResponse(contents string) XmlResponse
func (XmlResponse) GetContentType ¶
func (p XmlResponse) GetContentType() string
func (XmlResponse) GetContents ¶
func (p XmlResponse) GetContents() (int, string)
Source Files ¶
- AttachmentResponse.go
- CorsSettings.go
- ErrorHandler.go
- HtmlResponse.go
- HttpClient.go
- HttpErrorResponse.go
- ImageResponse.go
- JsonResponse.go
- JwtAuthError.go
- JwtAuthErrorHandler.go
- JwtSettings.go
- MidFinalStep.go
- MidJwtAuth.go
- MidOptionsReq.go
- MidRateLimit.go
- MidRecover.go
- MidRequestBody.go
- MidRequestLog.go
- MidValidate.go
- NoopLogger.go
- RateLimitError.go
- RateLimitErrorHandler.go
- ResponsePayload.go
- ValidateError.go
- ValidateErrorHandler.go
- XmlResponse.go
- mgboot.go
- ratelimiter.go
- request.go
- security.go
Click to show internal directories.
Click to hide internal directories.