From 1f91f6f8a5d9ffecea132773d2d8132b1ca3d68c Mon Sep 17 00:00:00 2001
From: Pea Nut <peanut2@systemli.org>
Date: Wed, 16 Oct 2024 08:59:59 +0200
Subject: [PATCH] Update calls to DoGeolocationLookup after API change

We've updated bitmask-core. Before the update, DoGeolocationLookup
returned string and error, now it's just an error.
---
 pkg/vpn/bitmask.go           | 8 ++------
 pkg/vpn/bonafide/bonafide.go | 4 ++--
 pkg/vpn/interface.go         | 2 +-
 pkg/vpn/menshen/init.go      | 2 +-
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/pkg/vpn/bitmask.go b/pkg/vpn/bitmask.go
index 617a0b80..3d861892 100644
--- a/pkg/vpn/bitmask.go
+++ b/pkg/vpn/bitmask.go
@@ -143,12 +143,8 @@ func Init() (*Bitmask, error) {
 			If the lookup succeeds, we save it in the config file and use it as fallback
 			the next time.
 		*/
-		countryCode, err := b.api.DoGeolocationLookup()
-		if err == nil {
-			log.Debug().
-				Str("countryCode", countryCode).
-				Msg("Successfully got country code")
-		} else {
+		err := b.api.DoGeolocationLookup()
+		if err != nil {
 			log.Warn().
 				Str("err", err.Error()).
 				Msgf("Could not do geolocation lookup")
diff --git a/pkg/vpn/bonafide/bonafide.go b/pkg/vpn/bonafide/bonafide.go
index 6c2b3517..d3437bcf 100644
--- a/pkg/vpn/bonafide/bonafide.go
+++ b/pkg/vpn/bonafide/bonafide.go
@@ -412,6 +412,6 @@ func (b *Bonafide) GetSnowflakeCh() chan *snowflake.StatusEvent {
 	return b.snowflakeCh
 }
 
-func (b *Bonafide) DoGeolocationLookup() (string, error) {
-	return "", errors.New("DoGeolocationLookup is not supported in v3 (only implemented in bitmask-core)")
+func (b *Bonafide) DoGeolocationLookup() error {
+	return errors.New("DoGeolocationLookup is not supported in v3 (only implemented in bitmask-core)")
 }
diff --git a/pkg/vpn/interface.go b/pkg/vpn/interface.go
index fce11fd2..6eb5c066 100644
--- a/pkg/vpn/interface.go
+++ b/pkg/vpn/interface.go
@@ -21,5 +21,5 @@ type apiInterface interface {
 	GetBestGateways(transport string) ([]bonafide.Gateway, error)
 	FetchAllGateways(transport string) error
 	GetSnowflakeCh() chan *snowflake.StatusEvent
-	DoGeolocationLookup() (string, error)
+	DoGeolocationLookup() error
 }
diff --git a/pkg/vpn/menshen/init.go b/pkg/vpn/menshen/init.go
index 90f9989d..853af0fb 100644
--- a/pkg/vpn/menshen/init.go
+++ b/pkg/vpn/menshen/init.go
@@ -146,6 +146,6 @@ func (m *Menshen) GetSnowflakeCh() chan *snowflake.StatusEvent {
 	return nil
 }
 
-func (m *Menshen) DoGeolocationLookup() (string, error) {
+func (m *Menshen) DoGeolocationLookup() error {
 	return m.api.DoGeolocationLookup()
 }
-- 
GitLab