From f2edb06583c96ae7140967dd889237d22dfd4139 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 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):