From c994d4bb43f04efb77e3635fcb78ca16e8681958 Mon Sep 17 00:00:00 2001
From: Pea Nut <peanut2@systemli.org>
Date: Fri, 14 Jun 2024 10:43:56 +0200
Subject: [PATCH] Add some comments to vpn/status.go

---
 pkg/vpn/status.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pkg/vpn/status.go b/pkg/vpn/status.go
index 0974080e..3437c1c4 100644
--- a/pkg/vpn/status.go
+++ b/pkg/vpn/status.go
@@ -106,6 +106,12 @@ func (b *Bitmask) eventHandler(eventCh <-chan management.Event) {
 	b.statusCh <- Off
 }
 
+// About the Getter functions here:
+// In pkg/backend/status.go there is a function toJson which is called regularly by the cpp
+// part (toJson is called in RefreshContext which is defined in pkg/backend/api.go and exported
+// in libgoshim). It is used get the current state of the application. In toJson, all the Getter
+// functions like GetCurrentGateway and IsManualLocation are called
+
 func (b *Bitmask) GetCurrentGateway() string {
 	return b.onGateway.Host
 }
@@ -126,6 +132,7 @@ func (b *Bitmask) GetBestLocation(transport string) string {
 			Str("transport", transport).
 			Msg("Could not get best location")
 	}
+	// TODO: we return here an empty string in case of an error
 	return location
 }
 
-- 
GitLab