diff --git a/pkg/ctx/agentctx.go b/pkg/ctx/agentctx.go index db7fba3495..eac5305de7 100644 --- a/pkg/ctx/agentctx.go +++ b/pkg/ctx/agentctx.go @@ -25,6 +25,7 @@ import ( "google.golang.org/grpc/metadata" ) +// UserAgentHeader is the header used for the user agent const UserAgentHeader = "x-user-agent" // ContextGetUserAgent returns the user agent if set in the given context. diff --git a/pkg/useragent/useragent.go b/pkg/useragent/useragent.go index bdc30bf58c..f0f1798665 100644 --- a/pkg/useragent/useragent.go +++ b/pkg/useragent/useragent.go @@ -47,6 +47,8 @@ func isGRPC(ua *ua.UserAgent) bool { return strings.HasPrefix(ua.Name, "grpc") } +// GetCategory returns the category of the user agent +// (i.e. if it is a web, mobile, desktop or grpc user agent) func GetCategory(ua *ua.UserAgent) string { switch { case isWeb(ua):