You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudreve/pkg/auth/requestinfo/requestinfo.go

26 lines
464 B

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
}