Documentation ¶
Index ¶
- Variables
- func CheckAuth(roles []string, authClient authProto.AuthClient) gin.HandlerFunc
- func CheckUserClientHeader() gin.HandlerFunc
- func ClearXHeaders() gin.HandlerFunc
- func Cors() gin.HandlerFunc
- func HeaderEntry(header string, value interface{}) *log.Entry
- func Logger(m *model.Metrics) gin.HandlerFunc
- func SetHeaderFromQuery() gin.HandlerFunc
- func SetMainUserXHeaders() gin.HandlerFunc
- func SetRequestID() gin.HandlerFunc
- func SetRequestName(name string) gin.HandlerFunc
- type Limiter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrAuthClientNotSet returns if grpc client is nil ErrAuthClientNotSet = errors.New("Auth client not set up") //ErrUserPermissionDenied return if user don't have permissions ErrUserPermissionDenied = errors.New("User permission denied") )
View Source
var ( //XHeaderRegexp keeps regexp for detecting X-Headers XHeaderRegexp = regexp.MustCompile("^X-[a-zA-Z0-9]+") )
Functions ¶
func CheckAuth ¶
func CheckAuth(roles []string, authClient authProto.AuthClient) gin.HandlerFunc
CheckAuth check user token and roles
func CheckUserClientHeader ¶
func CheckUserClientHeader() gin.HandlerFunc
CheckUserClientHeader validate User-Client header
func ClearXHeaders ¶
func ClearXHeaders() gin.HandlerFunc
ClearXHeaders clear all request and response X-Headers
func HeaderEntry ¶
HeaderEntry return logrus Entry with Header and Value params
func Logger ¶
func Logger(m *model.Metrics) gin.HandlerFunc
Logger will write the request logs and save it's in clickhouse
func SetHeaderFromQuery ¶
func SetHeaderFromQuery() gin.HandlerFunc
SetHeaderFromQuery write X-User-IP, X-User-Client, X-User-Agent for next services
func SetMainUserXHeaders ¶
func SetMainUserXHeaders() gin.HandlerFunc
SetMainUserXHeaders write X-User-IP, X-User-Client, X-User-Agent for next services
func SetRequestName ¶
func SetRequestName(name string) gin.HandlerFunc
SetRequestName set request name header
Types ¶
type Limiter ¶
Limiter keeps tollbooth limiter for limiting http requests
func CreateLimiter ¶
CreateLimiter return rate limiter for http
func (*Limiter) Limit ¶
func (l *Limiter) Limit() gin.HandlerFunc
Limit middleware for limiting http requests
Click to show internal directories.
Click to hide internal directories.