diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-01-03 12:37:00 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-01-03 12:37:00 +0100 |
| commit | 8e7a25eacf715d7d83a8f10c84b03c68ea04a871 (patch) | |
| tree | 06b760a15b873e935be726bd324daa2e06e32d18 | |
| parent | f654160956728bc0ce92ed420540388869405513 (diff) | |
Discovery: Remove server type from getting by country code
It's always secure internet, no need to pass it as an argument
| -rw-r--r-- | client/server.go | 2 | ||||
| -rw-r--r-- | internal/discovery/discovery.go | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/client/server.go b/client/server.go index 32b7687..bf4ad6a 100644 --- a/client/server.go +++ b/client/server.go @@ -105,7 +105,7 @@ func (c *Client) SetSecureLocation(countryCode string) error { return err } - srv, err := c.Discovery.ServerByCountryCode(countryCode, "secure_internet") + srv, err := c.Discovery.ServerByCountryCode(countryCode) if err != nil { c.goBackInternal() c.logError(err) diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index 7109bc9..b2a90cd 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -101,15 +101,15 @@ func (discovery *Discovery) ServerByURL( return nil, errors.Errorf("no server of type '%s' at URL '%s'", srvType, baseURL) } -// ServerByCountryCode returns the discovery server by the country code and the according type ("secure_internet", "institute_access") +// ServerByCountryCode returns the discovery server by the country code // An error is returned if and only if nil is returned for the server. -func (discovery *Discovery) ServerByCountryCode(countryCode string, srvType string) (*types.DiscoveryServer, error) { +func (discovery *Discovery) ServerByCountryCode(countryCode string) (*types.DiscoveryServer, error) { for _, srv := range discovery.servers.List { - if srv.CountryCode == countryCode && srv.Type == srvType { + if srv.CountryCode == countryCode && srv.Type == "secure_internet" { return &srv, nil } } - return nil, errors.Errorf("no server of type '%s' with country code '%s'", srvType, countryCode) + return nil, errors.Errorf("no server of type 'secure_internet' with country code '%s'", countryCode) } // orgByID returns the discovery organization by the organization ID |
