diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-07 16:18:03 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-07 16:18:03 +0200 |
| commit | c67b8f64438d439d52a9e4955ff1bdf30363dbb1 (patch) | |
| tree | d54cc9b11bc5cfd9cfef375f4742987193050658 /internal/discovery/discovery.go | |
| parent | 7d67ce7f6a15970677b7d0b8f4912fe379862515 (diff) | |
Secure Internet: Implement the Ask Location transition callback
Diffstat (limited to 'internal/discovery/discovery.go')
| -rw-r--r-- | internal/discovery/discovery.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index 2331491..b4163a8 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -73,14 +73,21 @@ func (discovery *Discovery) DetermineOrganizationsUpdate() bool { return discovery.Organizations.Timestamp == 0 } -func (discovery *Discovery) GetSecureLocationList() []string { +func (discovery *Discovery) GetSecureLocationList() (string, error) { var locations []string for _, server := range discovery.Servers.List { if server.Type == "secure_internet" { locations = append(locations, server.CountryCode) } } - return locations + + jsonBytes, jsonErr := json.Marshal(locations) + + if jsonErr != nil { + return "", &types.WrappedErrorMessage{Message: "failed getting Secure Internet locations list", Err: jsonErr} + } + + return string(jsonBytes), nil } func (discovery *Discovery) GetServerByURL(url string, _type string) (*types.DiscoveryServer, error) { |
