From 97f6f9d1aac21bb17249937206255b96f4ef17ce Mon Sep 17 00:00:00 2001 From: Gianmaria Del Monte Date: Mon, 1 Nov 2021 14:04:46 +0100 Subject: [PATCH] Add comments --- pkg/ctx/agentctx.go | 1 + pkg/useragent/useragent.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/pkg/ctx/agentctx.go b/pkg/ctx/agentctx.go index db7fba3495b..eac5305de70 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 bdc30bf58c4..f0f17986656 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):