summaryrefslogtreecommitdiff
path: root/internal/server/server.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-06-21 16:54:46 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-06-21 16:54:46 +0200
commit24be04cf37dbbeaf7fa33fa027ea6b54823e21f2 (patch)
tree5394f8b13e6713167c7e2fc0db133143ef4c84e6 /internal/server/server.go
parent1393ab1888e50cf623d22a8135daf42bda333f99 (diff)
Server: Add the ability to get the saved servers
Diffstat (limited to 'internal/server/server.go')
-rw-r--r--internal/server/server.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index ce72400..807bd09 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -1,6 +1,7 @@
package server
import (
+ "encoding/json"
"fmt"
"github.com/jwijenbergh/eduvpn-common/internal/fsm"
@@ -68,6 +69,16 @@ func (servers *Servers) GetCurrentServer() (Server, error) {
return institute, nil
}
+func (servers *Servers) GetJSON() (string, error) {
+ bytes, bytesErr := json.Marshal(servers)
+
+ if bytesErr != nil {
+ return "", bytesErr
+ }
+
+ return string(bytes), nil
+}
+
type Servers struct {
InstituteServers InstituteServers `json:"institute_servers"`
SecureInternetHomeServer SecureInternetHomeServer `json:"secure_internet_home"`