Documentation ¶
Index ¶
- func CaptureErrors(handler http.Handler) http.Handler
- func CheckPassword(hashedPassword, password string) bool
- func CommonHandler(w http.ResponseWriter, r *http.Request, msg string, logic HandlerFunc)
- func CommonJsonHandler(r *http.Request, logic HandlerFunc) (interface{}, *ec.Error)
- func CorsMiddleware(next http.Handler) http.Handler
- func DebugTest(t *testing.T, data interface{}, name string)
- func EnableCors(w *http.ResponseWriter)
- func GetHost(r *http.Request) string
- func GetJWTKey() []byte
- func HashPassword(password string) (string, error)
- func HashStr(v string) string
- func InitializeAppKey(appKey string)
- func InitializeSentry(dsn string)
- func KeyByRealIP(r *http.Request) (string, error)
- func LogRequest(next http.Handler) http.Handler
- func Logger() *zerolog.Logger
- func RateLimit(rateLimit int) func(http.Handler) http.Handler
- func RejectNonSpecificDomain(domain string) func(next http.Handler) http.Handler
- func RequireApiKeyMiddleware(next http.Handler) http.Handler
- func RequireJWTAuthMiddleware(next http.Handler) http.Handler
- func SetDefaultMiddlewares(r *chi.Mux)
- func Validator() *validator.Validate
- func WebFirewallMiddleware(next http.Handler) http.Handler
- type Claims
- type ContextKey
- type Crypt
- type ErrorStatus
- type HandlerFunc
- type Response
- func (r *Response) HandleErrorCode(errc *ec.Error)
- func (r *Response) WriteErrorResponse(message string, statusCode int)
- func (r *Response) WriteSuccessResponse(message string, data interface{})
- func (r *Response) WriteValidationError(errc *ec.Error) bool
- func (r *Response) WriteValidationResponse(message string, data interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
func CommonHandler ¶
func CommonHandler(w http.ResponseWriter, r *http.Request, msg string, logic HandlerFunc)
commonHandler is a function that handles common logic for HTTP handlers.
func CommonJsonHandler ¶
func CommonJsonHandler(r *http.Request, logic HandlerFunc) (interface{}, *ec.Error)
func EnableCors ¶
func EnableCors(w *http.ResponseWriter)
func HashPassword ¶
func InitializeAppKey ¶
func InitializeAppKey(appKey string)
func InitializeSentry ¶
func InitializeSentry(dsn string)
func KeyByRealIP ¶
KeyByRealIP copied from httprate.KeyByRealIP this is to fully support other platforms, especially CF-Connecting-IP
func RejectNonSpecificDomain ¶
func SetDefaultMiddlewares ¶
func SetDefaultMiddlewares(r *chi.Mux)
Types ¶
type ContextKey ¶
type ContextKey string
func (ContextKey) String ¶
func (c ContextKey) String() string
type Crypt ¶
type Crypt struct {
Key string
}
func NewCryptWithKey ¶
type ErrorStatus ¶
type HandlerFunc ¶
HandlerFunc is a type that defines a function that takes a byte slice and returns an interface and an error.
type Response ¶
type Response struct { Success bool `json:"success"` Message string `json:"message"` Data interface{} `json:"data"` // contains filtered or unexported fields }
func NewResponse ¶
func NewResponse(w http.ResponseWriter) *Response
func (*Response) HandleErrorCode ¶
func (*Response) WriteErrorResponse ¶
func (*Response) WriteSuccessResponse ¶
func (*Response) WriteValidationError ¶
func (*Response) WriteValidationResponse ¶
Click to show internal directories.
Click to hide internal directories.