Init V4 community edition (#2265)
* Init V4 community edition * Init V4 community edition
This commit is contained in:
25
pkg/auth/requestinfo/requestinfo.go
Normal file
25
pkg/auth/requestinfo/requestinfo.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package requestinfo
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// RequestInfoCtx context key for RequestInfo
|
||||
type RequestInfoCtx struct{}
|
||||
|
||||
// RequestInfoFromContext retrieves RequestInfo from context
|
||||
func RequestInfoFromContext(ctx context.Context) *RequestInfo {
|
||||
v, ok := ctx.Value(RequestInfoCtx{}).(*RequestInfo)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// RequestInfo store request info for audit
|
||||
type RequestInfo struct {
|
||||
Host string
|
||||
IP string
|
||||
UserAgent string
|
||||
}
|
||||
Reference in New Issue
Block a user