From d4482994ecf988f687115d498fb1769cd42471c4 Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Mon, 20 Apr 2020 16:40:40 +0200 Subject: [PATCH] fix: missing and incorrect comments --- cmd/Desktop-Bridge/main.go | 4 ++++ pkg/pmapi/auth.go | 1 + pkg/pmapi/clientmanager.go | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/Desktop-Bridge/main.go b/cmd/Desktop-Bridge/main.go index 5a37044c..e38b40ac 100644 --- a/cmd/Desktop-Bridge/main.go +++ b/cmd/Desktop-Bridge/main.go @@ -275,6 +275,10 @@ func run(context *cli.Context) (contextError error) { // nolint[funlen] } cm := pmapi.NewClientManager(cfg.GetAPIConfig()) + + // Different build types have different roundtrippers (e.g. we want to enable + // TLS fingerprint checks in production builds). GetRoundTripper has a different + // implementation depending on whether build flag pmapi_prod is used or not. cm.SetRoundTripper(cfg.GetRoundTripper(cm, eventListener)) bridgeInstance := bridge.New(cfg, pref, panicHandler, eventListener, Version, cm, credentialsStore) diff --git a/pkg/pmapi/auth.go b/pkg/pmapi/auth.go index 25a2ba6b..a0cdcbbf 100644 --- a/pkg/pmapi/auth.go +++ b/pkg/pmapi/auth.go @@ -125,6 +125,7 @@ func (s *Auth) UID() string { return s.uid } +// GenToken generates a string token containing the session UID and refresh token. func (s *Auth) GenToken() string { if s == nil { return "" diff --git a/pkg/pmapi/clientmanager.go b/pkg/pmapi/clientmanager.go index c1b24e7a..40c8164c 100644 --- a/pkg/pmapi/clientmanager.go +++ b/pkg/pmapi/clientmanager.go @@ -106,6 +106,8 @@ func NewClientManager(config *ClientConfig) (cm *ClientManager) { return cm } +// SetClientConstructor sets the method used to construct clients. +// By default this is `pmapi.newClient` but can be overridden with this method. func (cm *ClientManager) SetClientConstructor(f func(userID string) Client) { cm.newClient = f } @@ -130,7 +132,7 @@ func (cm *ClientManager) GetClient(userID string) Client { return cm.clients[userID] } -// GetAnonymousClient returns an anonymous client. It replaces any anonymous client that was already created. +// GetAnonymousClient returns an anonymous client. func (cm *ClientManager) GetAnonymousClient() Client { return cm.GetClient(fmt.Sprintf("anonymous-%v", cm.idGen.next())) }