summaryrefslogtreecommitdiff
path: root/pkg/backend/status.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2021-03-23 17:10:45 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-05-04 14:58:39 +0200
commitb14d048e6089233f5c698426652e85bfa1d89488 (patch)
treeb1542d03377740f7335c9848a751ad16426632f0 /pkg/backend/status.go
parent8c4edf29112a32f267d19717637bf2104c28b969 (diff)
Don't expose the full gateway out of the vpn module
We just care about locations and fullness.
Diffstat (limited to 'pkg/backend/status.go')
-rw-r--r--pkg/backend/status.go38
1 files changed, 16 insertions, 22 deletions
diff --git a/pkg/backend/status.go b/pkg/backend/status.go
index 3d78a0b..0e92253 100644
--- a/pkg/backend/status.go
+++ b/pkg/backend/status.go
@@ -8,7 +8,6 @@ import (
"0xacab.org/leap/bitmask-vpn/pkg/bitmask"
"0xacab.org/leap/bitmask-vpn/pkg/config"
- "0xacab.org/leap/bitmask-vpn/pkg/vpn/bonafide"
)
const (
@@ -33,22 +32,21 @@ var updateMutex sync.Mutex
// them.
type connectionCtx struct {
- AppName string `json:"appName"`
- Provider string `json:"provider"`
- TosURL string `json:"tosURL"`
- HelpURL string `json:"helpURL"`
- AskForDonations bool `json:"askForDonations"`
- DonateDialog bool `json:"donateDialog"`
- DonateURL string `json:"donateURL"`
- LoginDialog bool `json:"loginDialog"`
- LoginOk bool `json:"loginOk"`
- Version string `json:"version"`
- Errors string `json:"errors"`
- Status status `json:"status"`
- /* XXX perhaps rename to GatewaysByCity */
- Gateways map[string]bonafide.Gateway `json:"gateways"`
- CurrentGateway string `json:"currentGateway"`
- CurrentLocation string `json:"currentLocation"`
+ AppName string `json:"appName"`
+ Provider string `json:"provider"`
+ TosURL string `json:"tosURL"`
+ HelpURL string `json:"helpURL"`
+ AskForDonations bool `json:"askForDonations"`
+ DonateDialog bool `json:"donateDialog"`
+ DonateURL string `json:"donateURL"`
+ LoginDialog bool `json:"loginDialog"`
+ LoginOk bool `json:"loginOk"`
+ Version string `json:"version"`
+ Errors string `json:"errors"`
+ Status status `json:"status"`
+ Locations map[string]float64 `json:"locations"`
+ CurrentGateway string `json:"currentGateway"`
+ CurrentLocation string `json:"currentLocation"`
bm bitmask.Bitmask
autostart bitmask.Autostart
cfg *config.Config
@@ -57,11 +55,7 @@ type connectionCtx struct {
func (c connectionCtx) toJson() ([]byte, error) {
statusMutex.Lock()
if c.bm != nil {
- gws, err := c.bm.ListGatewaysByCity("openvpn")
- if err != nil {
- log.Println("error getting gateways for city")
- }
- c.Gateways = gws
+ c.Locations = c.bm.ListLocationFullness("openvpn")
c.CurrentGateway = c.bm.GetCurrentGateway()
c.CurrentLocation = c.bm.GetCurrentLocation()
}